8000 Docs: Potentially confusing flow for enabling typed linting · Issue #6982 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
8000

Docs: Potentially confusing flow for enabling typed linting #6982

8000
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
zacharysyoung opened this issue May 3, 2023 · 4 comments
Closed
2 tasks done

Docs: Potentially confusing flow for enabling typed linting #6982

zacharysyoung opened this issue May 3, 2023 · 4 comments
Labels
documentation Documentation ("docs") that needs adding/updating wontfix This will not be worked on

Comments

@zacharysyoung
Copy link
zacharysyoung commented May 3, 2023

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

Suggested Changes

Related to #6826 and its PR #6919, I'm still getting the error, and still don't know what approach to take.

I tried the suggested "popular setup..." and ended up with the following:

.eslintrc.cjs

/* eslint-env node */
module.exports = {
    extends: [
        'eslint:recommended',
        'plugin:@typescript-eslint/recommended',
    ],
    parser: '@typescript-eslint/parser',
    parserOptions: {
        project: true,
        tsconfigRootDir: '.',
    },
    plugins: ['@typescript-eslint'],
    root: true,
    rules: {
        "semi": ["error", "always"]
    },
    overrides: [
        {
            extends: [
                'plugin:@typescript-eslint/recommended-requiring-type-checking',
            ],
            files: ['./**/*.{ts,tsx}'],
        },
    ],
};

tsconfig.json

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "outDir": "out",
        "strictNullChecks": true
    },
}

package.json

{
  "type": "commonjs",
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.59.2",
    "@typescript-eslint/parser": "^5.59.2",
    "eslint": "^8.39.0",
    "typescript": "^5.0.4"
  }
}

Did I misunderstand something in the // ... the rest of your config ... part of the CJS file?

You can see in the screenshot my .eslintr.cjs, and a foo.js in the out dir, are affected:

Screenshot 2023-05-02 at 21 18 55

Maybe I'm not the right audience for this "Getting Started": I've had some success getting ESLint configured for some JavaScript development I've done (and will continue to do), and I just decide to take the plunge and try and port a small codebase to TypeScript and I wanted the comfort and security I've gotten with ESLint over in JS-Land, which lead me to this Getting Started.

Sincerely, and thank you.

Affected URL(s)


8000
@zacharysyoung zacharysyoung added documentation Documentation ("docs") that needs adding/updating triage Waiting for team members to take a look labels May 3, 2023
@JoshuaKGoldberg JoshuaKGoldberg removed the triage Waiting for team members to take a look label May 6, 2023
@JoshuaKGoldberg
Copy link
Member

Maybe I'm not the right audience for this "Getting Started"

No you're definitely the right audience 😄 and this is very good docs feedback, thank you for raising it!

ended up with the following

ESLint was configured to run on your .js file, but is not included in any of your TSConfig file(s) (just the one in this case). It's not included because TypeScript doesn't by default include .js files unless the allowJs or checkJs options are enabled. Does that make sense?


Aside: normally for these kinds of questions I'd request posting in our Discord. But this one smells of a gap and/or flaw in the docs - hence the visibility here.

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label May 6, 2023
@JoshuaKGoldberg JoshuaKGoldberg changed the title Docs: <a short description of my proposal> Docs: Potentially confusing flow for enabling typed linting May 6, 2023
@bradzacher
Copy link
Member

This is fixed in v6 because in v6 the guide tells you to use the new disable type check config on js files IIRC

@JoshuaKGoldberg
Copy link
Member

cc @zacharysyoung - is there anything more you'd want here now that v6 is out?

@JoshuaKGoldberg
Copy link
Member

Closing as aged away. Thanks everyone!

@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2023
@JoshuaKGoldberg JoshuaKGoldberg added wontfix This will not be worked on and removed awaiting response Issues waiting for a reply from the OP or another party labels Oct 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Documentation ("docs") that needs adding/updating wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants
0