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 23, 2017
1 parent e785a7d commit 640d7a3
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

0 comments on commit 640d7a3

Please sign in to comment.