Skip to content

[eslint-plugin-emotion] the syntax-preference rule does not check css props #1253

@Nouzbe

Description

@Nouzbe
  • emotion version: 10.0.7
  • react version: 16.6.0

Relevant code:

// eslintrc.js
rules: {
  ...
  'emotion/syntax-preference': ['error', 'string'],
  ...
}

// MyComponent.js
// Despite using the object syntax, the following line doesn't raise an ESLint error
const MyComponent = () => <div css={{background: 'red'}} />;

Problem description:

The syntax-preference ESLint rule currently works for styled but not with the CSS prop.

Suggested solution:

It would be nice if this rule could also enforce a syntax choice for projects using CSS props.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions