Registry / testing / eslint-plugin-import-newlines

eslint-plugin-import-newlines

JSON →
library2.0.0jsnpmunverified

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-newlines
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-IMPO
E
eslint-plugin-import-newlines
testingjavascriptv2.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

eslint-plugin-import-newlines
Add 'import-newlines' to the plugins array in your ESLint config
adding 'eslint-plugin-import-newlines' to the plugins array
ESLint expects the short package name (without 'eslint-plugin-') when loading plugins.
import-newlines/enforce
Configure rule in rules object as 'import-newlines/enforce': 'error' or ['error', options]
using 'enforce' without the 'import-newlines/' prefix
Rule names must be prefixed with the plugin namespace.

Shows ESLint configuration to enable the plugin with custom items, max-len, and semi options.

{ "plugins": ["import-newlines"], "rules": { "import-newlines/enforce": ["error", { "items": 3, "max-len": 100, "semi": false }] } }
Debug
Known issues
breakingVersion 2.0.0 drops support for ESLint 9 and below.
fix
Upgrade to ESLint 10+ or stay on eslint-plugin-import-newlines v1.x.x.
affects: >=2.0.0
breakingVersion 2.0.0 requires Node.js >=20.19.0.
fix
Upgrade Node to 20.19.0 or later, or stay on v1.x.x.
affects: >=2.0.0
gotchaThe rule's autofix does not add indentation; final formatting relies on the 'indent' rule.
fix
Enable and configure ESLint's built-in 'indent' rule to handle indentation after autofix.
affects: *
gotchaThe 'semi' option must match your code style (semicolons at end of imports) to avoid false max-len calculations.
fix
Set 'semi' option to 'true' (default) if you use semicolons, 'false' if you don't.
affects: *
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-import-newlines".
Plugin not installed or ESLint is not using the correct config file path.
fix
Run 'npm install eslint-plugin-import-newlines --save-dev' and ensure your ESLint config references the correct plugin name.
Configuration for rule "import-newlines/enforce" is invalid: Value "[object Object]" must be an array or a string.
Passed an object as the rule value without wrapping it in an array.
fix
Use an array format: ["error", {"items": 2}].
Error: Cannot find module 'eslint-plugin-import-newlines'
The package is not installed or node_modules is corrupted.
fix
Reinstall the plugin with 'npm install eslint-plugin-import-newlines --save-dev'.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency; required to load the plugin
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-import-newlines — npm install eslint-plugin-import-newlines · libregistry