Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sindresorhus/grunt-eslint
Validate files with ESLint
https://github.com/sindresorhus/grunt-eslint
eslint grunt-plugin linter nodejs npm-package
Last synced: 4 days ago
JSON representation
Validate files with ESLint
- Host: GitHub
- URL: https://github.com/sindresorhus/grunt-eslint
- Owner: sindresorhus
- License: mit
- Created: 2013-07-14T12:32:03.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2024-04-11T11:20:20.000Z (9 months ago)
- Last Synced: 2024-12-17T19:26:49.456Z (8 days ago)
- Topics: eslint, grunt-plugin, linter, nodejs, npm-package
- Language: JavaScript
- Homepage:
- Size: 128 KB
- Stars: 200
- Watchers: 9
- Forks: 72
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
- License: license
- Security: .github/security.md
Awesome Lists containing this project
README
# grunt-eslint
> Validate files with [ESLint](https://eslint.org)
![](screenshot.png)
## Install
```sh
npm install --save-dev grunt-eslint
```## Usage
```js
require('load-grunt-tasks')(grunt);grunt.initConfig({
eslint: {
target: ['file.js']
}
});grunt.registerTask('default', ['eslint']);
```## Examples
### Custom config and rules
```js
const noAlertRule = require('./conf/rules/no-alert');grunt.initConfig({
eslint: {
options: {
overrideConfigFile: 'conf/eslint.js',
plugins: {
noAlertRule
}
},
target: ['file.js']
}
});
```### Custom formatter
```js
grunt.initConfig({
eslint: {
options: {
format: './node_modules/eslint-tap/index.js'
},
target: ['file.js']
}
});
```## Options
See the [ESLint options](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions).
In addition the following options are supported:
### format
Type: `string`\
Default: `'stylish'`The name of a [built-in formatter](https://github.com/eslint/eslint/tree/master/lib/cli-engine/formatters) or path to a custom one.
Some formatters you might find useful: [eslint-json](https://github.com/sindresorhus/eslint-json), [eslint-tap](https://github.com/sindresorhus/eslint-tap).
### outputFile
Type: `string`\
Default: `''`Output the report to a file.
### quiet
Type: `boolean`\
Default: `false`Report errors only.
### maxWarnings
Type: `number`\
Default: `-1` *(Means no limit)*The nmber of warnings to trigger non-zero exit code.
### failOnError
Type: `boolean`\
Default: `true`Fail the build if ESLint found any errors.