Skip to content

Commit

Permalink
Add a .coffee test proving extension resolve order
Browse files Browse the repository at this point in the history
Add a test for a more unconventional extension to prove that the
"extensions" rule can take anything, as long as the extension resolve
order is correct, i.e. it can only remove the extension if it would
resolve to the correct file.

Ref. #965.
Closes #583.
  • Loading branch information
silvenon committed Feb 2, 2018
1 parent 364e841 commit fdcd4d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/files/bar.coffee
@@ -0,0 +1 @@
console.log 'bar'
14 changes: 13 additions & 1 deletion tests/src/rules/extensions.js
Expand Up @@ -183,7 +183,7 @@ ruleTester.run('extensions', rule, {
},
],
}),
// extension resolve order (#965)
// extension resolve order (#583/#965)
test({
code: [
'import component from "./bar.jsx"',
Expand All @@ -199,6 +199,18 @@ ruleTester.run('extensions', rule, {
},
],
}),
test({
code: 'import "./bar.coffee"',
errors: [
{
message: 'Unexpected use of file extension "coffee" for "./bar.coffee"',
line: 1,
column: 8,
},
],
options: ['never', { js: 'always', jsx: 'always' }],
settings: { 'import/resolve': { 'extensions': ['.coffee', '.js'] } },
}),

test({
code: [
Expand Down

0 comments on commit fdcd4d9

Please sign in to comment.