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

no-dupe-keys: false negative between a normal property and a getter. #6801

Closed
mysticatea opened this issue Jul 30, 2016 · 4 comments · Fixed by #6863
Closed

no-dupe-keys: false negative between a normal property and a getter. #6801

mysticatea opened this issue Jul 30, 2016 · 4 comments · Fixed by #6863
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 bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@mysticatea
Copy link
Member

What version of ESLint are you using?

  • 3.2.0

What parser (default, Babel-ESLint, etc.) are you using?

  • default

Please show your full configuration:

  • nothing

What did you do? Please include the actual source code causing the issue.

$ echo "var obj = {a:1, get a() { return 1 }}" | eslint --stdin --rule no-dupe-keys:2 --env es6 --no-eslintrc

What did you expect to happen?

  • Duplicate key 'a'. (no-dupe-keys)

What actually happened? Please include the actual, raw output from ESLint.

  • No errors.
@mysticatea mysticatea added bug ESLint is working incorrectly rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 30, 2016
@mysticatea mysticatea self-assigned this Jul 30, 2016
@mysticatea mysticatea changed the title no-dupe-keys: false positive between a normal property and a getter. no-dupe-keys: false negative between a normal property and a getter. Jul 30, 2016
@btmills
Copy link
Member

btmills commented Aug 1, 2016

This is interesting:

$ git log --oneline -n 1
5d063f2 Docs: Add plugin example to disabling with comments guide (fixes #6742)

$ rm -rf node_modules && npm install
# ...

$ echo "var obj = {a:1, get a() { return 1 }}" | bin/eslint.js --stdin --rule no-dupe-keys:2 --env es6 --no-eslintrc

But if I remove --env es6:

$ echo "var obj = {a:1, get a() { return 1 }}" | bin/eslint.js --stdin --rule no-dupe-keys:2 --no-eslintrc

<text>
  1:21  error  Parsing error: Redefinition of property

✖ 1 problem (1 error, 0 warnings)

@platinumazure
Copy link
Member

@btmills --env es6 both enables an environment and changes a parserOptions property (ecmaVersion: 6). Can you please use --parserOptions ecmaVersion:6 in your tests to help isolate env vs parserOptions?

@btmills
Copy link
Member

btmills commented Aug 1, 2016

Good call, @platinumazure. I get no errors:

$ echo "var obj = {a:1, get a() { return 1 }}" | bin/eslint.js --stdin --rule no-dupe-keys:2 --parser-options ecmaVersion:6 --no-eslintrc

@mysticatea
Copy link
Member Author

mysticatea commented Aug 2, 2016

Yes. Duplicate properties were a kind of syntax errors until ES5. But ES6 relaxed this restriction due to computed properties.

@mysticatea mysticatea 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 Aug 8, 2016
mysticatea added a commit that referenced this issue Aug 8, 2016
This commit fixes a false negative between a normal property and a
getter/setter.
In addition, I upgrade code by ES2015.
nzakas pushed a commit that referenced this issue Aug 10, 2016
This commit fixes a false negative between a normal property and a
getter/setter.
In addition, I upgrade code by ES2015.
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@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 Feb 6, 2018
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 bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants