Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
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 havesearched for related issues and found none that matched my issue.
- I haveread 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 numberError: 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:40Caused 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 repogit clone https://github.com/jeremybanka/tseslint-parsing-bug.git# 2. install dependenciesnpm install# 3. run testsnpmtest
You will see the error shown above.
To verify that it does not occur with the previous version8.10.0
, simply revert my most recent commit:
# 1. go back one commit without leaving any staged changesgit reset --hard HEAD^# 2. reinstall depsnpm install# 3. rerun testsnpmtest
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 |