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

Invalid "extends" eslint config option inside "overrides" entry #11

Open
gnapse opened this issue Mar 18, 2020 · 4 comments
Open

Invalid "extends" eslint config option inside "overrides" entry #11

gnapse opened this issue Mar 18, 2020 · 4 comments

Comments

@gnapse
Copy link

gnapse commented Mar 18, 2020

This happens in the code for the lesson to add support for eslint to support TypeScript files. In that lesson there's an instruction to add a "extends" config inside the "overrides" section intended to tailor the eslint config for TypeScript files.

Here's the exact line:

"extends": [

@stormfar
Copy link

Having the same issue. Any fix?

@kentcdodds
Copy link
Owner

Yeah, this was a mistake on my part. That feature is not supported. I'll be updating the course later this year most likely

@stormfar
Copy link

stormfar commented May 25, 2020

Until then, is there a work-around for making eslint support typescript files?

I see that the completed module on master has the following config:

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 2019,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    },
    "project": "./tsconfig.json"
  },
  "plugins": ["@typescript-eslint/eslint-plugin"],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "eslint-config-prettier",
    "eslint-config-prettier/@typescript-eslint"
  ],
  "rules": {
    "strict": ["error", "never"]
  },
  "env": {
    "browser": true
  }
}

where the parser is being set and the extends are added instead of in overrides, but when running, this throws an error.

error  Parsing error: If "parserOptions.project" has been set for @typescript-eslint/parser, /static-testing-tools/src/example.js must be included in at least one of the projects provided

Considering that this course claims it was 'updated for 2020' in recent marketing, should this not have been refreshed to a working state?

@kentcdodds
Copy link
Owner

This was updated in November (for 2020). There wasn't an error before, but things move fast and change a lot in the JavaScript ecosystem.

I'm getting this error now as well (despite package-lock.json 🙄).

After digging a little bit, I found this workaround: typescript-eslint/typescript-eslint#890

Basically, add "createDefaultProgram": true to your parserOptions in .eslintrc file. It's not recommended, but it's the workaround suggested by the team at the moment. Hopefully when I circle back on this to update things, we'll have a more solid solution.

I will be updating things later this year and we'll be in a good place again.

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

3 participants