ESLint plugin that enforces newlines in ES6 import statements when the number of imported specifiers exceeds a configurable threshold. The current stable version is 2.0.0, which requires ESLint >=10 and Node >=20.19.0. It provides a single rule 'import-newlines/enforce' that automatically splits multi-item imports across multiple lines when they exceed the limit, and conversely collapses single-line imports that are under the limit. Key differentiators: built-in autofix, integration with max-len and semicolon settings, and simple object-based configuration. No dependencies other than ESLint peer dependency.
npm install eslint-plugin-import-newlinesVerified import paths — ran on the pinned version, not inferred.
Shows ESLint configuration to enable the plugin with custom items, max-len, and semi options.
Upgrade to ESLint 10+ or stay on eslint-plugin-import-newlines v1.x.x.
Upgrade Node to 20.19.0 or later, or stay on v1.x.x.
Enable and configure ESLint's built-in 'indent' rule to handle indentation after autofix.
Set 'semi' option to 'true' (default) if you use semicolons, 'false' if you don't.
Run 'npm install eslint-plugin-import-newlines --save-dev' and ensure your ESLint config references the correct plugin name.
Use an array format: ["error", {"items": 2}].Reinstall the plugin with 'npm install eslint-plugin-import-newlines --save-dev'.