-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
enforce quote-props
lint
#6513
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 quote-props
lint
#6513
Conversation
@@ -127,7 +127,7 @@ module.exports = function drawArrowHead(el3, ends, options) { | |||
|
|||
d3.select(el.parentNode).append('path') | |||
.attr({ | |||
'class': el3.attr('class'), | |||
class: el3.attr('class'), |
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.
@alexcjohnson Do you recall if quotes around class
are needed here?
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.
class
is a reserved word, so it made me squeamish to leave it unquoted. But This note implies it's been fine for quite a long time:
Note: ECMAScript 3 didn’t allow the use of unquoted reserved words as property names. Here’s the full list of ES3 reserved words: abstract, boolean, break, byte, case, catch, char, class, const, continue, debugger, default, delete, do, double, else, enum, export, extends, false, final, finally, float, for, function, goto, if, implements, import, in, instanceof, int, interface, long, native, new, null, package, private, protected, public, return, short, static, super, switch, synchronized, this, throw, throws, transient, true, try, typeof, var, void, volatile, while, and with. Avoid using these as unquoted property names if backwards compatibility is a concern.
This is fine in ES5 and beyond 🎉
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.
Ha OK, this was a lot more widespread than I realized 😅
Thanks 💃
Addressing #6428 (comment) by using
as-needed
option.See https://eslint.org/docs/latest/rules/quote-props for more details.
Please note that for files in
lib/locales
folder the rule is set toconsistent
.It is also disabled for
regl_precompiled.js
files by b8e0041.@plotly/plotly_js
You could simply run the following to fix all the files: