gulp-coffeelint
raw JSON → 0.6.0 verified Fri May 01 auth: no javascript maintenance
Gulp plugin for CoffeeLint, version 0.6.0. It lints CoffeeScript files within a gulp pipeline, supporting custom rule files, inline options, literate CoffeeScript, and custom rules. It integrates with CoffeeLint's built-in and external reporters, and includes 'fail' and 'failOnWarning' reporters for task failure. Commonly used in legacy CoffeeScript projects, but no longer actively maintained. Key differentiators: seamless gulp integration, auto-discovery of coffeelint.json config, and per-file result properties.
Common errors
error Error: Cannot find module 'coffeelint-stylish' ↓
cause The default reporter is not installed as a dependency.
fix
Install coffeelint-stylish: npm install --save-dev coffeelint-stylish
error TypeError: coffeelint.reporter is not a function ↓
cause Forgetting to call coffeelint() before .reporter().
fix
Use .pipe(coffeelint().reporter(...)) or .pipe(coffeelint()).pipe(coffeelint.reporter(...))
error Error: Failed to load coffeelint config file coffeelint.json ↓
cause Missing or incorrect config file path.
fix
Create a valid coffeelint.json in your project root or pass optFile option.
Warnings
deprecated CoffeeScript and CoffeeLint are largely obsolete; consider migrating to JavaScript/TypeScript with ESLint. ↓
fix Migrate to ESLint or similar.
gotcha When using 'fail' reporter, ensure the stream is returned from the task, otherwise gulp may not detect failure. ↓
fix Always return the stream from the gulp task (e.g., 'return gulp.src(...).pipe(...)').
gotcha Custom reporters must follow CoffeeLint's reporter interface (constructor and publish method). ↓
fix Implement a constructor accepting an errorReport and a publish method.
Install
npm install gulp-coffeelint yarn add gulp-coffeelint pnpm add gulp-coffeelint Imports
- gulp-coffeelint wrong
import coffeelint from 'gulp-coffeelint';correctconst coffeelint = require('gulp-coffeelint');
Quickstart
const gulp = require('gulp');
const coffeelint = require('gulp-coffeelint');
gulp.task('lint', function() {
return gulp.src('./src/*.coffee')
.pipe(coffeelint())
.pipe(coffeelint.reporter('coffeelint-stylish'))
.pipe(coffeelint.reporter('fail'));
});