gulp-eslint

raw JSON →
6.0.0 verified Sat Apr 25 auth: no javascript maintenance

A gulp plugin for ESLint, version 6.0.0, compatible with ESLint 6. It provides a streamlined way to integrate ESLint into gulp task pipelines, offering functions like eslint(), eslint.format(), eslint.formatEach(), eslint.failAfterError(), and eslint.failOnError(). Key differentiators include seamless integration with gulp streams, support for ESLint's fix and quiet options, and the ability to fail the build on lint errors. Released under MIT license, with no new versions since 2019, indicating maintenance mode.

error TypeError: CLIEngine is not a constructor
cause gulp-eslint v6 is incompatible with ESLint 7+ because CLIEngine was removed.
fix
Downgrade to ESLint 6.x or use a compatible fork like @bigfishtv/gulp-eslint.
error Error: Failed to load config "airbnb" to extend from.
cause Missing ESLint config package (e.g., eslint-config-airbnb) not installed.
fix
Install the required config package: npm install eslint-config-airbnb --save-dev.
error Warning: No rules configuration provided. Using default rules.
cause No .eslintrc file or inline config passed to eslint() options.
fix
Create a .eslintrc.json file or pass rules in options: eslint({ rules: { 'no-unused-vars': 2 } }).
breaking gulp-eslint v6 requires ESLint 6.x. ESLint 7+ not supported.
fix Use ESLint 6.x or upgrade to a newer gulp-eslint fork (e.g., @bigfishtv/gulp-eslint).
deprecated CLIEngine is deprecated in ESLint 7+. gulp-eslint v6 uses CLIEngine internally.
fix Switch to @bigfishtv/gulp-eslint which uses ESLint's new API, or use gulp-eslint-new.
gotcha eslint.failAfterError() must be the last plugin in the stream to work correctly.
fix Ensure .pipe(eslint.failAfterError()) is the final .pipe() call before returning the stream.
gotcha When using eslint.format(), results are printed to stdout. Use eslint.formatEach('compact', process.stderr) to output to stderr.
fix Pass format name and output stream as arguments to formatEach().
npm install gulp-eslint
yarn add gulp-eslint
pnpm add gulp-eslint

Basic gulp task using gulp-eslint to lint JavaScript files, output results, and fail on errors.

const gulp = require('gulp');
const eslint = require('gulp-eslint');

gulp.task('lint', () => {
  return gulp.src(['scripts/**/*.js'])
    .pipe(eslint({ configFile: '.eslintrc.json' }))
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
});