Skip to content

Commit

Permalink
jsx-no-duplicate-props: TypeError: name.toLowerCase is not a function j…
Browse files Browse the repository at this point in the history
…sx-eslint#969

- recommended improvement
- add test
  • Loading branch information
marcelmokos committed Jul 21, 2017
1 parent dd20a7a commit 6112149
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/rules/jsx-no-duplicate-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ module.exports = {

let name = decl.name.name;

if (ignoreCase && typeof name === 'string') {
if (typeof name !== 'string') {
return;
}

if (ignoreCase) {
name = name.toLowerCase();
}

Expand Down
3 changes: 2 additions & 1 deletion tests/lib/rules/jsx-no-duplicate-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ ruleTester.run('jsx-no-duplicate-props', rule, {
{code: '<App c="a" {...this.props} a="c" b="b" />;'},
{code: '<App A a />;'},
{code: '<App A b a />;'},
{code: '<App A="a" b="b" B="B" />;'}
{code: '<App A="a" b="b" B="B" />;'},
{code: '<App a:b="c" />;', options: ignoreCaseArgs}
],
invalid: [
{code: '<App a a />;', errors: [expectedError]},
Expand Down

1 comment on commit 6112149

@DianaSuvorova
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @marcelmokos, your code looks good. But your branch is way behind. You need to pull upstream and merge upstream/master into your branch. Lmk if you need help.

-Diana

Please sign in to comment.