I have several npm modules for which I would like to use the general linting configuration. I have jshint and clinter linter working on the same project through Grunt. But copying / pasting a .jshintignore and .jshintrc file for each project will be cumbersome, especially when something needs to be changed. Therefore, ideally, I would like to have one grunt task that encapsulates the general configuration and can be loaded via
grunt.loadNpmTasks('grunt-mysuperlint');
Where grunt-my-common-lint-tasks are the really specific default configurations for jshint and linter.
But I do not see the possibility of creating two existing grunt plugins in one, where the only real composition is the merging of options and goals.
Is it possible?
I should do something like:
grunt.registerMultiTask('mysuperlint', function() { // Manual options merging? var opts = this.options({ jshint: { src: 'scripts/**/*.js', options: { ... } }, closureLinter: { src: 'scripts/**/*.js', options: { ... } } }); grunt.config.set('jshint.dev', opts.jshint); grunt.config.set('closureLinter.dev', opts.closureLinter); grunt.task.run('jshint:dev'); grunt.task.run('closureLinter:dev'); });
Any help or pointers would be really appreciated.
source share