-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Enforce single quotes and disallow var
in unit tests
#4154
Conversation
var
in unit tests
Perhaps we should standardise on ` instead? |
@slimbuck That's a reasonable suggestion. However, I kind of like reserving ` for template string literals. For example, say there was a long string and I saw it started with a `, I would then have to scan the whole string to find the embedded variables which may or may not be there. |
Yeah makes sense. ' is really similar to ` - perhaps " would be a better standard? |
I mainly went for single because:
Yeah, double is visually differentiated a bit more. But does that outweigh the above? I'm not totally sold. |
I would say readability of the codebase is more important than either the one-off change or double keystroke. |
(and tbh I think there's a big difference in readability between " and ' vs `). |
Actually, just remembered that we unofficially stick to Google's JS coding standards for the most part: https://google.github.io/styleguide/jsguide.html#features-strings-use-single-quotes So that's another key reason why you'll find way more singles than doubles right now. We just never enforced it. |
Anybody else feel strongly either way? |
Personally I tend to use " for these main reasons, but no super strong preference:
|
If I'm following what you're talking about here, I believe VS Code is smart enough to check the quotes of other imports in the file and try to match them. |
Great! Sounds like that one is a non issue then. |
A single quote is easier to type, as no extra button press is required. |
Haha, yeah, I can relate to that. I have a US keyboard at home and a UK keyboard in the office! |
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.
We chatted internally and decided single quote is the way to go.
var
tolet
andconst
.I confirm I have read the contributing guidelines and signed the Contributor License Agreement.