Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#25864 closed enhancement (fixed)

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

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

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 13 years ago.
fix jshint for revisions.js

Download all attachments as: .zip

Change History (6)

@adamsilverstein
13 years ago

fix jshint for revisions.js

#1 @adamsilverstein
13 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
13 years ago

  • Owner set to azaozz
  • Resolution → fixed
  • Status new → closed

In 26035:

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

#3 @adamsilverstein
13 years ago

  • Component Unit Tests → Build Tools

#4 @nacin
13 years ago

  • Milestone Awaiting Review → 3.8

#5 @nacin
13 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.