-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This test/src/rules/extensions.js
test should be failing with 2 errors not 1
#965
Comments
We should probably audit all of the tests for this rule to see where the problem is. |
I believe this rule behaves correctly because |
Hmm - if that's true, then a second test, that's an exact duplicate but without the first import line, would fail with just one error - the "missing" one referenced above. |
Also without the first specified extension being test({
code: [
'import component from "./bar.jsx"',
'import data from "./bar.json"',
].join('\n'),
options: [ { json: 'always', js: 'never', jsx: 'never' } ],
settings: { 'import/resolve': { 'extensions': [ '.jsx', '.json', '.js' ] } },
errors: [
{
message: 'Unexpected use of file extension "jsx" for "./bar.jsx"',
line: 1,
column: 23,
},
],
}), |
This might seem like confusing behavior at first, but I see no possible alternative, so forcing the extension if omitting it would not yield the desired result is pretty smart. |
Sounds like we might want to add more test cases, but everything's correct as-is? |
This
invalid
test should fail with 2 errors – 1 for.js
and another for.jsx
.https://github.com/benmosher/eslint-plugin-import/blob/a5844d57be0c3757248c7b824e4cc9c2c844db33/tests/src/rules/extensions.js#L129-L144
The error that I believe is missing:
The text was updated successfully, but these errors were encountered: