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

Enhancement: [no-unused-constructor-member] Should report unused members in constructor #6053

Closed
4 tasks done
muuvmuuv opened this issue Nov 21, 2022 · 4 comments
Closed
4 tasks done
Labels
duplicate This issue or pull request already exists

Comments

@muuvmuuv
Copy link

Before You File a Proposal Please Confirm You Have Done The Following...

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Link to the rule's documentation

There is none yet?

Description

Should report a warning when a private member in a constructor is unused.

Fail

class Test {
  constructor(private foo: Foo) {}
}

Pass

class Test {
  constructor(private foo: Foo) {}

  test() {
    return this.foo;
  }
}

Additional Info

Maybe as well for non-private, not declared as public.

@muuvmuuv muuvmuuv added enhancement: plugin rule option New rule option for an existing eslint-plugin rule package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Nov 21, 2022
@JoshuaKGoldberg
Copy link
Member

Thanks for posting! This is a duplicate of #4571. Before filing an issue, please use our issue search to check for open and closed issues that already address what you're looking for.

@JoshuaKGoldberg JoshuaKGoldberg added duplicate This issue or pull request already exists and removed package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look enhancement: plugin rule option New rule option for an existing eslint-plugin rule labels Nov 21, 2022
@muuvmuuv
Copy link
Author

Oh ok, I thought this issue is just for private class members, my proposal is for constructor members/definitions.

@JoshuaKGoldberg
Copy link
Member

Ah I can see why you'd suggest a new issue. Constructor parameter properties with the private modifier are private class members though.

@muuvmuuv
Copy link
Author

Ohh, sorry, didn't know, thought those are handled different. 👍🏻 hope both are addressed the same in that issue, really think this would lets us find a lot of unused props in our codebase.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2022
@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants