Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

camelcase rule doesn't ignore default parameter assignment when disabled #8511

Closed
cdanielsen opened this issue Apr 26, 2017 · 3 comments
Closed
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@cdanielsen
Copy link

Tell us about your environment

ESLint Version: 3.19.0
Node Version: 6.9.4
npm Version: 3.10.10

What parser (default, Babel-ESLint, etc.) are you using? Default

Please show your full configuration:

module.exports = {
    "extends": "standard",
    "plugins": [
        "standard",
        "promise"
    ],
    "parserOptions": {
      "ecmaVersion": 6
    },
    "env": {
      "node": true
    },
    "rules": {
      "semi": ["error", "always"],
      "camelcase": [2, {"properties": "never"}]
    }
};

What did you do? Please include the actual source code causing the issue.

Disabling the camelcase rule does not appear to respect ES6 default parameter assignment when used with object destructuring syntax.

Here's a simple example:

// example.js

function snakeCase ({
  param_1 = 'default value',
  param_2 = 'another default'
} = {}) {
  // do stuff
}

module.exports = snakeCase;

What did you expect to happen?

Eslint should not care that param_1 and param_2 are using snake case instead of camelCase as the rule is disabled

What actually happened? Please include the actual, raw output from ESLint.

error  Identifier 'param_1' is not in camel case                            camelcase
error  Identifier 'param_2' is not in camel case                            camelcase
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Apr 26, 2017
@cdanielsen
Copy link
Author

Not sure if this is a bug or a rule change request; thanks for reviewing

@vitorbal
Copy link
Member

Thanks for the report, @cdanielsen! I can reproduce this. Note that the following works:

function snakeCase ({
  param_1,
  param_2
} = {}) {
  // do stuff
}

I think the default assignment there is what's throwing the rule off.

@vitorbal vitorbal added bug ESLint is working incorrectly evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Apr 27, 2017
@vitorbal
Copy link
Member

I'll work on this.

@vitorbal vitorbal self-assigned this Apr 27, 2017
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jun 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants