mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 00:28:25 -05:00
Enable import/no-webpack-loader-syntax rule
This commit is contained in:
15
README.md
15
README.md
@@ -1242,6 +1242,21 @@ Other Style Guides
|
||||
} from 'path';
|
||||
```
|
||||
|
||||
<a name="modules--no-webpack-loader-syntax"></a>
|
||||
- [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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user