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

Incompatibility with @typescript-eslint #92

Closed
Kerumen opened this issue Oct 29, 2019 · 6 comments
Closed

Incompatibility with @typescript-eslint #92

Kerumen opened this issue Oct 29, 2019 · 6 comments
Labels
🤷 no/invalid This cannot be acted upon 🙋 no/question This does not need any changes

Comments

@Kerumen
Copy link

Kerumen commented Oct 29, 2019

When we use the config @typescript-eslint/recommended-requiring-type-checking from typescript-eslint we have to set parserOptions.project.

It seems that eslint-mdx overwrites the parserOptions.project config because when we run eslint we get this error:

Error: Error while loading rule '@typescript-eslint/no-misused-promises': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
@JounQin
Copy link
Member

JounQin commented Oct 29, 2019

Please provide more detail.

Including your eslint config, or a minimal runnable reproduction.

(This seems a usage question, instead of bug, IMO)

You can always use overrides feature of eslint, check https://github.com/1stG/configs/blob/master/packages/eslint-config/overrides.js as reference or demo.

@JounQin
Copy link
Member

JounQin commented Oct 29, 2019

Don't enable @typescript-eslint/recommended-requiring-type-checking for all files.

@JounQin JounQin closed this as completed Oct 29, 2019
@JounQin JounQin added 🤷 no/invalid This cannot be acted upon 🙋 no/question This does not need any changes labels Oct 29, 2019
@daviddelusenet
Copy link

I was also experiencing this issue, I solved it by doing the following:

  • Removed @typescript-eslint/recommended-requiring-type-checking from my extends.
  • Added the following part to the overrides section in my ESLint configuration:
{
  "files": ["*.tsx"],
  "extends": ["plugin:@typescript-eslint/recommended-requiring-type-checking"]
}

The error went away and linting works fine!

@jackkrone
Copy link

jackkrone commented Nov 9, 2021

I was also experiencing this issue, I solved it by doing the following:

  • Removed @typescript-eslint/recommended-requiring-type-checking from my extends.
  • Added the following part to the overrides section in my ESLint configuration:
{
  "files": ["*.tsx"],
  "extends": ["plugin:@typescript-eslint/recommended-requiring-type-checking"]
}

The error went away and linting works fine!

Could you share your full eslintrc setup? When I use your solution I get the same eslint error in all of my mdx files: Parsing error: Expression expected

@JounQin
Copy link
Member

JounQin commented Nov 9, 2021

@jackkrone You'd better provide your reproduction instead.

@jackkrone
Copy link

@JounQin Sure. I just figured it out, as indicated in #251 (comment)

This is what my overrides array looks like in eslintrc:

  "overrides": [
    {
      "files": [".tsx", ".ts"],
      "extends": "plugin:@typescript-eslint/recommended-requiring-type-checking"
    },
    {
      "files": ["*.mdx"],
      "extends": "plugin:mdx/recommended"
    }
  ]

I've found that this is required if using the @typescript-eslint/parser and the @typescript-eslint/recommended-requiring-type-checking plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷 no/invalid This cannot be acted upon 🙋 no/question This does not need any changes
Development

No branches or pull requests

4 participants