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/js/ajax.js

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rballou’s picture

Initial JSHint pass:

ajax.js: line 84, col 54, Unescaped '-'.
ajax.js: line 84, col 56, Unescaped '['.
ajax.js: line 84, col 70, Unescaped '^'.
ajax.js: line 212, col 84, A leading decimal point can be confused with a dot: '.8'.
ajax.js: line 212, col 86, Missing radix parameter.
ajax.js: line 9, col 3, 'Drupal' is not defined.
ajax.js: line 10, col 22, 'Drupal' is not defined.
ajax.js: line 11, col 21, 'Drupal' is not defined.
ajax.js: line 12, col 22, 'Drupal' is not defined.
ajax.js: line 16, col 5, 'Drupal' is not defined.
ajax.js: line 33, col 9, 'Drupal' is not defined.
ajax.js: line 33, col 31, 'Drupal' is not defined.
ajax.js: line 34, col 9, 'Drupal' is not defined.
ajax.js: line 37, col 5, 'Drupal' is not defined.
ajax.js: line 40, col 3, 'Drupal' is not defined.
ajax.js: line 41, col 5, 'Drupal' is not defined.
ajax.js: line 41, col 77, 'Drupal' is not defined.
ajax.js: line 42, col 7, 'Drupal' is not defined.
ajax.js: line 45, col 3, 'Drupal' is not defined.
ajax.js: line 50, col 3, 'Drupal' is not defined.
ajax.js: line 59, col 5, 'Drupal' is not defined.
ajax.js: line 64, col 3, 'Drupal' is not defined.
ajax.js: line 69, col 3, 'Drupal' is not defined.
ajax.js: line 75, col 3, 'Drupal' is not defined.
ajax.js: line 95, col 3, 'Drupal' is not defined.
ajax.js: line 102, col 3, 'Drupal' is not defined.
ajax.js: line 115, col 3, 'Drupal' is not defined.
ajax.js: line 127, col 3, 'Drupal' is not defined.
ajax.js: line 156, col 9, 'Drupal' is not defined.
ajax.js: line 156, col 33, 'Drupal' is not defined.
ajax.js: line 169, col 13, 'Drupal' is not defined.
ajax.js: line 176, col 9, 'Drupal' is not defined.
ajax.js: line 176, col 33, 'Drupal' is not defined.
ajax.js: line 192, col 13, 'Drupal' is not defined.
ajax.js: line 201, col 9, 'Drupal' is not defined.
ajax.js: line 201, col 33, 'Drupal' is not defined.
ajax.js: line 204, col 37, 'Drupal' is not defined.
ajax.js: line 206, col 9, 'Drupal' is not defined.
ajax.js: line 209, col 19, 'Drupal' is not defined.
ajax.js: line 213, col 19, 'Drupal' is not defined.
ajax.js: line 9, col 81, 'status' is defined but never used.
ajax.js: line 22, col 43, 'event' is defined but never used.
ajax.js: line 25, col 47, 'event' is defined but never used.
ajax.js: line 40, col 85, 'status' is defined but never used.
ajax.js: line 40, col 77, 'response' is defined but never used.
ajax.js: line 40, col 67, 'ajax' is defined but never used.
ajax.js: line 45, col 80, 'status' is defined but never used.
ajax.js: line 50, col 80, 'status' is defined but never used.
ajax.js: line 64, col 85, 'status' is defined but never used.
ajax.js: line 64, col 77, 'response' is defined but never used.
ajax.js: line 64, col 67, 'ajax' is defined but never used.
ajax.js: line 69, col 88, 'status' is defined but never used.
ajax.js: line 69, col 80, 'response' is defined but never used.
ajax.js: line 69, col 70, 'ajax' is defined but never used.
ajax.js: line 75, col 86, 'status' is defined but never used.
ajax.js: line 116, col 30, 'context' is defined but never used.
ajax.js: line 184, col 58, 'event' is defined but never used.

57 errors
rballou’s picture

Status: Active » Needs work
FileSize
8.52 KB

Cleaned up Drupal, the regexp character escaping issues, and the radix parameter. I still need to come back and assess/change the unused variables (normally part of the function arguments).

rballou’s picture

Status: Needs work » Needs review
FileSize
3.69 KB
9.26 KB

Cleaned up the unused variables. I have added two patches: the "combined" patch is both sets of changes, the "unused" is just the second set of changes.

Status: Needs review » Needs work

The last submitted patch, core-js-jshint-views-ajax.unused.patch, failed testing.

rballou’s picture

Status: Needs work » Needs review
Issue tags: +Needs manual testing, +VDC
FileSize
4.66 KB

Updated the patch to keep Drupal as Drupal

dawehner’s picture

Status: Needs review » Needs work
Issue tags: +Needs manual testing, +JavaScript clean-up, +VDC

The last submitted patch, core-js-jshint-views-ajax-drupal.patch, failed testing.

nod_’s picture

Updated the jshint config, here are the errors that needs fixing now:

core/modules/views/views_ui/js/ajax.js: line 198, col 86, A leading decimal point can be confused with a dot: '.8'.
core/modules/views/views_ui/js/ajax.js: line 198, col 86, Missing radix parameter.
droplet’s picture

Status: Needs work » Needs review
Issue tags: +Quick fix
FileSize
721 bytes
nod_’s picture

Status: Needs review » Reviewed & tested by the community

Works :)

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.