简体   繁体   中英

Grunt JSHint Multiple Tasks Problems

I am having issues setting up JSHint to run multiple tasks. Here is what I have:

 jshint: {
      app: {
        files: [
            'web/**/*.js',
            '!web/app.js',
            '!web/lib/**',
            '!web/build/**'
        ],
        options: {
            // Just let the templates do whatever they want when compiled
            ignores: ['web/templates/*.js'],
            // options here to override JSHint defaults
            loopfunc: true,
            newcap: false,
            reporter: require('jshint-stylish'),
            globals: {
                jQuery: true,
                gadget: true
            }
        }
      },
      test: {
        files: [
            'web/**/*.js',
            '!web/app.js',
            '!web/lib/**',
            '!web/build/**'
        ],
        options: {
            // just let the templates do whatever they want when compiled
            ignores: ['web/templates/*.js'],
            reporter: require('jshint-stylish'),
            jshintrc: '.jshintrc'
        }
      }

 }

When I try to run grunt jshint:app or grunt jshint:test , I get errors that there is no task for either of those.

Thank you for your help if you see anything that I have missed.

I think you need to add

grunt.loadNpmTasks('grunt-contrib-jshint');

to your grunt file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM