javascript - gulp-eslint not throwing any error on console -
i working gulp
, reactjs
. have added eslint
static analysing of code. using gulp-eslint
follows:
var eslint = require('gulp-eslint'); gulp.task('eslint', function() { // process script files, ignore npm_modules gulp.src(['widgets/**/*.js', 'server/**/*.js', '!node_modules/**']) .pipe(eslint.format()) .pipe(eslint.failaftererror());
my .eslintrc
file :
{ "parser": "babel-eslint", "plugins": [ "react" ], "parseroptions": { "ecmaversion": 6, "sourcetype": "module", "ecmafeatures": { "jsx": true } }, "extends": ["eslint:recommended", "plugin:react/recommended"], "env": { "browser": true, "amd": true, "es6": true, "node": true, "mocha": true }, "rules": { "comma-dangle": 1, "quotes": [ 1, "single" ], "no-undef": 1, "global-strict": 0, "no-extra-semi": 1, "no-underscore-dangle": 0, "no-console": 1, "no-unused-vars": 1, "no-trailing-spaces": [1, { "skipblanklines": true }], "no-unreachable": 1, "no-alert": 0, "react/jsx-uses-react": 1, "react/jsx-uses-vars": 1 } }
but, if have trailing spaces , alerts in code, won't show error on console. is:
starting 'eslint'... finished 'eslint' after 1.97 s
the directory structure is:
root/ node_modules widgets //contains js files server //contains js files .eslintrc gulpfile.js package.json
you've forgot pipe estlint()
properly. try:
var eslint = require('gulp-eslint'); gulp.task('eslint', function() { // process script files, ignore npm_modules gulp.src(['widgets/**/*.js', 'server/**/*.js', '!node_modules/**']) .pipe(eslint({ useeslintrc: true })) .pipe(eslint.format()) .pipe(eslint.failaftererror());
Comments
Post a Comment