ESLint doesn't exit on failOnError();
See original GitHub issueSo I’m creating gulp tasks dynamically like this
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var apps = require('../config').browserify;
var createPaths = require('../helpers/create-paths');
var lintTasks = [];
var watchLintTasks = [];
var lint = function( project ) {
return function() {
var srcFiles = createPaths.watchPath(project, 'js');
return gulp.src(srcFiles)
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
};
};
apps.map(function(app){
lintTasks.push('lint:' + app);
watchLintTasks.push('watch:lint:' + app);
gulp.task('lint:' + app, lint(app));
gulp.task('watch:lint:' + app, function(){
gulp.watch(createPaths.watchPath(app, 'js'), ['lint:'+ app]);
});
});
gulp.task('lintScripts', lintTasks);
gulp.task('watch:lintScripts', watchLintTasks);
And then in my build task I’m running gulp.task('build', ['lintScripts', ...]);
When I run gulp build
it doesn’t exit on errors I tried many solutions from #12 but still not exiting when it fails any idea how to fix this?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
no-process-exit - ESLint - Pluggable JavaScript Linter
The process.exit() method in Node.js is used to immediately stop the Node.js ... This doesn't give the application any chance to respond to...
Read more >Gulp eslint doesn't find my .eslintrc file - Stack Overflow
According to the docs you need to fail on error in the pipe. gulp.task('lint', function () { // ESLint ignores files with "node_modules"...
Read more >Compiling CSS breaks/stops when an eslint rule is broken
Personally, I think stylelint is just kind of janky like this. My recommendation is to disable stylelint-webpack-plugin 's failOnError in development: app.
Read more >A gulp plugin for processing files with ESLint
failOnError() Stop a task/stream if an ESLint error has been reported for any file. ```javascript // Cause the stream to stop(/fail) before copying...
Read more >@zebrajaeger/gulp-eslint - npm
formatEach() (see Docs). .pipe(eslint.format()) // To have the process exit with an error code (1) on // lint error, return the stream and ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m having this same issue when running the lint task from a watch task.
In my gulpfile.js
The command lint reruns, but doesn’t even report, let alone exit on, errors.
It looks like you’re running your lint and build tasks in parallel. If you want tasks to wait for the
lintScripts
task to pass (and not run if it fails), make sure those tasks are dependent onlintScripts
(gulp will keep.Here’s an example of tasks running in (dependency) sequence:
Otherwise, your code works fine for me (with a bit of a guess at what
createPaths.watchPath
does); though, because all the linting happens in parallel, the process may get more than one error before exiting with a code of 1. One way to control that is to merge the the streams betweeneslint()
andeslint.format()
(can provide detail, if interested).