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

Check statically known computed names in no-dupe-class-members #12808

Closed
mdjermanovic opened this issue Jan 19, 2020 · 2 comments · Fixed by #12837
Closed

Check statically known computed names in no-dupe-class-members #12808

mdjermanovic opened this issue Jan 19, 2020 · 2 comments · Fixed by #12837
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 breaking This change is backwards-incompatible rule Relates to ESLint's core rules
Projects

Comments

@mdjermanovic
Copy link
Member

What rule do you want to change?

no-dupe-class-members

Does this change cause the rule to produce more or fewer warnings?

more

How will the change be implemented? (New option, new default behavior, etc.)?

new default behavior

Maybe as a breaking change in v7.0.0?

Please provide some example code that this change will affect:

class A {
  ["a"](){}
  ["a"](){}
  
  [`b`](){}
  b(){}
}

What does the rule currently do for this code?

no errors

What will the rule do after it's changed?

2 errors, for names "a" and "b".

The proposal is to check all class members for which astUtils.getStaticPropertyName returns a string value and thus align this rule to the similar no-dupe-keys rule:

/*eslint no-dupe-keys: "error"*/
/*eslint no-dupe-class-members: "error"*/

var obj =  {  
  ["a"](){},
  ["a"](){}, // error
  
  [`b`](){},
  b(){} // error
}

class A {
  ["a"](){}
  ["a"](){} // should be error
  
  [`b`](){}
  b(){} // should be error
}

Demo Link

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

Yes.

@mdjermanovic mdjermanovic added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jan 19, 2020
@mdjermanovic mdjermanovic self-assigned this Jan 19, 2020
@kaicataldo
Copy link
Member

Agreed. I think this should be treated as a breaking bug fix, since we're currently release v7.

@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion breaking This change is backwards-incompatible and removed enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jan 27, 2020
@kaicataldo kaicataldo added this to Implemented, pending review in v7.0.0 Jan 27, 2020
@mdjermanovic
Copy link
Member Author

I'm working on this.

@mysticatea mysticatea moved this from Implemented, pending review to Issues which have PR in v7.0.0 Feb 13, 2020
v7.0.0 automation moved this from Issues which have PR to Done Feb 14, 2020
btmills pushed a commit that referenced this issue Feb 14, 2020
…) (#12837)

* Breaking: no-dupe-class-members checks some computed keys (fixes #12808)

* Fix constructor, add more tests
montmanu pushed a commit to montmanu/eslint that referenced this issue Mar 4, 2020
…nt#12808) (eslint#12837)

* Breaking: no-dupe-class-members checks some computed keys (fixes eslint#12808)

* Fix constructor, add more tests
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Aug 14, 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 Aug 14, 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 breaking This change is backwards-incompatible rule Relates to ESLint's core rules
Projects
No open projects
v7.0.0
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants