Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSHint: Overwrite single .jshintrc option for whole folder

I have a .jshintrc at the root of my project with the following configuration:

{
  "node": true,
  "smarttabs": true,
  "undef": true,
  "unused": true
}

This is fine for all the node related stuff I have in the project, but not for the browser related scripts. Which are sitting in a subfolder.
Is it possible overwrite just the node option while preserving the other options for a whole folder?

If I create another .jshintrc file for the browser side folder I have to tell JSHint again about all my configurations, although I actually just want to unset the node option.

I know that I can set this option in every file but I actually would like to avoid that.

Many thanks in advance!

like image 684
Sascha Wolf Avatar asked Oct 23 '13 09:10

Sascha Wolf


1 Answers

Yes, there's a feature in jshint v2.5.1 that is "extends", for your example this could be like this:

/.jshintrc

{
  "smarttabs": true,
  "undef": true,
  "unused": true
}

/server/.jshintrc

{
  "extends": "../.jshintrc",
  "node": true
}

/client/.jshintrc

{
  "extends": "../.jshintrc",
  "browser": true
}

You can read more about this feature here: https://github.com/jshint/jshint/releases/tag/2.5.1

like image 178
fernandopasik Avatar answered Nov 16 '22 04:11

fernandopasik