-
-
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
false negative with namespacing/qualifications using jsx-pascal-case #1334
Comments
… using jsx-pascal case jsx-eslint#1336 - false postive with names starting with a number using jsx-pascal [Can besaid it is fixed, but inside it is not accepted anyway. Seems just fixed the regex]
The docs for that rule don't mention either member expressions (your example) or namespaces, so it's probably an omission. Both should be accounted for - I believe the spirit of the rule is that |
And |
I’d call it a bugfix, not a breaking change. |
… using jsx-pascal case jsx-eslint#1336 - false postive with names starting with a number using jsx-pascal [Can besaid it is fixed, but inside it is not accepted anyway. Seems just fixed the regex]
I am looking to fix this. I think there is a legitimate bug in the jsx-pascal-case rule but before going further I'd need to clarify what the behaviour should be. I tried to look at a spec for how namespaces should be handled but didn't find any authoritative source. @ljharb Could you tell me what should be allowed / not allowed from this list when the rule is enabled?
The bug by the way has to do with the fact that when there is |
@yacinehmito i would expect 2, 4, 6, and 8 to be allowed; and the others not to be. |
I also wonder about:
There is some code that suggests that components in all lowercase should always be accepted as they can be plain HTML, but I don't know where the limit lies. |
No, lowercase components can never be namespaced; i'm pretty sure neither of those are valid. |
Ok. I will update the test cases in #2637 to reflect this then. Would you humour me though and provide me a source that shows that `svg:circle for example is impossible in React? |
https://itnext.io/using-react-for-xml-svg-470792625278 talks about it - it's not that it's impossible in react, it's that it's impossible in jsx. https://reactjs.org/docs/jsx-in-depth.html is useful as well. They kind of imply that |
Thank you very much for the links. Should we then error out in the |
We should warn on anything React won't accept. |
Yes, but should we warn it with a rule that's called This is when I just type it: If I have both the rule Then, if I add a dummy identifier for Now it's TypeScript that doesn't like it. Again, if I have a syntax error and an error from I think this should be addressed with a new rule, that could for example be called |
As this typescript issue indicates,
My humble opinion is namespacing with |
Thank you very much. The TypeScript issue is indeed very helpful to understand the problem. This make me confident that we should introduce
I'll submit a PR shortly. |
PR to add |
The linter has ways to detect the version of React that is used. This can inform on whether the rule should be enabled by default or not. |
Using v7.1.0,
flag an error (e.g Contained JSX component MyComponent must be in PascalCase (react/jsx-pascal-case))
The text was updated successfully, but these errors were encountered: