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 option to allow snake_case in object literals

See original GitHub issue

There are situations where third-party code or services are configured by calling a function with an object literal. Those objects are flagged the camelCase rule:

var snakes = require('somesnakelib');  // not my code
snakes({snake_prop: true});  // ESLint: "Identifier 'snake_prop' is not in camel case."

JSCS dealt with this by adding an ignoreProperties option to their CamelCase rule. I like enforcing names and would rather not disable the CamelCase rule to use code that I don’t control without errors.

This was touched on in #656, #672, #674 and #1550, but object literals are still being flagged.

<bountysource-plugin>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
OmgImAlexiscommented, May 29, 2017

@nzakas any reason a commit was merged but without the “nonmethods” option?

2reactions
OmgImAlexiscommented, Aug 7, 2016

@nzakas any updates on this?

I have the code below yet I’m still getting an error.

var client = tumblr.createClient({
    'consumer_key': config.get('tumblr:token'),
    'consumer_secret': config.get('tumblr:tokenSecret'),
    'token': tokenSet.token,
    'token_secret': tokenSet.tokenSecret
});

I’m using @sindresorhus’s xo linter.

    "xo": {
        "space": 4,
        "rules": {
            "space-before-function-paren": 0,
            "camelcase": [
                2, {
                    "properties": "nonmethods"
                }
            ]
        }
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the standard naming convention of properties in a ...
What is the standard convention naming for property inside object? camelCase. or. snake_case?
Read more >
Transform Mapped Types from Snake_ to CamelCase in ...
Let's look a little deeper at the solution. We have created a new helper type called SnakeToCamelCase to re-map keys of a property...
Read more >
Converting Snake Case to Camel Case Object Keys with ...
Our first stop is simply converting a string to camel case. This actually will accept either snake or kebab case strings and convert...
Read more >
naming-convention | typescript-eslint
This option allows you to have a bit more finer-grained control over identifiers, letting you ban (or force) certain patterns and substrings. Accepts...
Read more >
Functions to Convert objects with snake_case keys to ... - Reddit
Functions to Convert objects with snake_case keys to camelCase ones. With the new string literal types has anyone done this yet as I ......
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