stencil-eslint
stencil-eslint copied to clipboard
bug: Console error Cannot read properties of null (reading 'getTypeChecker')
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already report this problem, without success.
Stencil ESLint Version
^0.7.1
Current Behavior
After installing eslint and the plugin for stencil lint then running on the files the console errors
Oops! Something went wrong! :(
ESLint: 8.56.0
TypeError: Error while loading rule '@stencil-community/async-methods': Cannot read properties of null (reading 'getTypeChecker')
Expected Behavior
The linter should run
Steps to Reproduce
Install a new eslint and eslint stencil into your project
Code Reproduction URL
n/a
Additional Information
No response
Same with older versions (tested at 0.6.0). Eslint 8.51.0, node 18.17.1.
We are facing the same problem. Are there any updates or workarounds?
Also running into this one with eslint 8.56.0.
Edit: Adding some more detail. It looks like this error kicks in on eslint 8.45.0
Edit again: Stencil is expecting typed rules to be on https://typescript-eslint.io/developers/custom-rules/#typed-rules
The error comes from services.program.getTypeChecker, but program is null if type checking is turned off.
I had a look around and it seemed that eslint was not picking up my tsconfig so type checking was turned off, breaking stencil.
I had a peek at these release notes https://typescript-eslint.io/blog/announcing-typescript-eslint-v6/
Then added
"parserOptions": {
"project": "./tsconfig.json"
}
to my .eslintrc.json, which seems to have fixed the issue. :rocket:
Hope that helps someone!
Had the same issue, and resolved it in our monorepo by adding
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
We're doing the "one tsconfig per package" method in our monorepo. See typescript-eslint monorepo configuration