Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Console error Cannot read properties of null (reading 'getTypeChecker') #103

Open
3 tasks done
James-Wilkinson-git opened this issue Feb 8, 2024 · 4 comments
Open
3 tasks done

Comments

@James-Wilkinson-git
Copy link

Prerequisites

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

@certainlyakey
Copy link

Same with older versions (tested at 0.6.0). Eslint 8.51.0, node 18.17.1.

@Lunarion
Copy link

We are facing the same problem. Are there any updates or workarounds?

@gavmck
Copy link

gavmck commented Jul 16, 2024

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. 🚀

Hope that helps someone!

@ogdakke
Copy link

ogdakke commented Oct 18, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants