Follow-up of #1664940: [Policy, patch] Decide on JSHint configuration and part of #1415788: Javascript winter clean-up
Run jshint on the files with the configuration from the parent issue or use jshint.com with the following options:
/*jshint forin:true, noarg:true, eqeqeq:true, undef:true, curly:true, browser:true, expr:true, latedef:true, newcap:true, trailing:true */
/*global Drupal, jQuery */
Fix any warnings or errors the tool finds.
Check manually that the fixes did not break any functionality.
Create patch and upload for the testbot.
Files: modules/views/views_ui/js/views-admin.js
Comment | File | Size | Author |
---|---|---|---|
#18 | core-js-jshint-views_admin-1835102-17.patch | 8.52 KB | nod_ |
#14 | drupal-1835102-14.patch | 12.64 KB | dawehner |
#14 | interdiff.txt | 1.12 KB | dawehner |
#13 | 1835102-13.patch | 12.35 KB | damiankloip |
#13 | interdiff.txt | 5.35 KB | damiankloip |
Comments
Comment #1
rballou CreditAttribution: rballou commentedInitial pass for JSHint:
Comment #2
rballou CreditAttribution: rballou commentedAdded patch to cleanup JSHint issues
Comment #3
nod_looks good
Comment #4
webchickThis is a metric ton of changes. Has anyone tested this manually to ensure things still work?
Comment #5
nod_I know it was short, but I did test it before RTBC. Lots of unused variables removed by this patch and variables got declared, it's straightforward.
Retested just to make sure, all good.
Comment #6
dawehnerThis code alters the array, so i'm really not sure whether this is safe.
Comment #7
dawehnersorry this was the wrong patch.
Comment #8
nod_That was a good catch, This code can be triggered by adding a new filter condition and selecting/unselecting a checkbox. It controls the display of the "Selected :" box above the forms controls.
I'll let someone else RTBC :p
Comment #9
nod_Can it be rereolled without the whole length thing and keep the
this.checkedItems
as before? so that it's straightforward to RTBC?We'll take care of adding manual tests and using a proper construct to not abusing a for loop in the refactor issue later on #1839130: Refactor modules/views_ui/js/views-admin.js. Having the counter as well as the max value being altered inside the for loop sounds really bad :p
Comment #10
rballou CreditAttribution: rballou commentedHere's a patch that keeps
this.checkedItems
and removes the length variable from that section of code. Thanks for catching that it was changing the array in the loop... I missed that!Also, I am working on getting the Test Swarm module working to make testing some of this easier (you can view it for currently committed D8 work, but this way I can check before/after some changes).
Comment #11
dawehnerThis looks good now, but we need still some manual testing.
Comment #12
droplet CreditAttribution: droplet commentedspace problems (http://drupal.org/node/172169/#declarations) & redundant "var height = 0;"
Comment #13
damiankloip CreditAttribution: damiankloip commentedComment #14
dawehnerwait .... this variable is used below.
Comment #15
droplet CreditAttribution: droplet commentedLooks good. It's more like reformat the code :)
Comment #16
catchNot completely sure about this bit:
While those arguments aren't used, those are the arguments that actually get passed to the function, so do we really want to remove those?
Comment #17
droplet CreditAttribution: droplet commentedPassing unused parameters ?
Comment #18
nod_Let the unused parameters, I took out the option from our JSHint configuration, too much trouble for what it's worth. Can always use as documentation in a pinch too :)
Here is the updated patch with some spaces changes in the way of the new coding standards which are being written over there #1778828-7: [policy, no patch] Update JS coding standards help welcome.
Comment #19
nod_let's take care of that in #1839130: Refactor modules/views_ui/js/views-admin.js