Closed Bug 1312486 Opened 3 years ago Closed 3 years ago

Enable no-extra-boolean-cast, no-new-object, no-shadow-restricted-names, and spaced-comment rules for eslint

Categories

(Firefox :: General, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 52
Tracking Status
firefox52 --- fixed

People

(Reporter: jaws, Assigned: jaws)

References

Details

Attachments

(1 file)

Running eslint-nibble showed that there were a number of easy to fix rules that didn't have a bunch of occurrences. We can fix some of these now to prevent them from becoming problems in the future.

Running eslint-nibble on /browser showed the following results:
no-undef:                    20477|
indent:                      11480|
space-before-function-paren:  6847|
brace-style:                  4765|
curly:                        4574|
no-unused-vars:               4020|
key-spacing:                  1495|
semi:                         1131|
no-multi-spaces:               997|
no-use-before-define:          929|
no-shadow:                     905|
generator-star-spacing:        900|
space-infix-ops:               740|
space-in-parens:               682|
comma-style:                   408|
space-unary-ops:               235|
no-unused-expressions:         132|
linebreak-style:                96|
no-spaced-func:                 52|
no-unreachable:                 37|
no-shadow:                      26|
new-parens:                     26|
no-array-constructor:           19|
no-new-object:                  15|
no-return-assign:                5|
spaced-comment:                  4|
no-extra-boolean-cast:           2|
max-len:                         1|
no-shadow-restricted-names:      1|

This patch enables no-extra-boolean-cast, no-new-object, no-shadow-restricted-names, and spaced-comment rules.

max-len and no-return-assign were not enabled because they actually have a lot more occurrences when run in the full codebase.
To create this patch I ran `mach eslint --fix` and then fixed roughly 57 errors by hand (spacing of comments and removal of `new Object()` mostly.
Comment on attachment 8803960 [details]
Bug 1312486 - Enable no-extra-boolean-cast, no-new-object, no-shadow-restricted-names, and spaced-comment rules for eslint.

https://reviewboard.mozilla.org/r/88146/#review87302

Looks good. Some of the `// ////` comments look a bit strange, but I think that's reasonable compared with how much easier it makes it to read the other comments.
Attachment #8803960 - Flags: review?(standard8) → review+
Pushed by jwein@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/62c5218b7325
Enable no-extra-boolean-cast, no-new-object, no-shadow-restricted-names, and spaced-comment rules for eslint. r=standard8
https://hg.mozilla.org/mozilla-central/rev/62c5218b7325
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52
Depends on: 1315013
You need to log in before you can comment on or make changes to this bug.