Closed Bug 1215455 Opened 9 years ago Closed 9 years ago

Use eslint --fix to turn on additional rules

Categories

(Hello (Loop) :: Client, defect)

defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
mozilla44
Iteration:
44.3 - Nov 2
Tracking Status
firefox44 --- fixed

People

(Reporter: Mardak, Assigned: Mardak)

References

Details

Attachments

(12 files, 11 obsolete files)

4.48 KB, patch
standard8
: review+
Details | Diff | Splinter Review
21.58 KB, patch
standard8
: review+
Details | Diff | Splinter Review
5.36 KB, patch
standard8
: review-
Details | Diff | Splinter Review
324.74 KB, patch
standard8
: review-
Details | Diff | Splinter Review
35.67 KB, patch
standard8
: review+
Details | Diff | Splinter Review
39.68 KB, patch
standard8
: review+
Details | Diff | Splinter Review
55.50 KB, patch
standard8
: review+
Details | Diff | Splinter Review
6.18 KB, patch
standard8
: review+
Details | Diff | Splinter Review
9.08 KB, patch
standard8
: review+
Details | Diff | Splinter Review
11.14 KB, patch
standard8
: review+
Details | Diff | Splinter Review
4.71 KB, patch
standard8
: review+
Details | Diff | Splinter Review
166.90 KB, image/png
Details
With eslint 1.6 from bug 1210774, we get --fix!

A number of spacing rules can be turned on with --fix autofixing. "indent" doesn't seem to work quite right though. Some rules can be turned on without any code changes too.
Attached patch 7 patches in one (obsolete) — Splinter Review
Here's 7 patches in one file. The first patch is turning on rules that don't require code changes. The following 6 patches add one rule and run with --fix:

browser/components/loop$ ./standalone/node_modules/.bin/eslint --fix --ext .js --ext .jsm --ext .jsx .
Assignee: nobody → edilee
Status: NEW → ASSIGNED
Attachment #8674767 - Flags: review?(standard8)
Comment on attachment 8674767 [details] [diff] [review]
7 patches in one

>+    "object-curly-spacing": 2,
>-          <li className={cx({ "dropdown-menu-item": true,
>+          <li className={cx({"dropdown-menu-item": true,
>                               "disabled": this.props.blocked,
Hrmm.. not so great at aligning the other properties
Attached patch 0 - no code change (obsolete) — Splinter Review
Attached patch 1 - no-multi-spaces (obsolete) — Splinter Review
Attached patch 2 - array-bracket-spacing (obsolete) — Splinter Review
Attached patch 3 - object-curly-spacing (obsolete) — Splinter Review
Attached patch 4 - space-after-keywords (obsolete) — Splinter Review
Attached patch 5 - space-before-blocks (obsolete) — Splinter Review
Attached patch 6 - space-before-fuction-paren (obsolete) — Splinter Review
Attached patch 3 - object-curly-spacing always (obsolete) — Splinter Review
Attached patch 0 - no code change (obsolete) — Splinter Review
Turns out there's some more rules that can be turned on now without any code changes. The following patches are rebased on top of latest fx-team, so panel contacts removal is in.
Attachment #8674767 - Attachment is obsolete: true
Attachment #8674770 - Attachment is obsolete: true
Attachment #8674771 - Attachment is obsolete: true
Attachment #8674772 - Attachment is obsolete: true
Attachment #8674773 - Attachment is obsolete: true
Attachment #8674774 - Attachment is obsolete: true
Attachment #8674775 - Attachment is obsolete: true
Attachment #8674776 - Attachment is obsolete: true
Attachment #8674779 - Attachment is obsolete: true
Attachment #8674767 - Flags: review?(standard8)
Attachment #8675234 - Flags: review?(standard8)
Attachment #8675234 - Attachment is obsolete: true
Attachment #8675234 - Flags: review?(standard8)
Attachment #8675235 - Flags: review?(standard8)
Attached image example code before, errors, after (obsolete) —
forgot to include the rules that didn't need code changes
Attachment #8676614 - Attachment is obsolete: true
Comment on attachment 8675237 [details] [diff] [review]
2 - array-bracket-spacing

Review of attachment 8675237 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/loop/.eslintrc
@@ +33,5 @@
>      // want to audit these rules, and start turning them on and fixing the
>      // problems they find, one at a time.
>  
>      // Eslint built-in rules are documented at <http://eslint.org/docs/rules/>
> +    "array-bracket-spacing": 2,

This needs to be specified as [2, "never"] as that's what it is currently defaulting two, but just reading the file doesn't tell you that.

However, its also slightly strange - this seems to conflict with the object-curly-spacing setting which you're setting to "always".

Maybe we should have a short discussion after a standup about this?
Comment on attachment 8675243 [details] [diff] [review]
8 - space-in-parens

Review of attachment 8675243 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/loop/.eslintrc
@@ +109,5 @@
>      "space-before-blocks": 2,
>      "space-before-function-paren": [2, "never"],
>      "space-before-keywords": 2,
>      "space-infix-ops": 2,
> +    "space-in-parens": 2,

We should specify "never" here as well, as it isn't clear from the documentation that this is the case (and would make it clearer for readers).
Comment on attachment 8675244 [details] [diff] [review]
9 - react/jsx-curly-spacing

Review of attachment 8675244 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/components/loop/.eslintrc
@@ +128,5 @@
>      "react/no-unknown-property": 2,
>      "react/prop-types": 2,
>      "react/self-closing-comp": 2,
>      "react/wrap-multilines": 2,
> +    "react/jsx-curly-spacing": 2,

Please add the "never"
Attachment #8675235 - Flags: review?(standard8) → review+
Attachment #8675236 - Flags: review+
Attachment #8675237 - Flags: review-
Attachment #8675238 - Flags: review-
Attachment #8675239 - Flags: review+
Attachment #8675240 - Flags: review+
Attachment #8675241 - Flags: review+
Attachment #8675242 - Flags: review+
Comment on attachment 8675243 [details] [diff] [review]
8 - space-in-parens

Review of attachment 8675243 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with the previous comments fixed
Comment on attachment 8675243 [details] [diff] [review]
8 - space-in-parens

Review of attachment 8675243 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with the previous comments fixed
Attachment #8675243 - Flags: review+
Comment on attachment 8675244 [details] [diff] [review]
9 - react/jsx-curly-spacing

Review of attachment 8675244 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with the previous comments fixed
Attachment #8675244 - Flags: review+
Attachment #8675245 - Flags: review+
Ok, I've flagged everything with + or -, there's just the two that feel like inconsistencies that I think we should ask the wider group.
https://hg.mozilla.org/integration/fx-team/rev/ffeca1025cd07845ef400d7bcd1b699d075a6cda
Bug 1215455 - Use eslint --fix to turn on additional rules [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/70d83aad0cc13333ab6ba541f897e6b05e21917a
Bug 1215455 - eslint no-multi-spaces [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/2788036d08a80b062f70832a0a75e37acccc182e
Bug 1215455 - eslint array-bracket-spacing [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/5f023c0c5fb33e4ac636d9c6d13892e377ef4e97
Bug 1215455 - eslint object-curly-spacing [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/412326380fc25f783726a4c9baa54c3d6fe78983
Bug 1215455 - eslint space-after-keywords [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/de78149fb3db564d5a52af4b41a916d0d2703287
Bug 1215455 - eslint space-before-blocks [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/d39db1517fb2fbbbe14c11c71e2beb871725074a
Bug 1215455 - eslint space-before-function-paren [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/39f32e5b6af91d4d7a63f332a472e05d09a2f5de
Bug 1215455 - eslint operator-assignment [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/2eb2b6388613a26f581f7339ea1d8c4082abf3f2
Bug 1215455 - eslint space-in-parens [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/9b5bd211ecde43cc4131c9aeeddd457d72ab878a
Bug 1215455 - eslint react/jsx-curly-spacing [r=Standard8]

https://hg.mozilla.org/integration/fx-team/rev/ef65374a93d6353004c78091cb65a2f41fec7aeb
Bug 1215455 - eslint consistent-return [r=Standard8]
Iteration: --- → 44.3 - Nov 2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: