palantir / tslint-react

:orange_book: Lint rules related to React & JSX for TSLint.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow/disallow curly braces for string literal attributes (enforce double/single quotes only)

spradlin-dev opened this issue · comments

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"}/>

Sounds like a good idea, but I would suggest making this an ESLint rule instead. See #210