Registry / testing / grunt-eslint

grunt-eslint

JSON →
library26.0.0jsnpmunverified

Grunt plugin to validate JavaScript files using ESLint. Current stable version is 26.0.0 (requires Node.js 20+ and Grunt >=1). Releases are feature-driven with major version bumps when ESLint or Node.js requirements change. Key differentiators: seamless integration with Grunt, supports both flat and legacy ESLint configs (flat is default since v25), dual console and file output (v26+), and feature flags for experimental ESLint features. Maintained by Sindre Sorhus with regular updates across major ESLint versions (6, 7, 8, 9).

npm install grunt-eslint
INSTALL
IMPORT
SIG · GRUNT-ESLINT
G
grunt-eslint
testingjavascriptv26.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

grunt-eslint (Grunt task)
grunt.initConfig({ eslint: { target: ['file.js'] } });
grunt.config('eslint', { options: {} });
The grunt-eslint package does not export any symbols; it registers the 'eslint' Grunt task. Use grunt.loadNpmTasks('grunt-eslint') or a loader like load-grunt-tasks.
load-grunt-tasks (optional loader)
require('load-grunt-tasks')(grunt);
grunt.loadTasks('node_modules/grunt-eslint/tasks');
load-grunt-tasks is a convenience package that auto-loads all grunt plugins. It's not required but commonly used.
ESLint config (flat config)
grunt.initConfig({ eslint: { options: { extends: [js.configs.recommended] } }, target: ['file.js'] });
grunt.initConfig({ eslint: { options: { configFile: '.eslintrc' } }, target: ['file.js'] });
Since v25, flat config is the default. Use 'extends' option with an array of configs. For legacy configs, set ESLINT_USE_FLAT_CONFIG environment variable to false.

Gruntfile.js example: registers eslint task, configures with recommended flat config, lints source and test JS files, runs via 'grunt lint' or 'grunt'.

// Install: npm install --save-dev grunt-eslint module.exports = function(grunt) { require('load-grunt-tasks')(grunt); grunt.initConfig({ eslint: { options: { extends: [require('@eslint/js').configs.recommended], format: 'stylish', quiet: false, maxWarnings: -1, failOnError: true }, target: ['src/**/*.js', 'test/**/*.js'] } }); grunt.registerTask('lint', ['eslint']); grunt.registerTask('default', ['lint']); };
Debug
Known issues
breakingRequires Node.js 20+ (v26.0.0)
fix
Upgrade Node.js to version 20 or later.
affects: >=26.0.0
breakingFlat config is now required by default (v25.0.0)
fix
Migrate to flat config (e.g., use 'extends' option) or set ESLINT_USE_FLAT_CONFIG=false environment variable to use non-flat config (legacy).
affects: >=25.0.0
gotchaoutputFile option now also outputs to console (v26.0.0). Use silent: true to suppress console output.
fix
Add silent: true to options if you want output only to file (old behavior).
affects: >=26.0.0
breakingUpgrade to ESLint 8 (v24.0.0): some options changed (e.g., configFile renamed to overrideConfigFile).
fix
Consult ESLint 8 documentation for options. In v24, overrideConfigFile replaces configFile. For v25+, use flat config 'extends'.
affects: >=24.0.0 <25.0.0
gotchaOptions not documented in grunt-eslint README may have changed across ESLint versions. Always refer to ESLint Node.js API docs for available options.
fix
Check https://eslint.org/docs/developer-guide/nodejs-api for current ESLint options.
affects: >=24.0.0
Errors
Common errors & fixes
Loading "grunt-eslint.js" tasks...ERROR >> Error: Cannot find module 'eslint'
ESLint is not installed as a dependency (grunt-eslint does not include eslint internally; it must be installed separately).
fix
Run: npm install --save-dev eslint
Warning: Task "eslint" not found. Use --force to continue.
grunt-eslint not loaded; missing grunt.loadNpmTasks('grunt-eslint') or equivalent autoloader.
fix
Add grunt.loadNpmTasks('grunt-eslint'); to Gruntfile, or use a task loader like load-grunt-tasks.
Fatal error: Invalid options in eslint task. Expected a configuration object, but got something else.
Incorrect Grunt configuration; options for eslint are not properly nested under the target.
fix
Ensure structure: grunt.initConfig({ eslint: { options: { ... }, target: ['files'] } });
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@eslint/js'
Flat config requires @eslint/js package for recommended configs, but it's not installed.
fix
Run: npm install --save-dev @eslint/js
Upgrade
Version history
26.0.0latest on npm
Audit
Dependencies
gruntrequiredPeer dependency; grunt-eslint is a Grunt plugin and requires Grunt >=1 to run tasks.
Agent activity
4 hits · last 30 days
node
4
Resources
grunt-eslint — npm install grunt-eslint · libregistry