# grunt-eslint

> Validate files with ESLint

Latest version **27.0.0** (published 2026-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install grunt-eslint
pnpm add grunt-eslint
yarn add grunt-eslint
bun add grunt-eslint
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 27.0.0 |
| Published | 2026-08-25 |
| First published | 2013-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=22 |
| Dependencies | 2 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 201 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | gruntplugin, eslint, lint, validate, report |

## Links

- npm: https://www.npmjs.com/package/grunt-eslint
- Repository: https://github.com/sindresorhus/grunt-eslint
- Homepage: https://github.com/sindresorhus/grunt-eslint#readme
- Issues: https://github.com/sindresorhus/grunt-eslint/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/grunt-eslint

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^6.0.0
- [eslint](https://npm.io/package/eslint.md) ^10.9.1

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 27.0.0 (latest) — 2026-08-25
- 26.0.0 — 2025-09-10
- 25.0.0 — 2024-04-11
- 24.3.0 — 2023-07-14
- 24.2.0 — 2023-06-23
- 24.1.0 — 2023-05-09
- 24.0.1 — 2022-12-04
- 24.0.0 — 2021-10-15
- 23.0.0 — 2020-05-18
- 22.0.0 — 2019-06-30
- 21.1.0 — 2019-06-12
- 21.0.0 — 2018-06-23
- 20.2.0 — 2018-06-09
- 20.1.0 — 2017-08-31
- 20.0.0 — 2017-06-13
- … 44 more at https://npm.io/package/grunt-eslint/versions

## 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']
	}
});
```

### Using shared configs

```js
const js = require('@eslint/js');

grunt.initConfig({
	eslint: {
		options: {
			extends: [js.configs.recommended]
		},
		target: ['file.js']
	}
});
```

### Custom formatter

```js
grunt.initConfig({
	eslint: {
		options: {
			format: './node_modules/eslint-tap/index.js'
		},
		target: ['file.js']
	}
});
```

### Output to both console and file

```js
grunt.initConfig({
	eslint: {
		options: {
			outputFile: 'eslint-results.xml',
			format: 'checkstyle'
		},
		target: ['file.js']
	}
});
```

This will output in checkstyle format to both the console and `eslint-results.xml`. To suppress console output and only write to the file, add `silent: true`.

### Using feature flags

```js
grunt.initConfig({
	eslint: {
		options: {
			flags: ['v10_config_lookup_from_file']
		},
		target: ['../project1/scripts/**/*.js']
	}
});
```

## Options

See the [ESLint options](https://eslint.org/docs/developer-guide/nodejs-api#-new-eslintoptions).

In addition the following options are supported:

### extends

Type: `array` | `object`

*Requires ESLint 9.22+*

Shareable configs to extend.

### flags

Type: `array`

[Feauture flags](https://eslint.org/docs/latest/flags/) to pass to ESLint.

### 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. When specified, the report is written to both the console and the file unless `silent` is true.

### quiet

Type: `boolean`\
Default: `false`

Report errors only.

### silent

Type: `boolean`\
Default: `false`

Suppress console output. When used with `outputFile`, only writes to the file.

### maxWarnings

Type: `number`\
Default: `-1` *(Means no limit)*

The number of warnings to trigger non-zero exit code.

### failOnError

Type: `boolean`\
Default: `true`

Fail the build if ESLint found any errors.

---
_Source: https://npm.io/package/grunt-eslint · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
