Skip to content

Commit b599b7c

Browse files
committed
Upgrade to import plugin v2
1 parent 357cc46 commit b599b7c

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

packages/eslint-config-airbnb-base/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@
4949
"babel-tape-runner": "^2.0.1",
5050
"eslint": "^3.7.1",
5151
"eslint-find-rules": "^1.14.0",
52-
"eslint-plugin-import": "^1.16.0",
52+
"eslint-plugin-import": "^2.0.1",
5353
"in-publish": "^2.0.0",
5454
"safe-publish-latest": "^1.1.1",
5555
"tape": "^4.6.2"
5656
},
5757
"peerDependencies": {
5858
"eslint": "^3.7.1",
59-
"eslint-plugin-import": "^1.16.0"
59+
"eslint-plugin-import": "^2.0.1"
6060
},
6161
"engines": {
6262
"node": ">= 4"

packages/eslint-config-airbnb-base/rules/imports.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = {
3333

3434
// ensure imports point to files/modules that can be resolved
3535
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
36-
'import/no-unresolved': ['error', { commonjs: true }],
36+
'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
3737

3838
// ensure named imports coupled with named exports
3939
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
@@ -92,9 +92,14 @@ module.exports = {
9292

9393
// Style guide:
9494

95+
// disallow non-import statements appearing before import statements
96+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
97+
'import/first': ['error', 'absolute-first'],
98+
9599
// disallow non-import statements appearing before import statements
96100
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
97-
'import/imports-first': ['error', 'absolute-first'],
101+
// deprecated: use `import/first`
102+
'import/imports-first': 'off',
98103

99104
// disallow duplicate imports
100105
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
@@ -149,5 +154,18 @@ module.exports = {
149154
'import/no-internal-modules': ['off', {
150155
allow: [],
151156
}],
157+
158+
// Warn if a module could be mistakenly parsed as a script by a consumer leveraging Unambiguous
159+
// JavaScript Grammar
160+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
161+
'import/unambiguous': 'off',
162+
163+
// Forbid Webpack loader syntax in imports
164+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
165+
'import/no-webpack-loader-syntax': 'off',
166+
167+
// Prevent unassigned imports
168+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
169+
'import/no-unassigned-import': 'off',
152170
},
153171
};

0 commit comments

Comments
 (0)