Skip to content

Instantly share code, notes, and snippets.

@couto
Last active November 25, 2015 15:53
Show Gist options
  • Save couto/f5a6439a2faee0149f79 to your computer and use it in GitHub Desktop.
Save couto/f5a6439a2faee0149f79 to your computer and use it in GitHub Desktop.
gulp-eslint simple example
const gulp = require('gulp');
const eslint = require('gulp-eslint');
gulp.task('lint', function () {
return gulp.src(['**/*.js','!node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('default', ['lint']);
const awesome = () => console.log(`who's awesome? you're awesome`);
{
"name": "eslint",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-eslint": "^1.1.1"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "gulp lint"
},
"keywords": [],
"author": "",
"license": "ISC"
}
/tmp/eslint 46s
❯ npm run lint
> [email protected] lint /private/tmp/eslint
> gulp lint
[15:49:58] Using gulpfile /private/tmp/eslint/gulpfile.js
[15:49:58] Starting 'lint'...
[15:49:59]
gulpfile.js
1:2 error Parsing error: Unexpected token const
index.js
1:2 error Parsing error: Unexpected token const
✖ 2 problems (2 errors, 0 warnings)
[15:49:59] 'lint' errored after 453 ms
[15:49:59] ESLintError in plugin 'gulp-eslint'
Message:
Failed with 2 errors
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/couto/.nvm/versions/node/v5.1.0/bin/node" "/Users/couto/.nvm/versions/node/v5.1.0/bin/npm" "run" "lint"
npm ERR! node v5.1.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] lint: `gulp lint`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] lint script 'gulp lint'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the eslint package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp lint
npm ERR! You can get their info via:
npm ERR! npm owner ls eslint
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /private/tmp/eslint/npm-debug.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment