Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Relevant Package
utils
Playground Link
Please focus on the range of the nodes.
Repro Code
@foo({name:1,})exportclassFoo{}
Expected Result
- Run
sourceCode.getNodeByRangeIndex(14) - Return
Property
Actual Result
ReturnProgram
Additional Info
When aClassDeclaration has a parent node of typeExportNamedDeclaration orExportDefaultDeclaration,sourceCode.getNodeByRangeIndex fails to return the correct node based on the provided index.
This occurs because the range ofExportDeclaration andClassDeclaration nodes does not include the range of decorators, causing decorators to be skipped during node retrieval.
This appears to be a design limitation in the ESTree specification. However, is it possible to override thegetNodeByRangeIndex to ensure it returns the correct node in such cases?
Versions
| package | version |
|---|---|
@typescript-eslint/eslint-plugin | 8.41.0 |
@typescript-eslint/parser | 8.41.0 |
@typescript-eslint/rule-tester | 8.41.0 |
@typescript-eslint/scope-manager | 8.41.0 |
@typescript-eslint/typescript-estree | 8.41.0 |
@typescript-eslint/type-utils | 8.41.0 |
@typescript-eslint/utils | 8.41.0 |
TypeScript | 5.8.3 |
ESLint | 9.34.0 |
node | 22.19.0 |