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
muslnode 18–226 runs
build_error
glibcnode 18–226 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)fixUpgrade Node.js to version 20 or later.
affects: >=26.0.0
breakingFlat config is now required by default (v25.0.0)fixMigrate 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.fixAdd 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).fixConsult 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.fixCheck 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).
fixRun: 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.
fixAdd 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.
fixEnsure 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.
fixRun: npm install --save-dev @eslint/js
Audit
Dependencies
gruntrequiredPeer dependency; grunt-eslint is a Grunt plugin and requires Grunt >=1 to run tasks.