Skip to content
This repository was archived by the owner on May 29, 2023. It is now read-only.

Commit b59bfff

Browse files
committed
Enable import/no-webpack-loader-syntax rule
1 parent eb9927f commit b59bfff

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,21 @@ Other Style Guides
12421242
} from 'path';
12431243
```
12441244
1245+
<a name="modules--no-webpack-loader-syntax"></a>
1246+
- [10.9](#modules--no-webpack-loader-syntax) Disallow Webpack loader syntax in module import statements.
1247+
eslint: [`import/no-webpack-loader-syntax`](https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md)
1248+
> Why? Since using Webpack syntax in the imports couples the code to a module bundler. Prefer using the loader syntax in `webpack.config.js`.
1249+
1250+
```javascript
1251+
// bad
1252+
import fooSass from 'css!sass!foo.scss';
1253+
import barCss from 'style!css!bar.css';
1254+
1255+
// good
1256+
import fooSass from 'foo.scss';
1257+
import barCss from 'bar.css';
1258+
```
1259+
12451260
**[⬆ back to top](#table-of-contents)**
12461261
12471262
## Iterators and Generators

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ module.exports = {
162162

163163
// Forbid Webpack loader syntax in imports
164164
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
165-
'import/no-webpack-loader-syntax': 'off',
165+
'import/no-webpack-loader-syntax': 'error',
166166

167167
// Prevent unassigned imports
168168
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md

0 commit comments

Comments
 (0)