-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Use template literals instead of string concatenation #3066
Conversation
We have used it inconsistently so far. Template literals are more modern and usually easier to read. https://eslint.org/docs/latest/rules/prefer-template
Good PR. I would vote for adding the rule to the eslint config and add one "// disable" exception to the line in the newsfeed module. That way we stay "modern" and can fix the line maybe later :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add rule to eslintrc and add exception to the one line in newsfeed module
It is already included in "plugin:prettier/recommended".
I just did the following:
|
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## develop #3066 +/- ##
===========================================
+ Coverage 23.02% 23.13% +0.10%
===========================================
Files 52 52
Lines 11582 11566 -16
===========================================
+ Hits 2667 2676 +9
+ Misses 8915 8890 -25
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
We have used it inconsistently till now. Template literals are more modern and easier to maintain in my opinion.
Because that's a large amount of changes, here's a way to reproduce it: I added the rule
"prefer-template": "error"
to the.eslintrc.json
and did an autofix. Since this caused a new problem in line 409 ofnewsfeed.js
, I reversed it in that line and also removed the rule from the eslint config file.The rule is described here: https://eslint.org/docs/latest/rules/prefer-template
Note: I've played around with some other linter rules as well, and some seem to point to some specific, non-cosmetic, issues. But before I dive even deeper and then introduce even bigger and hardly understandable changes at once, I thought I'd start with this simple cosmetic rule.