You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The newline-after-import rule does not appear to work when the first content encountered after imports is JSDoc. Take the following eslint.config.js as an example:
ESLint doesn't indicate the expected error after the import statements, but removing the JSDoc will result in the correct behavior:
importjsfrom'@eslint/js';importeslintConfigPrettierfrom'eslint-config-prettier';importeslintPluginImportfrom'eslint-plugin-import';importglobalsfrom'globals';importtsfrom'typescript-eslint';// Expected 1 empty line after import statement not followed by another import.eslint[import/newline-after-import](https://github.com/import-js/eslint-plugin-import/blob/v2.31.0/docs/rules/newline-after-import.md)exportdefaultts.config([eslintConfigPrettier,js.configs.recommended,
...ts.configs.strict,
...ts.configs.stylistic,{plugins: {import: eslintPluginImport,},languageOptions: {globals: {
...globals.node,
...globals.browser,},},rules: {'import/newline-after-import': ['error',{count: 1}],},},]);
Ah, yeah my wording might've come off a bit harsh, didn't mean to! Genuinely curious though now that you mention it, what specific to comments but not code would've made this a breaking change?
Activity
emmnull commentedon Dec 20, 2024
Nevermind, just realized there was a
considerCommentsoption (questionably) defaulting tofalse.ljharb commentedon Dec 20, 2024
It's not questionable at all; it would have been a breaking change to default that behavior to true.
emmnull commentedon Dec 20, 2024
Ah, yeah my wording might've come off a bit harsh, didn't mean to! Genuinely curious though now that you mention it, what specific to comments but not code would've made this a breaking change?
ljharb commentedon Dec 20, 2024
It could have created warnings or diffs on codebases that had no warnings or autofix diffs previously.
Update dependency eslint-plugin-import to v2.32.0