Closed
Description
Information:
- ESLint version: 8.2.0
eslint-plugin-regexp
version: 1.5.0
Description
Hello, no-legacy-features
rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything. https://github.com/AriPerkkio/eslint-remote-tester/actions/runs/1476359476
It seems that something in this plugin is causing either whole typescript or just the parser to crash. I decided to report this issue to this project since other ESLint plugins are not crashing for the same minimal repro. For example, plugin:@typescript-eslint/recommended
does not crash for this case. It's still likely that the root cause is in some dependency of this plugin.
AriPerkkio/eslint-remote-tester#307 (comment)
Minimal repro
<root>
├── package.json
├── hello.d.ts
└── world.d.ts
{
"scripts": {
"lint": "eslint hello.d.ts"
},
"devDependencies": {
"@typescript-eslint/parser": "5.4.0",
"eslint": "8.2.0",
"eslint-plugin-regexp": "1.5.0",
"typescript": "4.5.2"
}
}
// world.d.ts
export default function world(): string;
// hello.d.ts
import world from "./world";
export as namespace world;
export = world;
$ yarn lint
yarn run v1.22.10
warning package.json: No license field
$ eslint hello.d.ts
Oops! Something went wrong! :(
ESLint: 8.2.0
Error: Error while loading rule 'regexp/no-legacy-features': Debug Failure.
Occurred while linting /workspaces/eslint-demo-repro/hello.d.ts
at getTypeOfVariableOrParameterOrPropertyWorker (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:55033:22)
at getTypeOfVariableOrParameterOrProperty (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:54997:28)
at getTypeOfSymbol (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:55370:24)
at getTypeOfAlias (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:55302:73)
at getTypeOfSymbol (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:55382:24)
at resolveExportByName (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:49073:64)
at getTargetOfImportClause (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:49138:43)
at getTargetOfAliasDeclaration (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:49422:28)
at resolveAlias (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:49469:30)
at getSymbol (/workspaces/eslint-demo-repro/node_modules/typescript/lib/typescript.js:48027:38)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This setup does not crash:
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"extends": ["plugin:@typescript-eslint/recommended"]
}