Thursday, 16 May 2019

Troubles with using gulp-eslint

Im trying to add gulp-eslint to my build process, having gulp watch my files and run eslint whenever a file is changed. However, I am getting an error that says:

D:\code\project\node_modules\gulp-eslint\index.js:4
const {CLIEngine} = require('eslint');
  ^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (D:\code\project\gulpfile.js:5:16)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)

when I try to run the ESLint task that I wrote.

Here is the code for the eslint task:

gulp.task('eslint', () => {

   return gulp.src(lintscripts)

    .pipe(eslint({
        "env": {
            "browser": true,
            "node": true,
            "commonjs": true,
            "es6": true
        },
        "extends": "eslint:recommended",
        "parserOptions": {
            "sourceType": "module",
            "ecmaVersion": 2017
        },
        "rules": {
            'no-console': 'off',
            'indent' : 'off',
            "semi": [
                "error",
                "always"
            ]
        }
    })).pipe(eslint.format());

});



from Troubles with using gulp-eslint

No comments:

Post a Comment