Skip to content

Commit cecacc9

Browse files
committed
Forbid Webpack loader syntax in imports
Enable no-webpack-loader-syntax rule in eslint-config-react-app.
1 parent d5de99e commit cecacc9

File tree

1 file changed

+7
-2
lines changed
  • packages/eslint-config-react-app

1 file changed

+7
-2
lines changed

packages/eslint-config-react-app/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ module.exports = {
2121

2222
parser: 'babel-eslint',
2323

24-
// import plugin is temporarily disabled, scroll below to see why
25-
plugins: [/*'import', */'flowtype', 'jsx-a11y', 'react'],
24+
plugins: ['import', 'flowtype', 'jsx-a11y', 'react'],
2625

2726
env: {
2827
browser: true,
@@ -170,6 +169,9 @@ module.exports = {
170169
// This is probably fixable with a patch to eslint-loader.
171170
// When file A is saved, we want to invalidate all files that import it
172171
// *and* that currently have lint errors. This should fix the problem.
172+
// (As an exception, import/no-webpack-loader-syntax can be enabled already
173+
// because it doesn't depend on whether the file exists, so this issue
174+
// doesn't apply to it.)
173175

174176
// 'import/default': 'warn',
175177
// 'import/export': 'warn',
@@ -181,6 +183,9 @@ module.exports = {
181183
// 'import/no-named-as-default': 'warn',
182184
// 'import/no-named-as-default-member': 'warn',
183185
// 'import/no-unresolved': ['warn', { commonjs: true }],
186+
// We don't support configuring Webpack using import source strings, so this
187+
// is always an error.
188+
'import/no-webpack-loader-syntax': 'error',
184189

185190
// https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
186191
'react/jsx-equals-spacing': ['warn', 'never'],

0 commit comments

Comments
 (0)