Expose `loadConfig` from CLI for use from external tools #741

Closed
dpashkevich opened this Issue Nov 14, 2012 · 6 comments

Comments

Projects
None yet
6 participants

Currently only the CLI version of JSHint loads the .jshintrc file.

It would be nice if the config file would still be respected when jshint is used from tools like Grunt.
If loadConfig function was exposed, that would be possible.

And I can't just use grunt.file.readJSON() because .jshintrc isn't strictly a JSON file since it may contain comments (which I think is a great idea).

Please see related discussion here: gruntjs/grunt-contrib-jshint#2

mhulse commented Feb 15, 2013

+1 for this idea.

@xzyfer xzyfer added a commit to xzyfer/jshint that referenced this issue Mar 22, 2013

@xzyfer xzyfer Fixes #693 and #741. Export `gather` for easier extensibility.
This path adds `gather(opts)` to the cli export which the intention of
allowing third parties to hook into the file resolution, including file
ignore logic.

`cli.gather` is only concerned with the follow opts:
- cli args (files to linted)
- ignores (as would be parse from .jshintignores)
- extensions (as would be supplied by --extra-ext cli flag)

Called these, it will return an array of file paths that should be linted.
f67ad5f

@xzyfer xzyfer added a commit to xzyfer/jshint that referenced this issue Mar 22, 2013

@xzyfer xzyfer Fixes #693 and #741. Export `gather` for easier extensibility.
This patch adds `gather(opts)` to the cli export with the intention of
allowing third parties to hook into the file resolution, including file
ignore, logic.

`cli.gather` is only concerned with the following opts:
- cli args (files to linted)
- ignores (as would be parse from .jshintignores)
- extensions (as would be supplied by --extra-ext cli flag)

It would return an array of file paths that should be linted.
8dc154b

@xzyfer xzyfer added a commit to xzyfer/jshint that referenced this issue Mar 25, 2013

@xzyfer xzyfer Fixes #693 and #741. Export `gather` for easier extensibility.
This patch adds `gather(opts)` to the cli export with the intention of
allowing third parties to hook into the file resolution, including file
ignore, logic.

`cli.gather` is only concerned with the following opts:
- cli args (files to linted)
- ignores (as would be parse from .jshintignores)
- extensions (as would be supplied by --extra-ext cli flag)

It would return an array of file paths that should be linted.
11a3a8e

Krinkle commented May 30, 2013

This has been fixed in 11a3a8e and is now available in the 2.x release:

Krinkle commented May 30, 2013

Nevermind, loadConfig is still not exposed.

valueof closed this in 28dae4b Jul 1, 2013

@jugglinmike jugglinmike added a commit to jugglinmike/jshint that referenced this issue Oct 21, 2014

@xzyfer @jugglinmike xzyfer + jugglinmike Fixes #693 and #741. Export `gather` for easier extensibility.
This patch adds `gather(opts)` to the cli export with the intention of
allowing third parties to hook into the file resolution, including file
ignore, logic.

`cli.gather` is only concerned with the following opts:
- cli args (files to linted)
- ignores (as would be parse from .jshintignores)
- extensions (as would be supplied by --extra-ext cli flag)

It would return an array of file paths that should be linted.
ed02e6c

@jugglinmike jugglinmike added a commit to jugglinmike/jshint that referenced this issue Oct 21, 2014

@valueof @jugglinmike valueof + jugglinmike Fixed #741: expose loadConfig from CLI 23aaaa8

ysangkok referenced this issue in js-cookie/js-cookie Dec 22, 2016

Closed

Use strict mode, avoid octal syntax in tests.js #288

FagnerMartinsBrack commented Dec 22, 2016 edited

... .jshintrc isn't strictly a JSON file since it may contain comments (which I think is a great idea).

Is this publicly documented somewhere? I just want to make sure using comments in my .jshintrc files won't have side-effects in the future and it will be mentioned in changelog if something is changed.

See js-cookie/js-cookie#288 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment