prevent-abbreviations: Fix objects must not be overlapped in a report.
See original GitHub issueHello, I’m testing stability of well known community ESLint plugins with eslint-remote-tester
. This ESLint plugin seems to contain a rule which causes linter to crash. ESLint rules should not crash in any condition since this makes all valid linting problems disappear. If this is a false flag please let me know.
This issue was spotted by automated CI run: https://github.com/AriPerkkio/eslint-remote-tester/runs/1487452403
Crashing rule:
prevent-abbreviations
If name of the VariableExpression
and name of the TSTypeReference
are identical unicorn/prevent-abbreviations
crashes.
Minimal repro:
This seems to be valid typescript: https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgApQPYAdkG8BQyRywAJgFzIgCuAtgEbQDc+AvvvghiAM5hqYsldNmQBePCQrIAjMlYt8EAB5YMUfqQjxqAG34isTIA
interface Prop {
id: number;
}
const Prop: Prop = { id: 1 };
export default Prop;
This causes ESlint to dispaly an error:
$ ./node_modules/.bin/eslint lib
Oops! Something went wrong! :(
ESLint: 7.12.1
AssertionError [ERR_ASSERTION]: Fix objects must not be overlapped in a report.
at mergeFixes (/<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:152:9)
at normalizeFixes (/<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:182:16)
at /<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/<root-path-removed>/node_modules/eslint/lib/linter/linter.js:920:41)
at checkVariable (/<root-path-removed>/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:653:11)
at checkPossiblyWeirdClassVariable (/<root-path-removed>/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:567:10)
at /<root-path-removed>/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:657:39
at Array.forEach (<anonymous>)
at checkVariables (/<root-path-removed>/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:657:19)
at checkScope (/<root-path-removed>/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:665:3)
Errors from real-world projects
Rule: prevent-abbreviations
- Message:
Fix objects must not be overlapped in a report. Occurred while linting <text>:1
- Path:
microsoft/fluentui/packages/codemods/src/modRunner/tests/mocks/MockMods/CodeMod.mock.ts
- Link
AssertionError [ERR_ASSERTION]: Fix objects must not be overlapped in a report.
at mergeFixes (/<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:152:9)
at normalizeFixes (/<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:182:16)
at /<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/<root-path-removed>/node_modules/eslint/lib/linter/linter.js:920:41)
at checkVariable (/<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:653:11)
at checkPossiblyWeirdClassVariable (/<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:567:10)
at /<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:657:39
at Array.forEach (<anonymous>)
at checkVariables (/<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:657:19)
at checkScope (/<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:665:3)
Rule: prevent-abbreviations
- Message:
Fix objects must not be overlapped in a report. Occurred while linting <text>:1
- Path:
microsoft/fluentui/packages/fluentui/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsTable.tsx
- Link
AssertionError [ERR_ASSERTION]: Fix objects must not be overlapped in a report.
at mergeFixes (/<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:152:9)
at normalizeFixes (/<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:182:16)
at /<root-path-removed>/node_modules/eslint/lib/linter/report-translator.js:347:49
at Object.report (/<root-path-removed>/node_modules/eslint/lib/linter/linter.js:920:41)
at checkVariable (/<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:653:11)
at checkPossiblyWeirdClassVariable (/<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:567:10)
at /<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:657:39
at Array.forEach (<anonymous>)
at checkVariables (/<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:657:19)
at checkScope (/<root-path-removed>/ci/node_modules/eslint-plugin-unicorn/rules/prevent-abbreviations.js:665:3)
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
That’s fast!
https://github.com/AriPerkkio/eslint-remote-tester/actions/runs/400370452