Bug: (Camlecase rule: problems with detecting missing camelcase)
See original GitHub issueEnvironment
Node version: 14.15.1 npm version: 6.14.9 Local ESLint version: 7.32.0 Global ESLint version: Not Found Operating System: win32 10.0.19042
What parser are you using?
What did you do?
Configuration
{
"env": {
"browser": true,
"es2021": true
},
"parserOptions": {
"parser": "babel-eslint",
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
"camelcase": ["error",{"properties": "never"}],
}
}
methods: {
bugLinter(){
let test_var = 'Hello';
let test = test_var;
console.info(test_var);
console.error(test_var);
console.log(this.transform(test_var));
},
transform(msg){
return `${msg} World`;
}
}
What did you expect to happen?
That all five camelcase violations are shown when we run es lint.
What actually happened?
Es-lint only reported two out of five violations. It looks like es-lint is ignoring the vars in the brackets of the console.logs or in general method calls.
Participation
- I am willing to submit a pull request for this issue.
Additional comments
The given code is part of a vue component, just in case.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Configuration for rule "camelcase" is invalid: should not have ...
Hello, the linter-eslint -package for Atom (ubuntu) fails with validating the "camelcase" -rule. Downgraded to "eslint-config-airbnb": ...
Read more >Disable check of camel case rule in eslint - Stack Overflow
I am trying to disable them and address them one at a time. The code below shows that I can disable them all...
Read more >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 >To CamelCase or Under score
ing are able to recognize identifiers in the camel case style faster than identifiers in the underscore style. 1 Introduction. Over the past...
Read more >What is the difference between Pascal Case and Camel Case ...
With camelCase, the first letter of the first word in the identifier is lower case, while the first letter of every subsequent word...
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 the intent was to allow function calls like
test_var()
, but the implementation mistakenly allows arguments likefoo(test_var)
as well, so this is most likely a bug.That said, I’m not sure if we should change this behavior now. It doesn’t seem important to report these references, because the declaration is already reported so the rule enforces the use of camelcase style for this variable anyways.
Yeah, it doesn’t make sense to report read references, as that’s just noise. In VS Code you can press F2 and rename all references, and I’m sure other IDEs have similar functionality.
Closing as this is the intended behavior.