From e53fccf532db3af5c1a260454f9b6137e31889ad Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 6 Jul 2016 14:19:58 -0700 Subject: [PATCH] =?UTF-8?q?[Fix]=20Don=E2=80=99t=20check=20filenames=20on?= =?UTF-8?q?=20text=20input.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #662. --- lib/rules/jsx-filename-extension.js | 5 ++++- tests/lib/rules/jsx-filename-extension.js | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/rules/jsx-filename-extension.js b/lib/rules/jsx-filename-extension.js index 6fa7e1dcd5..2fde88d459 100644 --- a/lib/rules/jsx-filename-extension.js +++ b/lib/rules/jsx-filename-extension.js @@ -32,9 +32,12 @@ module.exports = function(context) { return { JSXElement: function(node) { - var allowedExtensions = getExtensionsConfig(); var filename = context.getFilename(); + if (filename === '') { + return; + } + var allowedExtensions = getExtensionsConfig(); var isAllowedExtension = allowedExtensions.some(function (extension) { return filename.slice(-extension.length) === extension; }); diff --git a/tests/lib/rules/jsx-filename-extension.js b/tests/lib/rules/jsx-filename-extension.js index f40e3d5cc9..578682dcb4 100644 --- a/tests/lib/rules/jsx-filename-extension.js +++ b/tests/lib/rules/jsx-filename-extension.js @@ -33,6 +33,11 @@ var ruleTester = new RuleTester(); ruleTester.run('jsx-filename-extension', rule, { valid: [ + { + filename: '', + code: withJSX, + parserOptions: parserOptions + }, { filename: 'MyComponent.jsx', code: withJSX,