8000 Docs: Typed Linting guide causes ESLint complaints in .eslintrc.(c)js · Issue #6826 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content

Docs: Typed Linting guide causes ESLint complaints in .eslintrc.(c)js #6826

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

Closed
2 tasks done
JoshuaKGoldberg opened this issue Apr 2, 2023 · 0 comments · Fixed by #6919
Closed
2 tasks done

Docs: Typed Linting guide causes ESLint complaints in .eslintrc.(c)js #6826

JoshuaKGoldberg opened this issue Apr 2, 2023 · 0 comments · Fixed by #6919
Assignees
Labels
accepting prs Go ahead, send a pull request that resolves this issue documentation Documentation ("docs") that needs adding/updating

Comments

@JoshuaKGoldberg
Copy link
Member
JoshuaKGoldberg commented Apr 2, 2023

Before You File a Documentation Request Please Confirm You Have Done The Following...

Suggested Changes

When starting a TypeScript repository from scratch using our docs, the typical flow is:

  1. Getting Started
  2. Linting with Type Information

...however, we don't mention anything about how to get typed linting working (or excluded) for the .eslintrc.(c)js file we tell the user to write. As a result, the file receives this lovely complaint:

Parsing error: ESLint was configured to run on `<tsconfigRootDir>/.eslintrc.cjs` using `parserOptions.project`: /users/josh/repos/repros/tsconfig.json
However, that TSConfig does not include this file. Either:
- Change ESLint's list of included files to not include this file
- Change that TSConfig to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-fileeslint

Screenshot of the previous lint error in VS Code

That's a very wordy complaint for a first-time typed linting user to receive. Not ideal.

I'm not sure what the best way to resolve this is. A few starting options:

  • Use config overrides to restrict type checking to .ts, .tsx, .cts, etc. files (I'm a little negative on this, as it makes the config more complex)
  • Tell them to exclude that ESLint config from being linted (I don't like this - many of us want to lint all our files)
  • Have the user allowJs in their TSConfig used for ESLint (I really don't like this - users will need to either add a new TSConfig for linting or modify their main project's compiler options)

...I don't love any of those 🤔. How are users "supposed" to fix this?

This issue came out of a Twitch stream with @Jutanium. 👋

Affected URL(s)

https://typescript-eslint.io/linting/typed-linting

@JoshuaKGoldberg JoshuaKGoldberg added triage Waiting for team members to take a look documentation Documentation ("docs") that needs adding/updating labels Apr 2, 2023
@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Wa 8000 iting for team members to take a look labels Apr 16, 2023
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Apr 16, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue documentation Documentation ("docs") that needs adding/updating
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0