grunt-contrib-jshint icon indicating copy to clipboard operation
grunt-contrib-jshint copied to clipboard

Specific options does not overwrite the global options from .jshintrc

Open exos opened this issue 9 years ago • 5 comments

According the documentation the specific options replaces the global ones, but, It's does not work, I have:

Gruntfile.js (Not complete)

jshint: {
        options: {
            jshintrc: true
        },
        grunt: {
            options: {
                "maxlen": false,
                "strict": false
            },
            files: {
                src: 'Gruntfile.js'
            }
        },
        lib: {
            options: {
            },
            files: {
                src: [
                    'index.js',
                    'lib/*.js',
                    'lib/**/*.js'
                ]
            }
        }

    }
  });

.jshintrc (only the replaced options)

    "strict"        : true, 
    "maxlen"     : 80,

And when I run "grunt" command (with the jshint by default), I get this:

Running "jshint:grunt" (jshint) task

   Gruntfile.js
      5 |  grunt.initConfig({
           ^ Missing "use strict" statement.
     11 |        ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;' + '\n' +
                                                                                                  ^ Line is too long.
     12 |        ' * License: <%= _.pluck(pkg.licenses, "type").join(", ") %> (<%= _.pluck(pkg.licenses, "url").join(", ") %>)' + '\n' +
                                                                                                                                       ^ Line is too long.

>> 3 errors in 1 file
Warning: Task "jshint:grunt" failed. Use --force to continue.

Aborted due to warnings.

I have installed the version 0.11.1, with node 0.12.0 and npm 2.6.0, running in Archlinux.

├─┬ [email protected]
│ ├── [email protected]
│ └─┬ [email protected]
│   ├─┬ [email protected]
│   │ └─┬ [email protected]
│   │   ├── [email protected]
│   │   └─┬ [email protected]
│   │     ├── [email protected]
│   │     └── [email protected]
│   ├─┬ [email protected]
│   │ └── [email protected]
│   ├── [email protected]
│   ├─┬ [email protected]
│   │ ├── [email protected]
│   │ ├── [email protected]
│   │ ├─┬ [email protected]
│   │ │ └─┬ [email protected]
│   │ │   ├── [email protected]
│   │ │   └── [email protected]
│   │ ├── [email protected]
│   │ └─┬ [email protected]
│   │   ├── [email protected]
│   │   ├── [email protected]
│   │   ├── [email protected]
│   │   └── [email protected]
│   ├─┬ [email protected]
│   │ ├── [email protected]
│   │ └── [email protected]
│   ├── [email protected]
│   ├── [email protected]
│   └── [email protected]

exos avatar Mar 25 '15 06:03 exos

Same problem.

MrDefinite avatar May 13 '15 07:05 MrDefinite

+1

fischermatte avatar May 27 '15 08:05 fischermatte

+1 I saw in the changelog that this was done in v0.3.0 on 2013-03-13 and reverted immediately in v0.4.0 on 2013-04-04.

Is there a reason this was removed? I'd find it very useful.

*_EDIT_* For anyone experiencing this, you can place a second .jshintrc within the directory of secondary grunt target and it will match the first .jshintrc found above the file it's linting.

Hope this helps!

domtronn avatar Jul 24 '15 09:07 domtronn

+1

jshemas avatar Aug 17 '15 20:08 jshemas

+1

benkeen avatar Nov 02 '18 20:11 benkeen