Skip to content

Allow exceptions for style-prop-object #1813

@remcohaszing

Description

@remcohaszing

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"]}
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions