Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spradlin-dev opened this issue Aug 12, 2019 · 1 comment
Labels
Formatting rule Relates to a rule which enforces code formatting and likely overlaps with prettier Resolution: Declined Type: Rule Suggestion

Comments

@spradlin-dev
Copy link

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"}/>
@adidahiya
Copy link
Contributor

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

@adidahiya adidahiya added Resolution: Declined Formatting rule Relates to a rule which enforces code formatting and likely overlaps with prettier Type: Rule Suggestion labels Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Formatting rule Relates to a rule which enforces code formatting and likely overlaps with prettier Resolution: Declined Type: Rule Suggestion
Projects
None yet
Development

No branches or pull requests

2 participants