Skip to content

Commit

Permalink
fix(): set correct jshint esversion depending on coffeescript's v…
Browse files Browse the repository at this point in the history
…ersion

  * `esversion: 5` when `coffeescript@<2`
  * `esversion: 6` otherwise
  • Loading branch information
cueedee committed Oct 24, 2017
1 parent 8a41a8a commit dbb4eae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions lib/hint.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
CoffeeScript = require( 'coffeescript' )
csVersion = require( 'coffeescript/package.json' ).version
fs = require( 'fs' )
jshint = require( 'jshint' ).JSHINT
semver = require( 'semver' )
_ = require( 'underscore' )


Expand Down Expand Up @@ -43,6 +45,11 @@ errorsToSkip[ error.code ] = error for error in [
code: 'W018'
args: a: '!'

,
## > Unnecessary semicolon.
##
code: 'W032'

,
## > Bad number '{a}'.
##
Expand Down Expand Up @@ -93,6 +100,12 @@ hintFiles = ( paths, config, log ) ->
config.options
)


## Ensure a matching `esversion` is set, depending on whether this is `coffeescript@<2`.
##
options.esversion = if semver.satisfies( csVersion, '<2' ) then 5 else 6


return _.map( paths, ( path ) ->

try
Expand Down
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dependencies": {
"jshint": "^2.9.5",
"optimist": "~0.6.1",
"semver": "^5.4.1",
"underscore": "~1.8.3"
},
"description": "Checks CoffeeScript source for errors using JSHint",
Expand Down

0 comments on commit dbb4eae

Please sign in to comment.