[wp-trac] [WordPress Trac] #33021: Global javascript variables incorrectly defined

WordPress Trac noreply at wordpress.org
Sun Jul 19 17:01:07 UTC 2015


#33021: Global javascript variables incorrectly defined
------------------------------+-------------------------
 Reporter:  johnjamesjacoby   |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  4.3
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:  javascript
------------------------------+-------------------------
Changes (by nacin):

 * keywords:  has-patch close => has-patch
 * milestone:  Awaiting Review => 4.3


Comment:

 I agree with @jorbin that we should not be including globals that are
 listed in `.jshintrc` (and remove them where they are duplicated). An IDE
 *must* parse this file to be able to do anything effective with regards to
 JavaScript linting, as it needs to know the rest of the flags of the
 project. The `globals` directive is the same for JSHint and JSLint in this
 case.

 Within the file, I agree that we should standardize on `/*global*/`.
 JSLint does not appear to support `/*globals*/`. Additionally, it uses
 `/*global*/` in its own files:
 https://github.com/douglascrockford/JSLint/blob/master/browser.js.

 JSHint supports both:
 https://github.com/jshint/jshint/blob/master/src/lex.js#L412. However, it
 uses `/*global*/` in its own files:
 https://github.com/jshint/jshint/blob/master/src/jshint.js#L32. JSHint
 does, of note, confuses this in its documentation: http://jshint.com/docs
 /#inline-configuration. It specifies `/*jshint*/` and `/*global*/` but
 then proceeds to document it as `/*globals*/`. I've submitted an issue to
 the website: https://github.com/jshint/jshint.github.io/issues/27.

 Bottom line: IDEs should be responsible for parsing `.jshintrc`. I don't
 think they need to take responsibility for parsing an underused alias.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33021#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list