gulp-eslint-if-fixed
raw JSON → 1.0.0 verified Sat Apr 25 auth: no javascript
A Gulp plugin helper that filters files that were fixed by ESLint's fix option, allowing you to write fixed files back to source. Current version 1.0.0, no release cadence. Differentiates from plain gulp-eslint by providing a way to only output files that were actually modified during linting, enabling a streamlined fix pipeline without manual change detection.
Common errors
error TypeError: eslintIfFixed is not a function ↓
cause Importing the module incorrectly (e.g., as a named export or using ES import).
fix
Use const eslintIfFixed = require('gulp-eslint-if-fixed');
error Error: write after end ↓
cause Using the plugin with a stream that has already ended, often due to asynchronous processing.
fix
Ensure the plugin is placed after eslint({fix:true}) and not in a branch or after a destructive pipe.
Warnings
gotcha The plugin does not work with the async/await or promise-based Gulp APIs (gulp 4+). It expects streams. ↓
fix Ensure you are using gulp.src() with stream mode; avoid using gulp.lastRun or async functions.
gotcha The 'src' argument passed to eslintIfFixed must match the base directory of your Gulp source files, else fixed files may be written to incorrect paths. ↓
fix Use gulp.src with {base: '.'} or the same base as expected by eslintIfFixed.
deprecated Package has not been updated since 2016 and may not work with newer versions of ESLint or Gulp. ↓
fix Consider using gulp-eslint's built-in 'fix' feature or updating to a more maintained alternative.
Install
npm install gulp-eslint-if-fixed yarn add gulp-eslint-if-fixed pnpm add gulp-eslint-if-fixed Imports
- eslintIfFixed wrong
import eslintIfFixed from 'gulp-eslint-if-fixed'correctconst eslintIfFixed = require('gulp-eslint-if-fixed') - default wrong
const { eslintIfFixed } = require('gulp-eslint-if-fixed')correctconst eslintIfFixed = require('gulp-eslint-if-fixed')
Quickstart
const gulp = require('gulp');
const eslint = require('gulp-eslint');
const eslintIfFixed = require('gulp-eslint-if-fixed');
gulp.task('lint-fix', function() {
return gulp.src('src/*.js')
.pipe(eslint({ fix: true }))
.pipe(eslint.format())
.pipe(eslintIfFixed('src'));
});