eslint-plugin-sort-exports
eslint-plugin-sort-exports copied to clipboard
[ERR_ASSERTION]: Fix objects must not be overlapped in a report.
Lint the following with the default sort-exports
ESLint configuration:
export interface Alpha {
apple: number;
}
export namespace Delta {
export type Beta = string;
}
ESlint crashes with the following:
AssertionError [ERR_ASSERTION]: Fix objects must not be overlapped in a report.
at mergeFixes (.../node_modules/eslint/lib/linter/report-translator.js:167:9)
...
This is not an issue with the namespace per se. The "cause" is due to the type Beta
being alphabetically before the enclosing namespace Delta
. Simply change the type Beta
to something that comes after Delta
alphabetically, or flip the sortDir
to desc
. For example, this lints fine.
export interface Alpha {
apple: number;
}
export namespace Delta {
export type Gamma = string;
}
The "overlap" that ESLint is complaining about is:
[
{ range: [ 45, 100 ], text: 'export type Beta = string;' },
{
range: [ 72, 98 ],
text: 'export namespace Delta {\n export type Beta = string;\n}'
}
]
Config: eslint v8.23.0 node 16.16.0