Closed
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.
Issue Description
RuleTester
is no longer able to function in any test case I have been able to find, always throwing a type error before handling the test case.
Looking into the issue, it seems to stem from providedConfig always being undefined. I suspect the issue was introduced by #10147 .
At some point, a property is accessed and we get the TypeError given in the title. In detail, it looks like
FAIL lint.test.ts > only-ever-use-literal-number-type > valid > type is number
Error: Caught an error while linting
❯ Linter.RuleTester.#linter.linter.verify node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:204:17
❯ RuleTester.runRuleForItem node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:770:33
❯ RuleTester.#testValidTemplate node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:863:25
❯ node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:541:40
Caused by: TypeError: Cannot read properties of undefined (reading 'parse')
❯ ParserService.parseSync node_modules/eslint/lib/services/parser-service.js:36:33
❯ Linter.#flatVerifyWithoutProcessors node_modules/eslint/lib/linter/linter.js:1680:47
❯ Linter._verifyWithFlatConfigArrayAndWithoutProcessors node_modules/eslint/lib/linter/linter.js:1992:49
❯ Linter._verifyWithFlatConfigArray node_modules/eslint/lib/linter/linter.js:2081:21
❯ Linter.verify node_modules/eslint/lib/linter/linter.js:1528:61
❯ Linter.RuleTester.#linter.linter.verify node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:202:18
❯ RuleTester.runRuleForItem node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:770:33
❯ RuleTester.#testValidTemplate node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:863:25
❯ node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:541:40
Reproduction Repository Link
https://github.com/jeremybanka/tseslint-parsing-bug
Repro Steps
# 1. clone the repo
git clone https://github.com/jeremybanka/tseslint-parsing-bug.git
# 2. install dependencies
npm install
# 3. run tests
npm test
You will see the error shown above.
To verify that it does not occur with the previous version 8.10.0
, simply revert my most recent commit:
# 1. go back one commit without leaving any staged changes
git reset --hard HEAD^
# 2. reinstall deps
npm install
# 3. rerun tests
npm test
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
8.11.0 |
@typescript-eslint/parser |
8.11.0 |
@typescript-eslint/rule-tester |
8.11.0 |
TypeScript |
5.6.3 |
ESLint |
9.13.0 |
node |
22.10.0 |