Style error information
https://eslint.org/docs/rules/no-var
Remark
- Code refactoring. Review it carefully :)
- Introduces another issue, no-case-declarations.
How to Review
## 1. Apply Patch
## 2. Review Code Changes
## 3. Confirm no Code Standard Errors
yarn & yarn lint:core-js-passing
## 4.1 If `NO` errors, mark the issue as `Reviewed & tested by the community` (Don't be shy, we're all friendly)
## 4.2 If `HAS` errors, fix it and upload a new patch (Just do it and you can!!!)
Background
- #2912962: Step 1 JS codestyle: [meta] Fix JS coding standards in core
- We adapted the airbnb coding standard (#2815077: Adopt airbnb javascript style guide v14.1 as new baseline javascript coding standards for Drupal 8 core and contrib), but we are not fully compliant to it yet.
More Information
- Using ES6 in Core
https://www.drupal.org/node/2815083
- To find JS code standard errors stats
cd core/ && yarn & yarn lint:core-js-stats
Valuable Follow-up
- N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | interdiff-2914946-10-12.txt | 3.22 KB | GrandmaGlassesRopeMan |
| #12 | 2914946-12.patch | 35.74 KB | GrandmaGlassesRopeMan |
| #3 | 2914946.patch | 12.3 KB | GrandmaGlassesRopeMan |
Comments
Comment #2
GrandmaGlassesRopeManComment #3
GrandmaGlassesRopeManComment #4
dawehnerIMHO the $i could be initialized as const later
$i = $(i);... Should we do that instead?There is some weird code going on if you look at it with more context, ¯\_(ツ)_/¯
Comment #5
GrandmaGlassesRopeMan@dawehner
Yep. I saw both of those when going through these changes. I opted not to actually fix the larger issues to avoid introducing any regressions. I can file a followup to add the 'no-case-declarations' to the ignore list.
Comment #6
dawehnerFair point, do you mind creating these follow ups?
Comment #7
GrandmaGlassesRopeMan#2915263: Exclude eslint rule no-case-declarations
Comment #8
droplet commentedWhy not fix it together? `no-case-declarations` helping you to understand const/let/var scope around that switch.
Comment #9
droplet commentedand I checkout the patch locally. I think @dawehner's point 1 should do it together when it's a trivial change. We better to fix it to final, not introduce another bug, haha (Another new bug might get fixed on another patch :p, no more reroll)
Comment #10
GrandmaGlassesRopeManYeah, ok. Easy enough. 👍👏
Comment #12
GrandmaGlassesRopeMan🤷♀️
Comment #13
GrandmaGlassesRopeManComment #14
dawehnerDon't we want to have the second rule removed from here as well?
Comment #16
GrandmaGlassesRopeManComment #17
dawehnerThe testbots had a bit of a quickup.
No errors are left:
In #4 I went through all the instances and checked whether const/let was applied correctly, and just found the instances above.
Comment #18
lauriiiComment #19
droplet commentedI help @drpal reroll it quick. Fixes `core/.eslintrc.passing.json` conflicts. (no credits to me :p)
Comment #20
droplet commentedComment #21
GrandmaGlassesRopeMan@droplet Literally seconds before me. 🤘
Comment #22
dawehnerBack to RTBC
Comment #23
lauriiiCommitted 29cd930 and pushed to 8.5.x. Thanks!