linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

Possibility to load jshint options from .jshintrc file #269

Closed dudkiewicz-codes closed 9 years ago

dudkiewicz-codes commented 10 years ago

Currently there is no way (at least I am not aware of one) to configure jshint plugin using .jshintrc file. I have to copy jshint options to application.js from .jshintrc. As a result I end up with duplicated jshint configuration - one for lineman, one for code editor. It would be nice to load options from .jshintrc by default (or at least to have an option to specify path to .jshintrc file).

searls commented 10 years ago

Sounds like this should be a patch submitted to grunt-contrib-jshint

On Wed, May 21, 2014 at 9:36 AM, pdudkiewicz notifications@github.com wrote:

Currently there is no way (at least I am not aware of one) to configure jshint plugin using .jshintrc file. I have to copy jshint options to application.js from .jshintrc. As a result I end up with duplicated jshint configuration - one for lineman, one for code editor.

It would be nice to load options from .jshintrc by default (or at least to have an option to specify path to .jshintrc file).

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/269

dudkiewicz-codes commented 10 years ago

There is jshintrc option in grunt-contrib-jshint : https://github.com/gruntjs/grunt-contrib-jshint#jshintrc but it doesn't work with lineman.

jshint: {
  options: {
    jshintrc: true
  }
}

Running

lineman config jshint.options

prints:

{
  "curly": true,
  "eqeqeq": true,
  "latedef": true,
  "newcap": true,
  "noarg": true,
  "boss": true,
  "eqnull": true,
  "sub": true,
  "browser": true,
  "jshintrc": true
}

As a workaround I will use:

jshint: {
    options: JSON.parse(require('fs').readFileSync('.jshintrc'))
}
searls commented 10 years ago

Ah if there is that option then lineman ought to support it. Is it simply a version issue? (Install latest jshint to your project to see)

On Wed, May 21, 2014 at 10:41 AM, pdudkiewicz notifications@github.com wrote:

There is jshintrc option in grunt-contrib-jshint : https://github.com/gruntjs/grunt-contrib-jshint#jshintrc but it doesn't work with lineman. jshint: { options: { jshintrc: true } } Running lineman config jshint.options prints: { "curly": true, "eqeqeq": true, "latedef": true, "newcap": true, "noarg": true, "boss": true, "eqnull": true, "sub": true, "browser": true, "jshintrc": true } As a workaround I will use: jshint: { options: JSON.parse(require('fs').readFileSync('.jshintrc'))

}

Reply to this email directly or view it on GitHub: https://github.com/linemanjs/lineman/issues/269#issuecomment-43763050

dudkiewicz-codes commented 10 years ago

Same situation with grunt-contrib-jshint 0.10.0.

jasonkarns commented 9 years ago

lineman config jshint will only show the config options provided in our application config files. However, the grunt-contrib-jshint task ignores any grunt-supplied options if jshintrc is true. It doesn't merge the options, it just uses the jshintrc file alone. When actually running lineman with jshintrc:true, does it respect the lineman config or the jshintrc file? (Keeping in mind that what lineman config jshint shows you would be a lie.)

jasonkarns commented 9 years ago

I just confirmed that jshintrc: true does indeed work as expected. .jshintrc placed in root of project (not under /app or /config). When jshintrc is true, and grunt-contrib-jshint is reading from the jshintrc file, options provided by lineman/grunt are ignored. Only the options in the jshintrc file are respected. (As per grunt-contrib-jshint docs.)

Verified with lineman 0.29.3 and grunt-contrib-jshint 0.10.0.