Skip to content

Allow exceptions for style-prop-object #1813

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

Closed
remcohaszing opened this issue Jun 8, 2018 · 2 comments · Fixed by #1819
Closed

Allow exceptions for style-prop-object #1813

remcohaszing opened this issue Jun 8, 2018 · 2 comments · Fixed by #1819

Comments

@remcohaszing
Copy link
Contributor

I am using the airbnb style guide, which enables the react/style-prop-object rule. For most use cases this is fine. However, I just started implementing react-intl. This exposes a <FormattedNumber> component which accepts a style prop. This triggers the react/style-prop-object rule.

I think it’s generally a bad practice to create props using such standarized names, but third party libraries might. I suggest adding an option to this rule, which defines an array of component names for which different style prop types are allowed.

For example:

{
  "rules": {
    "react/style-prop-object": [
      "error",
      {"allow": ["FormattedNumber"]}
    ]
  }
}
@ljharb
Copy link
Member

ljharb commented Jun 8, 2018

Seems reasonable, as long as it's only for custom components.

@jseminck
Copy link
Contributor

jseminck commented Jun 9, 2018

I'll take a look at this issue/improvement.

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

Successfully merging a pull request may close this issue.

3 participants