Skip to content

Commit e53fccf

Browse files
committed
[Fix] Don’t check filenames on text input.
Fixes jsx-eslint#662.
1 parent dea9e18 commit e53fccf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/rules/jsx-filename-extension.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ module.exports = function(context) {
3232
return {
3333

3434
JSXElement: function(node) {
35-
var allowedExtensions = getExtensionsConfig();
3635
var filename = context.getFilename();
36+
if (filename === '<text>') {
37+
return;
38+
}
3739

40+
var allowedExtensions = getExtensionsConfig();
3841
var isAllowedExtension = allowedExtensions.some(function (extension) {
3942
return filename.slice(-extension.length) === extension;
4043
});

tests/lib/rules/jsx-filename-extension.js

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ var ruleTester = new RuleTester();
3333
ruleTester.run('jsx-filename-extension', rule, {
3434

3535
valid: [
36+
{
37+
filename: '<text>',
38+
code: withJSX,
39+
parserOptions: parserOptions
40+
},
3641
{
3742
filename: 'MyComponent.jsx',
3843
code: withJSX,

0 commit comments

Comments
 (0)