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 lint error on module import when deconstructing #6755

Closed
lordgiotto opened this issue Jul 25, 2016 · 4 comments
Closed

camelcase lint error on module import when deconstructing #6755

lordgiotto opened this issue Jul 25, 2016 · 4 comments
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

@lordgiotto
Copy link
Contributor

lordgiotto commented Jul 25, 2016

ESLint version:

3.1.1


Rule:

"camelcase": [2, { "properties": "never" }]


Problem

Lint fails on module import when deconstructing properties and aliasing.

// this cause lint error
import { no_camel_case_prop as CamelCaseProp } from 'external-module';

But with 186e8f0 that rule should ignore camelcase during deconstructing.

(I know that import deconstructing is not a real object deconstructing, but probably it should follow the same rule)

For now I have to workaround this issue this way:

// this not cause lint error
import * as externalModule from 'external-module';
externalModule.no_camel_case_prop

Thank you :)

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jul 25, 2016
@vitorbal vitorbal 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 and removed triage An ESLint team member will look at this issue soon labels Jul 25, 2016
@vitorbal
Copy link
Member

Hi @lordgiotto, thanks for reaching out!

Just verified that this is true. Even without the properties option set to never, I would expect the example code to not cause a lint error, for the same reasons outlined in #3185 for object destructuring.

So, to recap:

Valid:

/* eslint camelcase: 2*/
import { no_camel_case_prop as CamelCaseProp } from 'external-module';

Invalid:

/* eslint camelcase: 2*/
import { no_camel_case_prop } from 'external-module';

Invalid:

/* eslint camelcase: 2*/
import { no_camel_case_prop as no_camel_case_prop } from 'external-module';

@lordgiotto Would this be something you are willing to send a PR for?

@michaelficarra
Copy link
Member

@lordgiotto The workaround you listed is wrong. It would be

import * as externalModule from 'external-module';
externalModule.no_camel_case_prop;

@vitorbal vitorbal 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 Jul 25, 2016
@lordgiotto
Copy link
Contributor Author

@michaelficarra Oh, sorry, you're right! I fix it now.

@vitorbal It would be a pleasure, but to be honest I never read ESLint source code and I should at least study how it's designed before be able to send a PR. So I could do it, but i would need some time :P

lordgiotto added a commit to lordgiotto/eslint that referenced this issue Jul 28, 2016
Calmecase rule now doesn't report an error if camelcased identifier
is imported with a camecased alias. Otherwhise it reports an error
as expected.
@lordgiotto
Copy link
Contributor Author

@vitorbal PR done :)

lordgiotto added a commit to lordgiotto/eslint that referenced this issue Jul 28, 2016
Calmecase rule now doesn't report an error if camelcased identifier
is imported with a camecased alias. Otherwhise it reports an error
as expected.
lordgiotto added a commit to lordgiotto/eslint that referenced this issue Jul 29, 2016
Calmecase rule now doesn't report an error if camelcased identifier
is imported with a camecased alias. Otherwhise it reports an error
as expected.
lordgiotto added a commit to lordgiotto/eslint that referenced this issue Jul 29, 2016
Calmecase rule now doesn't report an error if camelcased identifier
is imported with a camecased alias. Otherwhise it reports an error
as expected.
lordgiotto added a commit to lordgiotto/eslint that referenced this issue Jul 30, 2016
Calmecase rule now doesn't report an error if camelcased identifier
is imported with a camecased alias. Otherwhise it reports an error
as expected.
lordgiotto added a commit to lordgiotto/eslint that referenced this issue Aug 1, 2016
Calmecase rule now doesn't report an error if camelcased identifier
is imported with a camecased alias. Otherwhise it reports an error
as expected.
lordgiotto added a commit to lordgiotto/eslint that referenced this issue Aug 1, 2016
Calmecase rule now doesn't report an error if camelcased identifier
is imported with a camecased alias. Otherwhise it reports an error
as expected.
gyandeeps pushed a commit that referenced this issue Aug 1, 2016
Calmecase rule now doesn't report an error if camelcased identifier
is imported with a camecased alias. Otherwhise it reports an error
as expected.
@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

No branches or pull requests

4 participants