-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
const foo = () => (
<>
<div />
<div />
</>
);
ESLint Config
module.exports = {
"rules": {
"indent": ["error", 2]
}
}
tsconfig
Expected Result
Should not resulted in RangeError: Maximum call stack size exceeded
Actual Result
RangeError: Maximum call stack size exceeded
at Map.get (<anonymous>)
at s.getFirstTokenOfLine (https://typescript-eslint.io/sandbox/index.js:1:876916)
at a.getDesiredIndent (https://typescript-eslint.io/sandbox/index.js:1:878206)
at a.getDesiredIndent (https://typescript-eslint.io/sandbox/index.js:1:878173)
at a.getDesiredIndent (https://typescript-eslint.io/sandbox/index.js:1:878173)
at a.getDesiredIndent (https://typescript-eslint.io/sandbox/index.js:1:878173)
at a.getDesiredIndent (https://typescript-eslint.io/sandbox/index.js:1:878173)
at a.getDesiredIndent (https://typescript-eslint.io/sandbox/index.js:1:878173)
at a.getDesiredIndent (https://typescript-eslint.io/sandbox/index.js:1:878173)
at a.getDesiredIndent (https://typescript-eslint.io/sandbox/index.js:1:878173) 1:1 - 6:3
Additional Info
I know this error happen with @stylistic/indent
or the deprecated indent rule.
But the origin of the error seems to be from @typescript-eslint/parser
with typescript@5.9.*
(it works fine with typescript@5.8.3
).
Not sure if it should be fixed here or at ESLint Stylistic, but the ESLint Stylistic thinks this is an upstream issue.
From the ESLint Stylistic issue thread on eslint-stylistic/eslint-stylistic#915 :
@ota-meshi:
It seems that the tokens returned by @typescript-eslint/parser differ depending on the TypeScript version.
In TypeScript 5.8, </> returns three tokens: <, /, and >,
but in TypeScript 5.9, </> returns two tokens: </ and >.
The standard ESLint parser returns three tokens. Therefore, I think this is a problem with @typescript-eslint/parser.
FWIW, I tested the same rule configuration without TypeScript ESLint ESLint with Stylistic and it works fine.