fortran
fortran

Reputation: 76107

Grunt does not find the lint task

I've inherited a project that was managed with Grunt (in fact with an old version, I'm not sure exactly which) and I am a total newbie to it.

I've made a two changes that seemed logical by reading the documentation (I guess to conform to the latest specification): converting tasks list that were in a single string delimited by white spaces to proper lists.

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
                '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
                '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
                '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
                ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
        },
        handlebars: {
            all: {
                src: 'src/templates/',
                dest: 'dist/templates.js'
            }
        },
        require : {
            all: {
                src : 'src/scripts/app.build.js',
                dest: 'dist/<%= pkg.name %>.js'
            }
        },
        concat: {
            dist: {
                src: ['<file_strip_banner:src/scripts/bootstrap.js>', '<file_strip_banner:dist/<%= pkg.name %>.js>'],
                dest: 'dist/<%= pkg.name %>.js'
            }
        },
        min: {
            dist: {
                src: ['<config:concat.dist.dest>'],
                dest: 'dist/<%= pkg.name %>.min.js'
            }
        },
        qunit: {
            files: [
                'test/**/*.html',
                'test/**/*.js'
            ]
        },
        lint : {
            browser : [
                'grunt.js',
                'src/scripts/*.js',
                'src/scripts/storage/**/*.js',
                'src/scripts/util/*.js',
                'test/**/*.js',
                'src/templates/helpers/*.js'
            ],
            node : [
                'build/**/*.js',
                'tasks/**/*.js'
            ]
        },
        watch: {
            files: [
                // '<config:handlebars.src>',
                '<config:lint.browser>',
                '<config:qunit.files>'
                ],
            tasks: ['lint', 'handlebars', 'require']
        },
        jshint : {
            browser : {
                options : {
                    curly: true,
                    eqeqeq: true,
                    immed: true,
                    latedef: true,
                    newcap: true,
                    noarg: true,
                    sub: true,
                    undef: true,
                    boss: true,
                    eqnull: true,
                    browser: true
                },
                globals : {
                    JQuery: false,
                    Handlebars: false,
                    templates: false
                }
            },
            node : {
                options : {
                    esnext : true,
                    strict : false
                },
                globals : {
                    module : true,
                    require : true,
                    setTimeout : true,
                    Buffer : true,
                    process : true
                }
            }
        },
        uglify: {
            'overwrite': true,
            'unsafe': true,
            'lift-vars': true
        }
    });

    grunt.loadTasks('tasks');

    // Default task.
    grunt.registerTask('default', ['lint', 'handlebars', 'require', 'concat', 'min']);

};

When I run grunt this is the message that I get:

Warning: Task "lint" not found. Use --force to continue.

Aborted due to warnings.

And there's clearly a lint task defined in the config.

Any ideas of what might be failing?

Upvotes: 3

Views: 3096

Answers (1)

badsyntax
badsyntax

Reputation: 9650

Older versions of Grunt (v0.3) contained a set of default tasks. The eight core tasks that were included in Grunt 0.3 are now separate Grunt plugins, as of Grunt 0.4.

So the lint, concat and min tasks will need to defined. You can load these tasks using grunt.loadNpmTasks

Here's a list of plugins you can use to replace the default tasks: http://gruntjs.com/upgrading-from-0.3-to-0.4#core-tasks-are-now-grunt-plugins

Upvotes: 4

Related Questions