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.

Generic Exceptions to the camelcase rule?

See original GitHub issue

What rule do you want to change? camelcase

Does this change cause the rule to produce more or fewer warnings? fewer

How will the change be implemented? (New option, new default behavior, etc.)? new option in the camelcase rule

Please provide some example code that this change will affect:

var vwoDefined = typeof window._vwo_code !== 'undefined';
var git_version_file = pathUtils.resolvePath('./GIT_VERSION');

What does the rule currently do for this code? throws warning warning Identifier '_vwo_code' is not in camel case

What will the rule do after it’s changed? not throw a warning provided the exception in question is added in the configuration/option

Previous version of the issue:

Is there a way to add generic exceptions to the camelcase rule, like provide a list of items, a regex rule etc?(except adding a comment to disable the rule)

For example if there’s a global / window variable from a script we have no control over (GA, AB testing tools such as VWO etc)

My suggestion:

"camelcase":[  
   1,
   ['variable_here', 'other_variable']
]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
smablycommented, Jun 22, 2018

Is there value in reopening this issue now that React 16.4 has added UNSAFE_-prefixed lifecycle methods (e.g., https://reactjs.org/docs/react-component.html#unsafe_componentwillmount)? A lot of React developers will be disabling this rule as the old lifecycle methods are deprecated.

1reaction
platinumazurecommented, Jun 22, 2018

@smably You’re welcome to open a new issue with this new context about React, and we’ll gladly take another look. Thanks! (Feel free to link back to this issue for context, if you think it worthwhile.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

camelcase - ESLint - Pluggable JavaScript Linter
This rule looks for any underscores ( _ ) located within the source code. It ignores leading and trailing underscores and only checks...
Read more >
Naming Convention Guidelines
The exceptions to the camel case rule are username and streamid. The variable ID is not allowed, because it is used internally by...
Read more >
General Rules: Identifiers, Keywords, Indentation
Camel Casing​​ Following this rule, a symbol referring to “my name” is written as MyName. Header Translations Exceptions. The major exception to this...
Read more >
Handle exceptions in a function that converts a camelCase ...
A more generic approach will be to match cases when there is a lowercase letter followed with an uppercase one ( ([a-z])([A-Z]) )...
Read more >
naming-convention | typescript-eslint
the default config is similar to ESLint's camelcase rule but more strict ... typeParameter - matches any generic type parameter declaration.
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