-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
jsx-no-duplicate-props: TypeError: name.toLowerCase is not a function #969
Comments
That's invalid jsx syntax - I don't think it's a reasonable expectation that rules should work when your syntax is invalid. In other words, even if you disabled that rule, eslint itself should be dying on the syntax. |
Right, but it should not throw, i.e. it should just somehow ignore the input if the rule does not apply. |
That's a fair point; that the rule should be silent when there's a parse error. Although, that seems like something eslint itself should be handling perhaps? |
Maybe. Anyway, the faulty code assumes there is a |
I use eslint-plugin-react@7.0.1 Same problem here.
This is output
|
jsx-no-duplicate-props is causing error. TypeError: name.toLowerCase is not a function. When <Element {...props}> is used.
@marcelmokos, seems like your change would fix the issue. You may just need to add few test cases. Why don't you create a PR for this repo? **I will be happy to help if you have any questions 😃 |
Here is another test case to repro the error: const invalidJSX = () => {
return (
<svg >
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#myIcon"></use>
</svg>
);
}; I understand that this is invalid jsx. But the error it throws makes no sense ( |
Please see my comment to the commit marcelmokos@6918bba |
@sompylasar, could you please provide complete test case for the behaviour you are describing? |
@DianaSuvorova It's not about the test case (it's the same), it's about the proposed solution. Please see this comment: marcelmokos@6918bba#commitcomment-23208488 |
@sompylasar , let's continue this discussion there |
…sx-eslint#969 - recommended improvement - add test
jsx-no-duplicate-props is causing error. TypeError: name.toLowerCase is not a function. When <Element {...props}> is used.
…sx-eslint#969 - recommended improvement - add test
jsx-no-duplicate-props is causing error. TypeError: name.toLowerCase is not a function. When <Element {...props}> is used.
…sx-eslint#969 - recommended improvement - add test
…-type-error issue #969 typeError: name.toLowerCase is not a function…
Closed in #1319. |
#969 fix: exception for jsx-no-duplicate-props
I use
eslint-plugin-react@6.3.0
The latest
master
as of today contains the same code that fails: https://github.com/yannickcr/eslint-plugin-react/blob/21f684a738af7a6f2b1ec9517b5040162a750789/lib/rules/jsx-no-duplicate-props.js#L48The issue happens when I (accidentally) put a colon after a prop name, for example:
The text was updated successfully, but these errors were encountered: