question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

camelcase ignoreDestructuring doesn't work for objects inside objects

See original GitHub issue

Tell 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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
platinumazurecommented, Jan 6, 2019

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?

1reaction
platinumazurecommented, Jan 1, 2019

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 the ignoreDestructuring 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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found