logoESLint React
Rules

no-string-style-prop

Full Name in eslint-plugin-react-dom

react-dom/no-string-style-prop

Full Name in @eslint-react/eslint-plugin

@eslint-react/dom/no-string-style-prop

Presets

  • dom
  • recommended

Description

Disallow the use of string style prop in JSX. Use an object instead.

Examples

Before

import React from "react";

function MyComponent() {
  return <div style="color: red;" />;
}

After

import React from "react";

function MyComponent() {
  return <div style={{ color: "red" }} />;
}

Implementation