WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#25864 closed enhancement (fixed)

jshint shouldn't throw errors - wp-admin/revisions.js

Reported by: adamsilverstein Owned by: azaozz
Milestone: 3.8 Priority: normal
Severity: normal Version: 3.8
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

The file wp-admin/revisions.js throws many errors in the jshint section of the build process.

The errors generated are:

W116: Expected '{' and instead saw ... - thrown in the many places where curly brackets are omitted from single line if/else blocks

W081: Too many var statements. - thrown in several places where var is used separately in a single function block instead of being combined into a single var statement at the top of the function

W117: ? is not defined. (Backbone, '_' Underscore, _wpRevisionsSettings) thrown for variables that are defined/passed from external sources; also several spots where var declaration missing ahead of variable use

W098: ? is defined but never used. - thrown where function signatures include variables that are never used and are therefore not needed

Attachments (1)

25864.diff (13.9 KB) - added by adamsilverstein 6 years ago.
fix jshint for revisions.js

Download all attachments as: .zip

Change History (6)

@adamsilverstein
6 years ago

fix jshint for revisions.js

#1 @adamsilverstein
6 years ago

As a check (per azaozz's suggestion), I compared the minified versions of the original and patched files (kaleidoscope helpful since its all one line). differences were minimal: better variable name optimization where variables now declared properly. the one other change was that I switched console reference to window.console to clear errors - the other approach would be to add console to the file's global declaration.

#2 @azaozz
6 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 26035:

jshint: fixes for revisions.js, props adamsilverstein, fixes #25864.

#3 @adamsilverstein
6 years ago

  • Component changed from Unit Tests to Build Tools

#4 @nacin
6 years ago

  • Milestone changed from Awaiting Review to 3.8

#5 @nacin
6 years ago

In 26207:

Fix JSHint errors in two files. see #25957, #25864. (Similar names but separate files.)

Note: See TracTickets for help on using tickets.