This ESLint rule ensures that each property in an import statement is placed on a new line.
- Forces a consistent style for multiline imports
- Enhances readability of codebase
- Ideal for large projects where maintaining a consistent coding style is critical
First, you'll need to install ESLint:
$ npm i eslint --save-dev
Next, install @absqueued/eslint-newline-imports
:
$ npm install @absqueued/eslint-newline-imports --save-dev
Note: If you installed ESLint globally (using the -g flag) then you must also install @absqueued/eslint-newline-imports
globally.
Add @absqueued/eslint-newline-imports
to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"@absqueued/eslint-newline-imports"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"@absqueued/eslint-newline-imports": ["error", {"maxPropertiesOnSingleLine": 2}]
}
}
newline-import
: Enforces a new line for each property in an import statement.
Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.
To run the test suite, first install the dependencies, then run npm test:
$ npm install
$ npm test
MIT © Shekhar K. Sharma
Give me a ⭐️ if this project helped you!
Follow me on Twitter.