Allow/disallow curly braces for string literal attributes (enforce double/single quotes only)
spradlin-dev opened this issue · comments
spradlin-dev commented
existing quotes rule jsx-double
only makes sure you don't type attr='value'
, but doesn't prevent attr={'value'}
.
I want enable my team to catch inconsistent quotes in JSX and only use curly braces for string values when they have to be interpreted or concatenated, such as using string templates.
No error
<Component name="string"/>
<Component name={'string-' + id}/>
<Component name={`string-${id}`}/>
Error
<Component name={'string'}/>
<Component name={"string"}/>
Adi Dahiya commented
Sounds like a good idea, but I would suggest making this an ESLint rule instead. See #210