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

camelcase check for properties seems broken #9715

Closed
Means88 opened this issue Dec 12, 2017 · 2 comments
Closed

camelcase check for properties seems broken #9715

Means88 opened this issue Dec 12, 2017 · 2 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion works as intended The behavior described in this issue is working correctly

Comments

@Means88
Copy link

Means88 commented Dec 12, 2017

Tell us about your environment

  • ESLint Version: 4.13.1
  • Node Version: 6.9.1
  • npm Version: 3.10.8

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

Configuration Written in command line directly as below.
const foo = { a_b: '' };
const { a_b } = foo;
node_modules/.bin/eslint --rule 'camelcase: [2, { "properties": "never" }]' --parser-options=ecmaVersion:6 1.js

What did you expect to happen?
exit with 0

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

2:9  error  Identifier 'a_b' is not in camel case  camelcase

screenshots

image

It will not throw an error before @4.13

image

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Dec 12, 2017
@platinumazure platinumazure added works as intended The behavior described in this issue is working correctly and removed triage An ESLint team member will look at this issue soon labels Dec 13, 2017
@platinumazure
Copy link
Member

This is working as intended (as of the bugfix for issue #9468).

This line:

const { a_b } = foo;

Is equivalent to this line:

const a_b = foo.a_b;

The right-hand side should not be reported with properties: never, but the left-hand side should be (because you're declaring a new variable, not an object property).

You can still get at properties in an object through destructuring-- they just need to be reassigned to a camelcase variable:

const { a_b: aB } = foo;

@Means88
Copy link
Author

Means88 commented Dec 13, 2017

@platinumazure 👍 Yes, I think you are right.

@Means88 Means88 closed this as completed Dec 13, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jun 12, 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 Jun 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion works as intended The behavior described in this issue is working correctly
Projects
None yet
Development

No branches or pull requests

2 participants