camelcase ignoreDestructuring fails when using destructured variables
See original GitHub issueTell us about your environment
- ESLint Version: 6.0.1
- Node Version: 10.16.0
- npm Version: 6.9.0
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
/* eslint camelcase: [error, { ignoreDestructuring: true, properties: "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.
/* eslint camelcase: [error, { ignoreDestructuring: true, properties: "never" }] */
const { a_parameter } = query
/* These should pass */
const myVar = a_parameter
console.log(`parameter is ${a_parameter}`)
(() => a_parameter)()
/* These pass */
console.log(a_parameter)
new MyClass(a_parameter)
const myObj = { a_property: "123" }
The issue is reproducible on ESLint demo:
What did you expect to happen? No negatives for the statements that use the variables created from object destructuring.
What actually happened? Please include the actual, raw output from ESLint. No negatives when using variables as parameter to functions, but negatives when using it on string templates, variable attribution or as return value.
Are you willing to submit a pull request to fix this bug? No
This looks like a related issue: #2254
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
camelcase - ESLint - Pluggable JavaScript Linter
This rule focuses on using the camelcase approach. ... camelcase style for destructured identifiers; "ignoreDestructuring": true does not check destructured ...
Read more >React - Eslint - Camel camel case props - Stack Overflow
You can assign different variable names when destructuring: const { id, email, first_name: fistName, last_name: lastName, name } = response.
Read more >Id-match - ESLint - W3cubDocs
This rule allows you to precisely define and enforce the variables and function names on your team should use. No more limiting yourself...
Read more >Prevent Error with Default {} when Destructuring
Why does it throw an Error? This is because you can't destructure undefined and null values. const { age } ...
Read more >camelCase in front, snake_case in the back : r/javascript - Reddit
By convention, for JS, we use camelCase for variable names and object ... disabling the rule for destructuring via `"ignoreDestructuring": ...
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 Free
Top 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
Reopening this so we can verify if this is a bug or not.
Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.
Thanks for contributing to ESLint and we appreciate your understanding.