From b59bfffac3812aef551a29720302a1ba977b3149 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 13 Oct 2016 09:00:23 +0200 Subject: [PATCH] Enable `import/no-webpack-loader-syntax` rule --- README.md | 15 +++++++++++++++ .../eslint-config-airbnb-base/rules/imports.js | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c7c39d9a..c7f1c98d 100644 --- a/README.md +++ b/README.md @@ -1242,6 +1242,21 @@ Other Style Guides } from 'path'; ``` + + - [10.9](#modules--no-webpack-loader-syntax) Disallow Webpack loader syntax in module import statements. + eslint: [`import/no-webpack-loader-syntax`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md) + > Why? Since using Webpack syntax in the imports couples the code to a module bundler. Prefer using the loader syntax in `webpack.config.js`. + + ```javascript + // bad + import fooSass from 'css!sass!foo.scss'; + import barCss from 'style!css!bar.css'; + + // good + import fooSass from 'foo.scss'; + import barCss from 'bar.css'; + ``` + **[⬆ back to top](#table-of-contents)** ## Iterators and Generators diff --git a/packages/eslint-config-airbnb-base/rules/imports.js b/packages/eslint-config-airbnb-base/rules/imports.js index 5306e3cd..a02ef930 100644 --- a/packages/eslint-config-airbnb-base/rules/imports.js +++ b/packages/eslint-config-airbnb-base/rules/imports.js @@ -162,7 +162,7 @@ module.exports = { // Forbid Webpack loader syntax in imports // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md - 'import/no-webpack-loader-syntax': 'off', + 'import/no-webpack-loader-syntax': 'error', // Prevent unassigned imports // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md