camelcase ignoreDestructuring doesn't work for objects inside objects
See original GitHub issueTell us about your environment
- ESLint Version: 5.11.1
- Node Version: 8.11.4
- npm Version: 6.4.1
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
{
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"camelcase": [
"error",
{
"ignoreDestructuring": true
}
],
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"never"
]
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
const obj = {
property: {
nested_property: "what"
}
}
const { property: { nested_property } } = obj
eslint .
What did you expect to happen?
nested_property
to be ignored
What actually happened? Please include the actual, raw output from ESLint.
3:9 error Identifier 'nested_property' is not in camel case camelcase
Are you willing to submit a pull request to fix this bug? Sure
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
camelcase - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Disable check of camel case rule in eslint - Stack Overflow
Just get the same camelcase error without any change. The eslint documentation says just disable the entire rule but does not specify a...
Read more >camelCase in front, snake_case in the back : r/javascript - Reddit
At work, we use JavaScript for the frontend web dev (obviously), ... So when I get some data from the back, things are...
Read more >keywords:underscore - npm search
Underscore-to-camelCase converter (and vice versa) for strings and object keys in JavaScript. utils · camel · case · underscore · converter · strings ......
Read more >Convert each field in JSON Object from Camel Case - Apigee
I have a very complex JSON object with array of objects. I want to convert all Field names from camel case to pascal...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I agree that this is a duplicate of #11226. Please feel free to send in a PR.
In the meanwhile, may I close this as a duplicate?
Hi @brizental, thanks for the issue.
Looking at the error message, it seems that line 3 is being reported. In your example, line 3 is an object property assignment, not a destructure.
If you want the rule to ignore property assignments that are not in camelcase, you should use the
properties: "never"
option, in addition to theignoreDestructuring
option you are already using in your configuration (and which successfully prevented a lint message from appearing on line 6).With that said, I believe the rule is working as intended with your current configuration and example. Please reply if you feel I have missed something. Thanks!