Skip to content
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

Does jsx-pascal-case break <script crossorigin src="..."></script>? #1642

Closed
corysimmons opened this issue Jan 12, 2018 · 7 comments
Closed
Assignees
Labels

Comments

@corysimmons
Copy link

Using prettier-eslint with react/recommended.
Trying to set script tags within JSX.
React recommends adding crossorigin attribute.
Prettier keeps pascal-casing the attribute to crossOrigin.

Possible bug?

@ljharb
Copy link
Member

ljharb commented Jan 12, 2018

If so, that'd be a bug with prettier, not this plugin. Does it happen when you use eslint by itself?

@ljharb
Copy link
Member

ljharb commented Jan 12, 2018

(jsx-pascal-case applies to component names, not to attribute names)

@ljharb
Copy link
Member

ljharb commented Jan 12, 2018

It might be the no-unknown-property rule, which explicitly has crossOrigin in it: https://github.com/yannickcr/eslint-plugin-react/blob/master/lib/rules/no-unknown-property.js#L115

@corysimmons
Copy link
Author

corysimmons commented Jan 13, 2018

@ljharb Thanks for investigating this so quickly! Yeah, it definitely "felt" hard-coded so I think that's the right thing.

I think this should be upgraded to a bug and discussed/fixed. It definitely conflicts with React as React is expecting lowercase crossorigin (and explicitly throws an error when it encounters crossOrigin). https://reactjs.org/docs/cross-origin-errors.html

ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Jan 13, 2018
@ljharb ljharb self-assigned this Jan 13, 2018
@ljharb ljharb added the bug label Jan 13, 2018
ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Jan 13, 2018
ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Jan 16, 2018
@corysimmons
Copy link
Author

@ljharb Thank you! =)

@jzDev
Copy link
Contributor

jzDev commented Jan 26, 2018

It seems there was a confusion on the attribute name convention for crossorigin.
The correct naming convention is documented in the React DOM Elements documentation.

The previous reference was not a JSX implementation.

I created a PR to fix this issue. #1659

@corysimmons
Copy link
Author

@jzDev Interesting. I think crossorigin was working as expected and the pascal casing was breaking it, which is why I opened the issue in the first place, but maybe I have a donkey brain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants