jsx-curly-brace-presence
Configuration
Rule Details
Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children.
By default, the rule warns about unnecessary curly braces in both JSX props and children. Prop values that are JSX elements are ignored by default.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Examples of incorrect code for this rule with { "props": "always", "children": "always" }:
Examples of incorrect code for this rule with { "props": "always", "children": "always", "propElementValues": "always" }:
Examples of incorrect code for this rule with { "props": "never", "children": "never", "propElementValues": "never" }:
Options
The rule accepts either an options object or a single string shorthand:
Each of props, children, and propElementValues accepts:
"always"— enforce curly braces."never"— disallow unnecessary curly braces."ignore"— disable the check.
The string shorthand sets props and children to the given value;
propElementValues stays at its default of "ignore".