jshintgrunt-contrib-jshint

jshint grunt targets generate message: 0 files linted. Please check your ignored files


I have multiple jshint configurations in my gruntfile.

I tested each configuration, and it works great.

However, when I define a target in the gruntfile for each configuration, jshint stops working and all I can see is :

0 files linted. Please check your ignored files.

This is how my jshint configuration looks like with targets:

    jshint: {
        backend: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                'server.js',
                '*.js',
                'backend/{,*/}*.js'
            ]
        },
        test: {
            options: {
                jshintrc: 'test.jshintrc'
            },
            all: [
                'test/{,*/}*.js'
            ]
        }
    }

Solution

  • For multiple tasks changing:

    'all' : {...} 
    

    to

    'files': { src: [...] } 
    

    should fix it. It would seem that 'all' is a shorthand for a single task, with multiple tasks, jshint will be looking for files in files->src ie:

    backend: {
        options: {
            jshintrc: '.jshintrc'
        },
        'files': { 
            'src': [
                'Gruntfile.js',
                'server.js',
                '*.js',
                'backend/{,*/}*.js'
            ]
        }
    },
    test: {
        options: {
            jshintrc: 'test.jshintrc'
        },
        'files': {
            'src': [
                'test/{,*/}*.js'
            ]
        }
    }