import-js/eslint-plugin-import
View on GitHub[newline-after-import] Ignore comments between imports
Open
#2,673 opened on Jan 13, 2023
help wanted
Repository metrics
- Stars
- (4,946 stars)
- PR merge metrics
- (Avg merge 138d 22h) (3 merged PRs in 30d)
Description
Ignore comments between imports when option considerComments is actived in import/newline-after-import.
-
index.jsimport foo from "foo"; // Bar. // Baz. import qux from "qux"; // Quux. -
package.json{ "name": "testcase", "version": "1.0.0", "type": "module", "devDependencies": { "eslint": "9.12.0", "eslint-plugin-import": "2.31.0" } } -
eslint.config.jsimport pluginImport from "eslint-plugin-import"; export default [{ plugins: { "import": pluginImport }, rules: { "import/newline-after-import": ["error", { considerComments: true }] } }];
-
npm install -
npx eslint/home/regseb/testcase/index.js 1:1 error Expected 1 empty line after import statement not followed by another import import/newline-after-import ✖ 1 problem (1 error, 0 warnings) 1 error and 0 warnings potentially fixable with the `--fix` option.