Skip to content

Commit

Permalink
Fix: camelcase duplicate warning bug (fixes #10801) (#10802)
Browse files Browse the repository at this point in the history
  • Loading branch information
helixbass authored and kaicataldo committed Sep 1, 2018
1 parent 5103ee7 commit 6e110e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/camelcase.js
Expand Up @@ -145,7 +145,7 @@ module.exports = {
const assignmentKeyEqualsValue = node.parent.key.name === node.parent.value.name;

// prevent checking righthand side of destructured object
if (!assignmentKeyEqualsValue && node.parent.key === node) {
if (node.parent.key === node && node.parent.value !== node) {
return;
}

Expand Down
11 changes: 11 additions & 0 deletions tests/lib/rules/camelcase.js
Expand Up @@ -352,6 +352,17 @@ ruleTester.run("camelcase", rule, {
}
]
},
{
code: "var { category_id: category_id } = query;",
parserOptions: { ecmaVersion: 6 },
errors: [
{
messageId: "notCamelCase",
data: { name: "category_id" },
type: "Identifier"
}
]
},
{
code: "var { category_id = 1 } = query;",
parserOptions: { ecmaVersion: 6 },
Expand Down

0 comments on commit 6e110e6

Please sign in to comment.