Closed
Description
I'm running into an issue with import/order
and import/newline-after-import
, where more newlines are allowed than specified in the configuration. My (minimal) ESLint config looks like this:
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "eslint-plugin-import"],
"extends": ["plugin:eslint-plugin-import/typescript"],
"rules": {
"import/newline-after-import": ["error", {
"count": 1
}],
"import/order": ["error", {
"newlines-between": "always"
}]
}
}
I would expect this to ensure that there is always exactly one newline between import groups, and after all imports, e.g.:
import path from 'path';
import { bar } from "./bar";
import { baz } from "./baz";
console.log(path, bar, baz);
It works when there are less newlines than required, the following would result in an error for example:
import path from 'path';
import { bar } from "./bar";
import { baz } from "./baz";
console.log(path, bar, baz);
It does not seem to work when there are more newlines than the specified count
however. I would expect the following to result in errors, but it works fine:
import path from 'path';
import { bar } from "./bar";
import { baz } from "./baz";
console.log(path, bar, baz);
Am I misunderstanding newline-after-import
's count
option, or is this a bug?