Rules
no-string-style
Use JSX object styles instead of string styles.
Purpose and behavior
Use JSX object styles instead of string styles.
The rule reports literal string JSX style attributes, such as style="color:red". The rule does not check strings inside braces or string variables. It allows object expressions and does not validate CSS properties.
Options
No configurable options. Enable with "rules/no-string-style": "error".
Invalid example
const el = <div style='color: red' />Valid example
const el = <div style={{ color: 'red' }} />Fixes and exceptions
This rule provides no automatic fix. Rewrite the code to preserve its intended behavior.
For a boundary exception, use oxlint-disable-next-line rules/no-string-style -- reason. Examples cover this rule only and may omit imports or declarations.
Source and tests
Enabled by the TypeScript preset.