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

Auto-fix typescript's no-unused-var rule using --init #13233

Closed
davc0n opened this issue Apr 28, 2020 · 9 comments · Fixed by #13235
Closed

Auto-fix typescript's no-unused-var rule using --init #13233

davc0n opened this issue Apr 28, 2020 · 9 comments · Fixed by #13235
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint

Comments

@davc0n
Copy link

davc0n commented Apr 28, 2020

The version of ESLint you are using.
6.8.0

The problem you want to solve.
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md

Your take on the correct solution to problem.
Using eslint --init, if chosen that typescript is in use, those rules should be added automatically.

Are you willing to submit a pull request to implement this change?
No

@davc0n davc0n added core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon labels Apr 28, 2020
@kaicataldo
Copy link
Member

I don't think we should get in the business of picking specific rules to enable in --init, but I do think it could make sense to enable plugin:@typescript-eslint/recommended (we do the same for the React plugin).

@kaicataldo kaicataldo added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Apr 28, 2020
@anikethsaha
Copy link
Member

plugin:@typescript-eslint/recommended will be added if eslint:recommended is added.

implemented-here

adding of eslint:recommended depends on purpose name from the interactive cli.
@davc0n can you share your answer which you shared.

@kaicataldo maybe we should add the typescript-eslint/recommended added irrespective of eslint:recommended. WDYT ?

@kaicataldo
Copy link
Member

It's a bit confusing, but we add plugin:@typescript-eslint/eslint-recommended, not plugin:@typescript-eslint/recommended. The former is designed to be used with eslint:recommended, and adjusts the config for a TypeScript codebase. You can see more details here.

What I suggested above is doing the following:

{
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended"
  ]
}

@anikethsaha
Copy link
Member

I didnt know there are two recommended configs from typescript-eslint 😄

{
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended"
  ]
}

yes, this is much better. 👍

@davc0n
Copy link
Author

davc0n commented Apr 28, 2020

In the init process I did specify that typescript is in use, so those extends are present in config:

    "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/eslint-recommended"
    ],

"plugin:@typescript-eslint/recommended" includes the following rules ? [EDIT: seems so]

        "no-unused-vars": "off",
        "@typescript-eslint/no-unused-vars": [
            "error"
        ]

If so, adding the additional extend when typescript is chosen should be fine. Otherwise, I would simply include those rules, without an explicit question (actually some rules might be asked, but I think this one is not needed since typescript related).

@aladdin-add aladdin-add added accepted There is consensus among the team that this change meets the criteria for inclusion cli Relates to ESLint's command-line interface and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels May 5, 2020
@kaicataldo
Copy link
Member

@aladdin-add Can you explain why this is marked as accepted?

@aladdin-add
Copy link
Member

it is as you suggested in #13233 (comment) ?

or we need 3+ 👍 from the team?

@aladdin-add aladdin-add added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed accepted There is consensus among the team that this change meets the criteria for inclusion labels May 5, 2020
@kaicataldo
Copy link
Member

Yeah, I don't think we should bypass our standard approval process. I'd like for other members of the team to have the chance to give their input.

@kaicataldo kaicataldo self-assigned this May 5, 2020
@kaicataldo
Copy link
Member

I'm championing this, but for the sake of making it easier to understand where we stand, can supporting team members please put 👍s on the corresponding PR rather than this issue?

@aladdin-add aladdin-add added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels May 7, 2020
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Nov 11, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Nov 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion cli Relates to ESLint's command-line interface core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants