Skip to content
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

eslint: disable "prefer-template" rule #19

Merged
merged 1 commit into from
May 19, 2018
Merged

Conversation

davidchambers
Copy link
Member

I have found the prefer-template rule to be overly prescriptive, and have disabled it in several projects. I see the appeal of a consistent approach to string concatenation, but template literals are significantly noisier in some cases. Consider the following examples:

`${x}${y}`
`${x} ${y}`
`${f (x)}${f (y)}`
`${f (x)} ${f (y)}`

The equivalent expressions without template literals read better:

x + y
x + ' ' + y
f (x) + f (y)
f (x) + ' ' + f (y)

In some cases, of course, template literals are the better option. By disabling the prefer-template rule we allow authors to exercise their judgement.

@davidchambers davidchambers merged commit a4d6a42 into master May 19, 2018
@davidchambers davidchambers deleted the davidchambers/eslint branch May 19, 2018 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant