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.

Bug: (Camlecase rule: problems with detecting missing camelcase)

See original GitHub issue

Environment

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?

@babel/eslint-parser

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

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Oct 21, 2021

I think the intent was to allow function calls like test_var(), but the implementation mistakenly allows arguments like foo(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.

0reactions
nzakascommented, Oct 22, 2021

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.

Read more comments on GitHub >

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

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