Skip to content

Commit

Permalink
fix: only override prefer-import for root config files
Browse files Browse the repository at this point in the history
Fixes #73
  • Loading branch information
satazor committed Oct 13, 2019
1 parent 6ebb85b commit dcd65a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addons/es-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
'prefer-import/prefer-import-over-require': 1,
},
'overrides': [{
'files': '*.config.js',
'files': './*.config.js',
'rules': {
'prefer-import/prefer-import-over-require': 0,
},
Expand Down
11 changes: 11 additions & 0 deletions test/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,17 @@ Array [

exports[`should pass on fixtures/samples/es6-modules/contrived.good.js 1`] = `Array []`;

exports[`should pass on fixtures/samples/es6-modules/nested/require.config.js 1`] = `
Array [
Object {
"column": 14,
"line": 5,
"rule": "prefer-import/prefer-import-over-require",
"severity": 1,
},
]
`;

exports[`should pass on fixtures/samples/es6-modules/require.config.js 1`] = `Array []`;

exports[`should pass on fixtures/samples/es6-modules/require.js 1`] = `
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/samples/es6-modules/nested/require.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Made up sample.. not genuine

// [...].config.js file, should not warn against require

const test = require('good');

console.log(test);

0 comments on commit dcd65a9

Please sign in to comment.