From 0c5c2e0caa939cad05a8f016f3ba60fb619e81b4 Mon Sep 17 00:00:00 2001 From: Ville Immonen Date: Sat, 22 Oct 2016 23:11:25 +0300 Subject: [PATCH] Forbid Webpack loader syntax in imports (#803) Enable no-webpack-loader-syntax rule in eslint-config-react-app. --- packages/eslint-config-react-app/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index 7689a83544b..f2f79a2dcc1 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -21,8 +21,7 @@ module.exports = { parser: 'babel-eslint', - // import plugin is temporarily disabled, scroll below to see why - plugins: [/*'import', */'flowtype', 'jsx-a11y', 'react'], + plugins: ['import', 'flowtype', 'jsx-a11y', 'react'], env: { browser: true, @@ -170,6 +169,9 @@ module.exports = { // This is probably fixable with a patch to eslint-loader. // When file A is saved, we want to invalidate all files that import it // *and* that currently have lint errors. This should fix the problem. + // (As an exception, import/no-webpack-loader-syntax can be enabled already + // because it doesn't depend on whether the file exists, so this issue + // doesn't apply to it.) // 'import/default': 'warn', // 'import/export': 'warn', @@ -181,6 +183,9 @@ module.exports = { // 'import/no-named-as-default': 'warn', // 'import/no-named-as-default-member': 'warn', // 'import/no-unresolved': ['warn', { commonjs: true }], + // We don't support configuring Webpack using import source strings, so this + // is always an error. + 'import/no-webpack-loader-syntax': 'error', // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules 'react/jsx-equals-spacing': ['warn', 'never'],