ESLint plugin to enforce the order of import/require statements.
This plugin is no longer maintained, as its sole feature has been integrated and improved upon in eslint-plugin-import, which does even more cool stuff. The corresponding rule is available under the name order
.
$ npm install --save-dev eslint eslint-plugin-import-order
Configure it in package.json
.
{
"name": "my-awesome-project",
"eslintConfig": {
"env": {
"es6": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins": [
"import-order"
],
"rules": {
"import-order/import-order": 2
}
}
}
- import-order - Enforce a convention in module import order.
This plugin exports a recommended
configuration that enforces good practices.
To enable this configuration use the extends
property in your package.json
.
{
"name": "my-awesome-project",
"eslintConfig": {
"extends": "plugin:import-order/recommended",
"plugins": [
"import-order"
]
}
}
See ESLint documentation for more information about extending configuration files.
Note: This configuration will also enable the correct parser options and environment.