Validate files with ESLint
$ npm install --save-dev grunt-eslint
require('load-grunt-tasks')(grunt);
grunt.initConfig({
eslint: {
target: ['file.js']
}
});
grunt.registerTask('default', ['eslint']);
grunt.initConfig({
eslint: {
options: {
configFile: 'conf/eslint.json',
rulePaths: ['conf/rules']
},
target: ['file.js']
}
});
grunt.initConfig({
eslint: {
options: {
format: require('eslint-tap')
},
target: ['file.js']
}
});
See the ESLint options.
In addition the following options are supported:
Type: string
Default: 'stylish'
Name of a built-in formatter or path to a custom one.
Some formatters you might find useful: eslint-json, eslint-tap.
Type: string
Default: ''
Output the report to a file.
Type: boolean
Default: false
Report errors only.
Type: number
Default: -1
(Means no limit)
Number of warnings to trigger non-zero exit code.
Type: boolean
Default: true
Fail the build if ESLint found any errors.