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

[react/no-unknown-property] support svg properties with React v15 #490

Closed
ilyagelman opened this issue Mar 8, 2016 · 8 comments
Closed

Comments

@ilyagelman
Copy link

The latest React version adds support for native svg property names.

Before:

<svg fontSize="24">

After:

<svg font-size="24">

Currently eslint trows:

error  Unknown property 'font-size' found, use 'fontSize' instead      react/no-unknown-property
@ljharb
Copy link
Member

ljharb commented Mar 8, 2016

@ilyagelman do you mean v15? That's not the latest yet, since it isn't actually released yet.

If this support is added, please do it via option, so those on the latest version of React don't have to enable it.

@yannickcr
Copy link
Member

In React 0.14 font-size is an error but it is correct in React 0.15
The question is: How to handle that ?

Right now I have 2 ideas:

  • Remove SVG warnings, but 0.14 users could miss some errors
  • Let the user configure the React version used in the project (maybe in plugin settings so it can be reused in other rules if needed, like in no-deprecated).

I don't really like cross rules settings like this but maybe in this case it is justified ?

@ljharb
Copy link
Member

ljharb commented Mar 9, 2016

I think the best choice is to let the user configure their React version - that way eslint-plugin-react can support as many React versions as it wants.

Similarly, when the React version is 0.13, then any rules regarding stateless functional components can be skipped.

@romainneutron
Copy link

Another change in React 15 about SVG is the class property.
Using className property on SVG elements in React 15 triggers a deprecated warning.

Before:

<svg className="svg-class">
    <g className="my-class">
        <p className="another-class" />
    </g>
</svg>

In React 15:

<svg class="svg-class">
    <g class="my-class">
        <p class="another-class" />
    </g>
</svg>

@romainneutron
Copy link

Any news since react 15 has been released?

@yannickcr
Copy link
Member

Working on it. It should be ready early next week.

@romainneutron
Copy link

THANKS !

@kostasmanionis
Copy link

Ummm guys... Hasn't this change been reverted? facebook/react#6243

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

No branches or pull requests

5 participants