{"id":19794,"library":"eslint-plugin-import-newlines","title":"eslint-plugin-import-newlines","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/SeinopSys/eslint-plugin-import-newlines","tags":["javascript","eslint","eslint-plugin","eslintplugin","lint","import"],"install":[{"cmd":"npm install eslint-plugin-import-newlines","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-import-newlines","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-import-newlines","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; required to load the plugin","package":"eslint","optional":false}],"imports":[{"note":"ESLint expects the short package name (without 'eslint-plugin-') when loading plugins.","wrong":"adding 'eslint-plugin-import-newlines' to the plugins array","symbol":"eslint-plugin-import-newlines","correct":"Add 'import-newlines' to the plugins array in your ESLint config"},{"note":"Rule names must be prefixed with the plugin namespace.","wrong":"using 'enforce' without the 'import-newlines/' prefix","symbol":"import-newlines/enforce","correct":"Configure rule in rules object as 'import-newlines/enforce': 'error' or ['error', options]"}],"quickstart":{"code":"{\n  \"plugins\": [\"import-newlines\"],\n  \"rules\": {\n    \"import-newlines/enforce\": [\"error\", {\n      \"items\": 3,\n      \"max-len\": 100,\n      \"semi\": false\n    }]\n  }\n}","lang":"javascript","description":"Shows ESLint configuration to enable the plugin with custom items, max-len, and semi options."},"warnings":[{"fix":"Upgrade to ESLint 10+ or stay on eslint-plugin-import-newlines v1.x.x.","message":"Version 2.0.0 drops support for ESLint 9 and below.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade Node to 20.19.0 or later, or stay on v1.x.x.","message":"Version 2.0.0 requires Node.js >=20.19.0.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Enable and configure ESLint's built-in 'indent' rule to handle indentation after autofix.","message":"The rule's autofix does not add indentation; final formatting relies on the 'indent' rule.","severity":"gotcha","affected_versions":"*"},{"fix":"Set 'semi' option to 'true' (default) if you use semicolons, 'false' if you don't.","message":"The 'semi' option must match your code style (semicolons at end of imports) to avoid false max-len calculations.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-plugin-import-newlines --save-dev' and ensure your ESLint config references the correct plugin name.","cause":"Plugin not installed or ESLint is not using the correct config file path.","error":"ESLint couldn't find the plugin \"eslint-plugin-import-newlines\"."},{"fix":"Use an array format: [\"error\", {\"items\": 2}].","cause":"Passed an object as the rule value without wrapping it in an array.","error":"Configuration for rule \"import-newlines/enforce\" is invalid: Value \"[object Object]\" must be an array or a string."},{"fix":"Reinstall the plugin with 'npm install eslint-plugin-import-newlines --save-dev'.","cause":"The package is not installed or node_modules is corrupted.","error":"Error: Cannot find module 'eslint-plugin-import-newlines'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}