adametry / gulp-eslint Goto Github PK
View Code? Open in Web Editor NEWA Gulp plugin for identifying and reporting on patterns found in ECMAScript/JavaScript code.
License: MIT License
A Gulp plugin for identifying and reporting on patterns found in ECMAScript/JavaScript code.
License: MIT License
Is there a reason, that gulp-eslint
have fixed gulp version in peerDependencies?
I stumbled upon a very strange issue with gulp-eslint. I started working on a new project and as I kept adding new files eslint stopped reporting any issues at some point.
So I tried to reduce test case and came up with following:
Gulpfile.js:
var gulp = require('gulp'),
debug = require('gulp-debug'),
eslint = require('gulp-eslint');
gulp.task('lint', function() {
gulp.src('./src/js/**/*.js')
.pipe(debug())
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('default', ['lint']);
In ./src/js I have 16 identical files with following contents:
'use strict';
{
If I run gulp I will get 16 "Unexpected end of input" errors (as I should):
λ gulp
[15:09:42] Using gulpfile E:\tmp\eslint-test\gulpfile.js
[15:09:42] Starting 'lint'...
[15:09:42] Finished 'lint' after 19 ms
[15:09:42] Starting 'default'...
[15:09:42] Finished 'default' after 7.6 μs
[15:09:42] gulp-debug: src\js\1.js
[15:09:42] gulp-debug: src\js\10.js
[15:09:42] gulp-debug: src\js\11.js
[15:09:42] gulp-debug: src\js\12.js
[15:09:42] gulp-debug: src\js\13.js
[15:09:42] gulp-debug: src\js\14.js
[15:09:42] gulp-debug: src\js\15.js
[15:09:42] gulp-debug: src\js\16.js
[15:09:42] gulp-debug: src\js\2.js
[15:09:42] gulp-debug: src\js\3.js
[15:09:42] gulp-debug: src\js\4.js
[15:09:42] gulp-debug: src\js\5.js
[15:09:43] gulp-debug: src\js\6.js
[15:09:43] gulp-debug: src\js\7.js
[15:09:43] gulp-debug: src\js\8.js
[15:09:43] gulp-debug: src\js\9.js
[15:09:43] gulp-debug: 16 items
[15:09:43]
E:\tmp\eslint-test\src\js\1.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\10.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\11.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\12.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\13.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\14.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\15.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\16.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\2.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\3.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\4.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\5.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\6.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\7.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\8.js
4:1 error Unexpected end of input
E:\tmp\eslint-test\src\js\9.js
4:1 error Unexpected end of input
✖ 16 problems (16 errors, 0 warnings)
But as soon as I add one more file:
cp src/js/1.js src/js/17.js
I no longer get any reports from eslint:
λ gulp
[15:10:11] Using gulpfile E:\tmp\eslint-test\gulpfile.js
[15:10:11] Starting 'lint'...
[15:10:11] Finished 'lint' after 23 ms
[15:10:11] Starting 'default'...
[15:10:11] Finished 'default' after 6.46 μs
[15:10:11] gulp-debug: src\js\1.js
[15:10:11] gulp-debug: src\js\10.js
[15:10:11] gulp-debug: src\js\11.js
[15:10:11] gulp-debug: src\js\12.js
[15:10:11] gulp-debug: src\js\13.js
[15:10:11] gulp-debug: src\js\14.js
[15:10:11] gulp-debug: src\js\15.js
[15:10:11] gulp-debug: src\js\16.js
[15:10:11] gulp-debug: src\js\17.js
[15:10:11] gulp-debug: src\js\2.js
[15:10:11] gulp-debug: src\js\3.js
[15:10:11] gulp-debug: src\js\4.js
[15:10:11] gulp-debug: src\js\5.js
[15:10:11] gulp-debug: src\js\6.js
[15:10:11] gulp-debug: src\js\7.js
[15:10:11] gulp-debug: src\js\8.js
[15:10:11] gulp-debug: src\js\9.js
[15:10:11] gulp-debug: 17 items
I have discovered that in latter case the flushFunction through2 parameter in the gulpEslint.format function is not being called. I tried replacing through with Node's PassThrough:
var stream = require('stream');
gulpEslint.format = function(formatter, writable) {
var results = [];
formatter = util.resolveFormatter(formatter);
writable = util.resolveWritable(writable);
return new stream.PassThrough({objectMode: true})
.on('data', function(file) {
if (file.eslint) {
results.push(file.eslint);
}
})
.on('end', function() {
if (results.length) {
util.writeResults(results, formatter, writable);
}
});
};
And it worked, and keeps working as many new files I add.
Is this a valid fix? I can create a PR if it is..
For most modules I use the workflow is:
var module = require('gulp-module');
// some task
gulp.src(files).pipe(module()); //done
I tried this for gulp-eslint as well but this produces no output and no warnings or errors which seem to indicate a defective module so I quickly gave up. The first example in the README did specify eslint.format() but I thought it was just a weird configuration option like eslint.failOnError() listed below it.
Why are these separate streams instead of configuration options on the eslint module? The expected scenario would then become:
var eslint= require('gulp-eslint');
// some task
gulp.src(files)
.pipe(eslint({
format: "each",
failOnError: "true",
}); //done
These options would also be sensible defaults. If I want it to fail on an error I don't really want to do anything else in the task anyway.
{
"parser": "foo-bar"
}
Does not thrown any error. Also, it would be useful if output would tell what parser is being used.
It silently ignores error:
Cannot find module 'foo-bar'
I am new to gulp, so sorry in advance for this maybe silly question.
I will generate a checkstyle report of eslint a save it in a xml file. But i am not sure how the output option in format() works. Here is my example:
gulp.task('checkstyle', function () {
gulp.src(src)
.pipe(eslint())
.pipe(eslint.format('checkstyle', require('fs').createWriteStream('.reports/eslint_checkstyle.xml')))
.pipe(eslint.failAfterError());
});
This works fine as long as the .reports folder exist. Otherwise i get an error that the directory not exists. But i did not found a gulp plugin which can create a directory. I know that gulp.dest()
creates directories automatically. But i don't know if i can use gulp.dest()
in this scenario.
So should i use plain node.js to create the directory before the task runs? Or is there a more elegant solution using gulp?
Thanks.
To track testing jsx support, it would be nice to create a branch with eslint dependence in v0.11.0-alpha.0 ?!
would be nice to update packages as some of them rather old
"eslint": "^0.9.2" vs current 0.10.2
it leads to some problems with Webstorm IDE and total failure on some not trivial setups due to wrong path resolution in the eslint 0.9.*
just to check I've manually corrected the version of eslint in your package.json and all problems have dissapeared
Node v.11.13, gulp-eslint 0.1.8
var conf = {
// rulesdir : "custom-rules/",
rules: {
"no-use-before-define": [0, "nofunc"],
"curly": 1,
"no-comma-dangle": 1,
"no-debugger": 1,
"eol-last": 0,
"new-cap": 1,
},
globals: {
// "jQuery": false,
// "$": true
},
env: {
browser: true,
node: true
}
};
gulp.src(["./src/**.js", "!./src/classList.js"])
// .pipe(plugins.plumber())
.pipe(eslint(conf))
// .pipe(eslint.failOnError())
.pipe(eslint.formatEach("stylish", process.stdout));
stream.js
throw er; // Unhandled stream error in pipe.
^
TypeError: Cannot read property 'range' of null
at EventEmitter.module.exports.api.getTokenBefore (\node_modules\gulp-eslint\node_modules\eslint\lib\eslint.js:837:31)
at RuleContext.(anonymous function) [as getTokenBefore] (\node_modules\gulp-eslint\node_modules\eslint\lib\rule-context.js:69:33)
at checkList (\node_modules\gulp-eslint\node_modules\eslint\lib\rules\no-multi-spaces.js:141:36)
at EventEmitter.ArrayExpression (\node_modules\gulp-eslint\node_modules\eslint\lib\rules\no-multi-spaces.js:163:13)
at EventEmitter.emit (events.js:129:20)
at Controller.controller.traverse.enter (\node_modules\gulp-eslint\node_modules\eslint\lib\eslint.js:634:25)
at Controller.__execute (\node_modules\gulp-eslint\node_modules\eslint\node_modules\estraverse\estraverse.js:318:31)
at Controller.traverse (\node_modules\gulp-eslint\node_modules\eslint\node_modules\estraverse\estraverse.js:394:28)
at EventEmitter.module.exports.api.verify (\node_modules\gulp-eslint\node_modules\eslint\lib\eslint.js:627:24)
at verify (\node_modules\gulp-eslint\index.js:22:32)
at \node_modules\gulp-eslint\index.js:40:18
It's really cool to break the processs when there's an error in order not to push it in production but when I'm doing a "watch", I don't want a fail on error. Is it possible?
It looks like ESLint have changed the configuration file location key from config
to configFile
meaning that with the latest versions of ESLint the config
key does nothing.
Its easy enough to fix but I was wondering if I could make a PR that dropped the idea of creating a config object in gulp-eslint. In essence if the user provides an object it's up to them to look at the ESLint Config
class and figure out what properties to set on the config object as that object will be passed straight to Config
, this will simplify your documentation and would have allowed me to fix this issue myself by just passing in the correct properties and values.
What do you think?
So 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?
When I try to set 'ecmaFeatures' explicitly, the option doesn't seem to pass through:
.pipe(eslint(
{
ecmaFeatures: { templateStrings: true },
// envs: [ 'es6' ]
}
))
Result:
5524:21 error Unexpected token ILLEGAL
Removing the comment doesn't produce this error. Happy to do a pull request if this is actually an issue.
This would be nice as it would mean that the versions between gulp-eslint and the eslint module installed globally would not differentiate.
With key-spacing
-> "align": "colon"
param:
"key-spacing": [1, {
"align": "colon",
"beforeColon": false,
"afterColon": true
}]
↓
eslint/lib/rules/key-spacing.js:217
widths = properties.map(getKeyWidth), // Width of keys, including
^
TypeError: Object #<Object> has no method 'map'
Eslint cli works fine.
It just outputs the error message and a stack trace:
/Users/ed/dev/go/src/github.com/coreos-inc/roller/cp/node_modules/gulp-eslint/node_modules/map-stream/index.js:103
throw err
^
ESLintError in plugin 'gulp-eslint'
Strings must use singlequote.
at /Users/ed/dev/go/src/github.com/coreos-inc/roller/cp/node_modules/gulp-eslint/index.js:67:13
at Array.some (native)
at /Users/ed/dev/go/src/github.com/coreos-inc/roller/cp/node_modules/gulp-eslint/index.js:58:12
at wrappedMapper (/Users/ed/dev/go/src/github.com/coreos-inc/roller/cp/node_modules/gulp-eslint/node_modules/map-stream/index.js:84:19)
at Stream.stream.write (/Users/ed/dev/go/src/github.com/coreos-inc/roller/cp/node_modules/gulp-eslint/node_modules/map-stream/index.js:96:21)
at Stream.ondata (stream.js:51:26)
at Stream.EventEmitter.emit (events.js:95:17)
at queueData (/Users/ed/dev/go/src/github.com/coreos-inc/roller/cp/node_modules/gulp-eslint/node_modules/map-stream/index.js:43:21)
at next (/Users/ed/dev/go/src/github.com/coreos-inc/roller/cp/node_modules/gulp-eslint/node_modules/map-stream/index.js:71:7)
at /Users/ed/dev/go/src/github.com/coreos-inc/roller/cp/node_modules/gulp-eslint/node_modules/map-stream/index.js:85:7
I'm depending on this to be a peer of eslint:
"eslint-plugin-react": "^2.0.2",
Otherwise, I get errors like this:
/Users/justin/j/react/react-webpack-rails-tutorial/client/assets/javascripts/Comment.jsx
3:0 error 'import' and 'export' may appear only with 'sourceType: module'
You can reproduce this issue with this repo:
https://github.com/justin808/react-webpack-rails-tutorial
And running gulp lint
Compare to running the bin/lint
script.
Basically, the issue comes down to how should sibling eslint dependencies be handled.
Any chance on making dependencies like eslint a peerDependency so that they can be upgraded separately?
Not sure if this is on purpose, but if you use checkstyle
in your format, it outputs a string of xml instead of a formatted table.
[17:06:48] Starting 'lint'...
<?xml version="1.0" encoding="utf-8"?><checkstyle version="4.3"><file name="/Users/mhartington/GitHub/ionic-sf-demos/eslint/www/js/app.js"></file><file name="/Users/mhartington/GitHub/ionic-sf-demos/eslint/www/js/controllers.js"><error line="3" column="33" severity="error" message="$scope is defined but never used (no-unused-vars)" /><error line="9" column="3" severity="error" message="Missing semicolon. (semi)" /></file><file name="/Users/mhartington/GitHub/ionic-sf-demos/eslint/www/js/services.js"><error line="12" column="3" severity="error" message="A space is required after ','. (comma-spacing)" /></file></checkstyle>[17:06:49] Finished 'lint' after 129 ms
As mentioned, not sure if this is on purpose, or an issue.
Cheers
Hey there. I've been banging my head against the wall with this for some time now. The rulesPaths
option does not seem to want to load my custom rules. 'eslint/custom-rules'
is a directory with a single custom rule, as defined in the custom config file. The rulesdir
option has the same behavior. I only noticed this after I updated gulp-eslint to version 0.4.2. Any help or insight would be appreciated. Thanks.
Task:
gulp.task('lint:js', function() {
return gulp.src(config.paths.src.js)
.pipe(eslint({
configFile: 'eslint/config.json',
rulesPaths: ['eslint/custom-rules'],
globals: {
'angular': false,
'jQuery': false
},
useEslintrc: false
}))
.pipe(eslint.format());
});
Error:
/node_modules/gulp-eslint/node_modules/eslint/lib/eslint.js:603
throw new Error("Definition for rule '" + key + "' was not
^
Error: Definition for rule 'custom-no-multi-space' was not found.
config.json
...
"no-multi-spaces": 0,
"custom-no-multi-space": 2,
"no-native-reassign": 2,
...
If an eslint plugin specifies eslint as a peer dependency, npm can check that a compatible version of eslint is installed, but the extra copy of eslint installed under gulp-eslint is hidden from this check, so there is risk of plugins being run with an incompatible eslint version.
If both gulp-eslint and the plugins specify eslint as a peer dependency, both will use the same version, and npm will flag incompatibilities during install.
Implemented in #67
According to eslint docs environments are defined in env
, your documentations says envs
.
Currently this repo has some unreviewed (and important) PRs and open issues, but hasn't been updated recently.
I'd happily maintain this repo if you want to collaborate me.
Even root directory's .eslintignore has node_modules/**
, gulp-eslint still lint .js files under node_modules folder if the subfolder has .eslintignore file
#11
"dependencies": { "gulp-util": "~2.2.12", "map-stream": "^0.1.0", "through": "^2.3.4" }, "devDependencies": { "mocha": "*", "should": "~3.3.0", "eslint": ">=0.5.0", "gulp": "*" }
I think "eslint" should be in "dependencies" instead of "devDependencies".
So that when we npm i --save-d gulp-eslint
, we wouldn't get eslint
, which is not a direct dependency, into our own package.json
.
Does what I mean make sense? Thanks!
In 0.2.2
works fine. Not quite sure where is the problem.
var gulp = require("gulp");
var eslint = require("gulp-eslint");
var config = require("../config.js");
var isDevelopmentEnvironment = (process.env.NODE_ENV === "development");
gulp.task("lint", function() {
var sourceJs = [config.source, config.browserify.javascriptsFolder].join("/");
gulp.src([sourceJs + '/**/*.js'])
.pipe(eslint({useEslintrc: true}))
.pipe(eslint.format())
.pipe(eslint.failAfterError())
.on("error", function() {
this.emit("end"); // Keep gulp from hanging on this task
if (!isDevelopmentEnvironment) {
console.log('EXIIIIIIIIIIIIIIIIIITTTTTTTTTTT');
process.exit(1);
} // Exit with error when in production
}
);
});
Looks like there have been some breaking changes to eslint. See the articles linked at http://eslint.org/blog/
Running npm test
on this repo is failing, with this output:
> [email protected] test /Users/mhadley/tmp/gulp-eslint
> mocha
․․․․․․․․․
5 passing (266ms)
4 failing
1) gulp-eslint failOnError should pass if only warnings are found:
ESLintError in plugin 'gulp-eslint'
Unexpected blank line at end of file.
at /Users/mhadley/tmp/gulp-eslint/index.js:64:13
at Array.some (native)
at /Users/mhadley/tmp/gulp-eslint/index.js:58:12
at wrappedMapper (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:84:19)
at Stream.stream.write (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:96:21)
at Stream.ondata (stream.js:51:26)
at Stream.emit (events.js:95:17)
at queueData (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:43:21)
at next (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:71:7)
at /Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:85:7
at /Users/mhadley/tmp/gulp-eslint/index.js:41:4
at wrappedMapper (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:84:19)
at stream.write (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:96:21)
at Array.forEach (native)
at Context.<anonymous> (/Users/mhadley/tmp/gulp-eslint/test/fail.js:93:9)
at Test.Runnable.run (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runnable.js:196:15)
at Runner.runTest (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:373:10)
at /Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:451:12
at next (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:298:14)
at /Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:308:7
at next (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:246:23)
at /Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:270:7
at done (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runnable.js:185:5)
at callFn (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runnable.js:228:7)
at Hook.Runnable.run (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runnable.js:216:7)
at next (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:258:10)
at Object._onImmediate (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:275:5)
at processImmediate [as _immediateCallback] (timers.js:336:15)
2) Gulp eslint plugin should produce expected message via buffer:
AssertionError: expected [ { ruleId: 'eol-last',
severity: 2,
node:
{ type: 'Program',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'CallExpression',
callee:
{ type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body:
{ type: 'BlockStatement',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'UnaryExpression',
operator: 'void',
argument:
{ type: 'Literal',
value: 0,
raw: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } },
parent: [Circular] },
prefix: true,
range: [ 17, 23 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 7 } },
parent: [Circular] },
range: [ 17, 24 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 8 } },
parent: [Circular] } ],
range: [ 13, 27 ],
loc: { start: { line: 1, column: 13 }, end: { line: 5, column: 1 } },
parent: [Circular] },
rest: null,
generator: false,
expression: false,
range: [ 1, 27 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 1 } },
parent: [Circular] },
arguments: [],
range: [ 1, 29 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 3 } },
parent: [Circular] },
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
parent: [Circular] } ],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
comments: [],
tokens:
[ { type: 'Punctuator',
value: '(',
range: [ 0, 1 ],
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } } },
{ type: 'Keyword',
value: 'function',
range: [ 1, 9 ],
loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 9 } } },
{ type: 'Punctuator',
value: '(',
range: [ 10, 11 ],
loc: { start: { line: 1, column: 10 }, end: { line: 1, column: 11 } } },
{ type: 'Punctuator',
value: ')',
range: [ 11, 12 ],
loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } } },
{ type: 'Punctuator',
value: '{',
range: [ 13, 14 ],
loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } } },
{ type: 'Keyword',
value: 'void',
range: [ 17, 21 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 5 } } },
{ type: 'Numeric',
value: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } } },
{ type: 'Punctuator',
value: ';',
range: [ 23, 24 ],
loc: { start: { line: 3, column: 7 }, end: { line: 3, column: 8 } } },
{ type: 'Punctuator',
value: '}',
range: [ 26, 27 ],
loc: { start: { line: 5, column: 0 }, end: { line: 5, column: 1 } } },
{ type: 'Punctuator',
value: '(',
range: [ 27, 28 ],
loc: { start: { line: 5, column: 1 }, end: { line: 5, column: 2 } } },
{ type: 'Punctuator',
value: ')',
range: [ 28, 29 ],
loc: { start: { line: 5, column: 2 }, end: { line: 5, column: 3 } } },
{ type: 'Punctuator',
value: ')',
range: [ 29, 30 ],
loc: { start: { line: 5, column: 3 }, end: { line: 5, column: 4 } } },
{ type: 'Punctuator',
value: ';',
range: [ 30, 31 ],
loc: { start: { line: 5, column: 4 }, end: { line: 5, column: 5 } } } ],
parent: null },
message: 'Unexpected blank line at end of file.',
line: 6,
column: 1,
source: '(function () {\n\n\tvoid 0;\n\n}());' },
{ ruleId: 'strict',
severity: 2,
node:
{ type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body:
{ type: 'BlockStatement',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'UnaryExpression',
operator: 'void',
argument:
{ type: 'Literal',
value: 0,
raw: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } },
parent: [Circular] },
prefix: true,
range: [ 17, 23 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 7 } },
parent: [Circular] },
range: [ 17, 24 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 8 } },
parent: [Circular] } ],
range: [ 13, 27 ],
loc: { start: { line: 1, column: 13 }, end: { line: 5, column: 1 } },
parent: [Circular] },
rest: null,
generator: false,
expression: false,
range: [ 1, 27 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 1 } },
parent:
{ type: 'CallExpression',
callee: [Circular],
arguments: [],
range: [ 1, 29 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 3 } },
parent:
{ type: 'ExpressionStatement',
expression: [Circular],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
parent:
{ type: 'Program',
body: [ [Circular] ],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
comments: [],
tokens:
[ { type: 'Punctuator',
value: '(',
range: [ 0, 1 ],
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } } },
{ type: 'Keyword',
value: 'function',
range: [ 1, 9 ],
loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 9 } } },
{ type: 'Punctuator',
value: '(',
range: [ 10, 11 ],
loc: { start: { line: 1, column: 10 }, end: { line: 1, column: 11 } } },
{ type: 'Punctuator',
value: ')',
range: [ 11, 12 ],
loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } } },
{ type: 'Punctuator',
value: '{',
range: [ 13, 14 ],
loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } } },
{ type: 'Keyword',
value: 'void',
range: [ 17, 21 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 5 } } },
{ type: 'Numeric',
value: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } } },
{ type: 'Punctuator',
value: ';',
range: [ 23, 24 ],
loc: { start: { line: 3, column: 7 }, end: { line: 3, column: 8 } } },
{ type: 'Punctuator',
value: '}',
range: [ 26, 27 ],
loc: { start: { line: 5, column: 0 }, end: { line: 5, column: 1 } } },
{ type: 'Punctuator',
value: '(',
range: [ 27, 28 ],
loc: { start: { line: 5, column: 1 }, end: { line: 5, column: 2 } } },
{ type: 'Punctuator',
value: ')',
range: [ 28, 29 ],
loc: { start: { line: 5, column: 2 }, end: { line: 5, column: 3 } } },
{ type: 'Punctuator',
value: ')',
range: [ 29, 30 ],
loc: { start: { line: 5, column: 3 }, end: { line: 5, column: 4 } } },
{ type: 'Punctuator',
value: ';',
range: [ 30, 31 ],
loc: { start: { line: 5, column: 4 }, end: { line: 5, column: 5 } } } ],
parent: null } } } },
message: 'Missing "use strict" statement.',
line: 1,
column: 1,
source: 'function () {\n\n\tvoid 0;\n\n}' } ] to have property 'length' of 1 (got 2)
at Assertion.prop.(anonymous function) (/Users/mhadley/tmp/gulp-eslint/node_modules/should/lib/should.js:61:14)
at Stream.<anonymous> (/Users/mhadley/tmp/gulp-eslint/test/linting.js:41:50)
at Stream.emit (events.js:95:17)
at queueData (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:43:21)
at next (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:71:7)
at /Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:85:7
at /Users/mhadley/tmp/gulp-eslint/index.js:41:4
at wrappedMapper (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:84:19)
at Stream.stream.write (/Users/mhadley/tmp/gulp-eslint/node_modules/map-stream/index.js:96:21)
at Context.<anonymous> (/Users/mhadley/tmp/gulp-eslint/test/linting.js:50:10)
at Test.Runnable.run (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runnable.js:196:15)
at Runner.runTest (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:373:10)
at /Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:451:12
at next (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:298:14)
at /Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:308:7
at next (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:246:23)
at Object._onImmediate (/Users/mhadley/tmp/gulp-eslint/node_modules/mocha/lib/runner.js:275:5)
at processImmediate [as _immediateCallback] (timers.js:336:15)
3) Gulp eslint plugin should produce expected message upon stream completion:
Uncaught AssertionError: expected [ { ruleId: 'eol-last',
severity: 2,
node:
{ type: 'Program',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'CallExpression',
callee:
{ type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body:
{ type: 'BlockStatement',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'UnaryExpression',
operator: 'void',
argument:
{ type: 'Literal',
value: 0,
raw: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } },
parent: [Circular] },
prefix: true,
range: [ 17, 23 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 7 } },
parent: [Circular] },
range: [ 17, 24 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 8 } },
parent: [Circular] } ],
range: [ 13, 27 ],
loc: { start: { line: 1, column: 13 }, end: { line: 5, column: 1 } },
parent: [Circular] },
rest: null,
generator: false,
expression: false,
range: [ 1, 27 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 1 } },
parent: [Circular] },
arguments: [],
range: [ 1, 29 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 3 } },
parent: [Circular] },
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
parent: [Circular] } ],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
comments: [],
tokens:
[ { type: 'Punctuator',
value: '(',
range: [ 0, 1 ],
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } } },
{ type: 'Keyword',
value: 'function',
range: [ 1, 9 ],
loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 9 } } },
{ type: 'Punctuator',
value: '(',
range: [ 10, 11 ],
loc: { start: { line: 1, column: 10 }, end: { line: 1, column: 11 } } },
{ type: 'Punctuator',
value: ')',
range: [ 11, 12 ],
loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } } },
{ type: 'Punctuator',
value: '{',
range: [ 13, 14 ],
loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } } },
{ type: 'Keyword',
value: 'void',
range: [ 17, 21 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 5 } } },
{ type: 'Numeric',
value: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } } },
{ type: 'Punctuator',
value: ';',
range: [ 23, 24 ],
loc: { start: { line: 3, column: 7 }, end: { line: 3, column: 8 } } },
{ type: 'Punctuator',
value: '}',
range: [ 26, 27 ],
loc: { start: { line: 5, column: 0 }, end: { line: 5, column: 1 } } },
{ type: 'Punctuator',
value: '(',
range: [ 27, 28 ],
loc: { start: { line: 5, column: 1 }, end: { line: 5, column: 2 } } },
{ type: 'Punctuator',
value: ')',
range: [ 28, 29 ],
loc: { start: { line: 5, column: 2 }, end: { line: 5, column: 3 } } },
{ type: 'Punctuator',
value: ')',
range: [ 29, 30 ],
loc: { start: { line: 5, column: 3 }, end: { line: 5, column: 4 } } },
{ type: 'Punctuator',
value: ';',
range: [ 30, 31 ],
loc: { start: { line: 5, column: 4 }, end: { line: 5, column: 5 } } } ],
parent: null },
message: 'Unexpected blank line at end of file.',
line: 6,
column: 1,
source: '(function () {\n\n\tvoid 0;\n\n}());' },
{ ruleId: 'strict',
severity: 2,
node:
{ type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body:
{ type: 'BlockStatement',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'UnaryExpression',
operator: 'void',
argument:
{ type: 'Literal',
value: 0,
raw: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } },
parent: [Circular] },
prefix: true,
range: [ 17, 23 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 7 } },
parent: [Circular] },
range: [ 17, 24 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 8 } },
parent: [Circular] } ],
range: [ 13, 27 ],
loc: { start: { line: 1, column: 13 }, end: { line: 5, column: 1 } },
parent: [Circular] },
rest: null,
generator: false,
expression: false,
range: [ 1, 27 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 1 } },
parent:
{ type: 'CallExpression',
callee: [Circular],
arguments: [],
range: [ 1, 29 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 3 } },
parent:
{ type: 'ExpressionStatement',
expression: [Circular],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
parent:
{ type: 'Program',
body: [ [Circular] ],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
comments: [],
tokens:
[ { type: 'Punctuator',
value: '(',
range: [ 0, 1 ],
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } } },
{ type: 'Keyword',
value: 'function',
range: [ 1, 9 ],
loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 9 } } },
{ type: 'Punctuator',
value: '(',
range: [ 10, 11 ],
loc: { start: { line: 1, column: 10 }, end: { line: 1, column: 11 } } },
{ type: 'Punctuator',
value: ')',
range: [ 11, 12 ],
loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } } },
{ type: 'Punctuator',
value: '{',
range: [ 13, 14 ],
loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } } },
{ type: 'Keyword',
value: 'void',
range: [ 17, 21 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 5 } } },
{ type: 'Numeric',
value: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } } },
{ type: 'Punctuator',
value: ';',
range: [ 23, 24 ],
loc: { start: { line: 3, column: 7 }, end: { line: 3, column: 8 } } },
{ type: 'Punctuator',
value: '}',
range: [ 26, 27 ],
loc: { start: { line: 5, column: 0 }, end: { line: 5, column: 1 } } },
{ type: 'Punctuator',
value: '(',
range: [ 27, 28 ],
loc: { start: { line: 5, column: 1 }, end: { line: 5, column: 2 } } },
{ type: 'Punctuator',
value: ')',
range: [ 28, 29 ],
loc: { start: { line: 5, column: 2 }, end: { line: 5, column: 3 } } },
{ type: 'Punctuator',
value: ')',
range: [ 29, 30 ],
loc: { start: { line: 5, column: 3 }, end: { line: 5, column: 4 } } },
{ type: 'Punctuator',
value: ';',
range: [ 30, 31 ],
loc: { start: { line: 5, column: 4 }, end: { line: 5, column: 5 } } } ],
parent: null } } } },
message: 'Missing "use strict" statement.',
line: 1,
column: 1,
source: 'function () {\n\n\tvoid 0;\n\n}' } ] to have property 'length' of 1 (got 2)
at Assertion.prop.(anonymous function) (/Users/mhadley/tmp/gulp-eslint/node_modules/should/lib/should.js:61:14)
at Stream.<anonymous> (/Users/mhadley/tmp/gulp-eslint/test/linting.js:81:51)
at _end (/Users/mhadley/tmp/gulp-eslint/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/mhadley/tmp/gulp-eslint/node_modules/through/index.js:74:5)
at Stream.onend (stream.js:79:10)
at Stream.emit (events.js:117:20)
at Stream.<anonymous> (/Users/mhadley/tmp/gulp-eslint/util.js:31:8)
at _end (/Users/mhadley/tmp/gulp-eslint/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/mhadley/tmp/gulp-eslint/node_modules/through/index.js:74:5)
at ReadStream.onend (_stream_readable.js:485:10)
at ReadStream.g (events.js:180:16)
at ReadStream.emit (events.js:117:20)
at _stream_readable.js:929:16
at process._tickCallback (node.js:419:13)
4) Gulp eslint plugin should lint multiple streaming files:
Uncaught AssertionError: expected [ { ruleId: 'eol-last',
severity: 2,
node:
{ type: 'Program',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'CallExpression',
callee:
{ type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body:
{ type: 'BlockStatement',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'UnaryExpression',
operator: 'void',
argument:
{ type: 'Literal',
value: 0,
raw: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } },
parent: [Circular] },
prefix: true,
range: [ 17, 23 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 7 } },
parent: [Circular] },
range: [ 17, 24 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 8 } },
parent: [Circular] } ],
range: [ 13, 27 ],
loc: { start: { line: 1, column: 13 }, end: { line: 5, column: 1 } },
parent: [Circular] },
rest: null,
generator: false,
expression: false,
range: [ 1, 27 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 1 } },
parent: [Circular] },
arguments: [],
range: [ 1, 29 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 3 } },
parent: [Circular] },
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
parent: [Circular] } ],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
comments: [],
tokens:
[ { type: 'Punctuator',
value: '(',
range: [ 0, 1 ],
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } } },
{ type: 'Keyword',
value: 'function',
range: [ 1, 9 ],
loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 9 } } },
{ type: 'Punctuator',
value: '(',
range: [ 10, 11 ],
loc: { start: { line: 1, column: 10 }, end: { line: 1, column: 11 } } },
{ type: 'Punctuator',
value: ')',
range: [ 11, 12 ],
loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } } },
{ type: 'Punctuator',
value: '{',
range: [ 13, 14 ],
loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } } },
{ type: 'Keyword',
value: 'void',
range: [ 17, 21 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 5 } } },
{ type: 'Numeric',
value: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } } },
{ type: 'Punctuator',
value: ';',
range: [ 23, 24 ],
loc: { start: { line: 3, column: 7 }, end: { line: 3, column: 8 } } },
{ type: 'Punctuator',
value: '}',
range: [ 26, 27 ],
loc: { start: { line: 5, column: 0 }, end: { line: 5, column: 1 } } },
{ type: 'Punctuator',
value: '(',
range: [ 27, 28 ],
loc: { start: { line: 5, column: 1 }, end: { line: 5, column: 2 } } },
{ type: 'Punctuator',
value: ')',
range: [ 28, 29 ],
loc: { start: { line: 5, column: 2 }, end: { line: 5, column: 3 } } },
{ type: 'Punctuator',
value: ')',
range: [ 29, 30 ],
loc: { start: { line: 5, column: 3 }, end: { line: 5, column: 4 } } },
{ type: 'Punctuator',
value: ';',
range: [ 30, 31 ],
loc: { start: { line: 5, column: 4 }, end: { line: 5, column: 5 } } } ],
parent: null },
message: 'Unexpected blank line at end of file.',
line: 6,
column: 1,
source: '(function () {\n\n\tvoid 0;\n\n}());' },
{ ruleId: 'strict',
severity: 2,
node:
{ type: 'FunctionExpression',
id: null,
params: [],
defaults: [],
body:
{ type: 'BlockStatement',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'UnaryExpression',
operator: 'void',
argument:
{ type: 'Literal',
value: 0,
raw: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } },
parent: [Circular] },
prefix: true,
range: [ 17, 23 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 7 } },
parent: [Circular] },
range: [ 17, 24 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 8 } },
parent: [Circular] } ],
range: [ 13, 27 ],
loc: { start: { line: 1, column: 13 }, end: { line: 5, column: 1 } },
parent: [Circular] },
rest: null,
generator: false,
expression: false,
range: [ 1, 27 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 1 } },
parent:
{ type: 'CallExpression',
callee: [Circular],
arguments: [],
range: [ 1, 29 ],
loc: { start: { line: 1, column: 1 }, end: { line: 5, column: 3 } },
parent:
{ type: 'ExpressionStatement',
expression: [Circular],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
parent:
{ type: 'Program',
body: [ [Circular] ],
range: [ 0, 31 ],
loc: { start: { line: 1, column: 0 }, end: { line: 5, column: 5 } },
comments: [],
tokens:
[ { type: 'Punctuator',
value: '(',
range: [ 0, 1 ],
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } } },
{ type: 'Keyword',
value: 'function',
range: [ 1, 9 ],
loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 9 } } },
{ type: 'Punctuator',
value: '(',
range: [ 10, 11 ],
loc: { start: { line: 1, column: 10 }, end: { line: 1, column: 11 } } },
{ type: 'Punctuator',
value: ')',
range: [ 11, 12 ],
loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } } },
{ type: 'Punctuator',
value: '{',
range: [ 13, 14 ],
loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } } },
{ type: 'Keyword',
value: 'void',
range: [ 17, 21 ],
loc: { start: { line: 3, column: 1 }, end: { line: 3, column: 5 } } },
{ type: 'Numeric',
value: '0',
range: [ 22, 23 ],
loc: { start: { line: 3, column: 6 }, end: { line: 3, column: 7 } } },
{ type: 'Punctuator',
value: ';',
range: [ 23, 24 ],
loc: { start: { line: 3, column: 7 }, end: { line: 3, column: 8 } } },
{ type: 'Punctuator',
value: '}',
range: [ 26, 27 ],
loc: { start: { line: 5, column: 0 }, end: { line: 5, column: 1 } } },
{ type: 'Punctuator',
value: '(',
range: [ 27, 28 ],
loc: { start: { line: 5, column: 1 }, end: { line: 5, column: 2 } } },
{ type: 'Punctuator',
value: ')',
range: [ 28, 29 ],
loc: { start: { line: 5, column: 2 }, end: { line: 5, column: 3 } } },
{ type: 'Punctuator',
value: ')',
range: [ 29, 30 ],
loc: { start: { line: 5, column: 3 }, end: { line: 5, column: 4 } } },
{ type: 'Punctuator',
value: ';',
range: [ 30, 31 ],
loc: { start: { line: 5, column: 4 }, end: { line: 5, column: 5 } } } ],
parent: null } } } },
message: 'Missing "use strict" statement.',
line: 1,
column: 1,
source: 'function () {\n\n\tvoid 0;\n\n}' } ] to have property 'length' of 1 (got 2)
at Assertion.prop.(anonymous function) (/Users/mhadley/tmp/gulp-eslint/node_modules/should/lib/should.js:61:14)
at Stream.<anonymous> (/Users/mhadley/tmp/gulp-eslint/test/linting.js:130:51)
at _end (/Users/mhadley/tmp/gulp-eslint/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/mhadley/tmp/gulp-eslint/node_modules/through/index.js:74:5)
at Stream.onend (stream.js:79:10)
at Stream.emit (events.js:117:20)
at Stream.<anonymous> (/Users/mhadley/tmp/gulp-eslint/util.js:31:8)
at _end (/Users/mhadley/tmp/gulp-eslint/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/mhadley/tmp/gulp-eslint/node_modules/through/index.js:74:5)
at ReadStream.onend (_stream_readable.js:485:10)
at ReadStream.g (events.js:180:16)
at ReadStream.emit (events.js:117:20)
at _stream_readable.js:929:16
at process._tickCallback (node.js:419:13)
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
Hi,
could I ask you when will be eslint
dependecy updated to the newest version (v1.0.0-rc-3)?
I'd like to use new arrow-parens
rule.
Thx for your reply.
O.
Would it actually not make sense to make the eslint dependency more generic, at least before 1.0.0 is out ?
gulp-eslint falls on cases when brackets are used in ternaries (with cli it's ok).
const val = smth ? (smth + 1) : 0;
error Infix operators must be spaced space-infix-ops
0.10.0
has been released: http://eslint.org/blog/2014/11/eslint-0.10.0-released!
Please could you update the eslint
dependency to use this version?
please, set fixed eslint version in package.json or support exclusions correctly (eslint 0.7.4)
package.json:
{
"name": "eslint-test",
"version": "0.0.0",
"devDependencies": {
"babel-eslint": "^1.0.12",
"eslint": "^0.15.1",
"gulp": "^3.8.11",
"gulp-eslint": "^0.5.0"
}
}
.eslintrc:
---
parser: babel-eslint
gulpfile.js:
ar gulp = require('gulp');
var eslint = require('gulp-eslint');
gulp.task('lint', function() {
gulp.src(['index.js'])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('default', ['lint']);
index.js:
import gulp from 'gulp';
Using the eslint binary works as expected:
$ ./node_modules/.bin/eslint index.js
index.js
1:7 error gulp is defined but never used no-unused-vars
1:17 error Strings must use doublequote quotes
✖ 2 problems (2 errors, 0 warnings)
But using gulp task blows up:
$ gulp
[11:57:41] Using gulpfile ~/stuff/eslint-test/gulpfile.js
[11:57:41] Starting 'lint'...
[11:57:41] Finished 'lint' after 14 ms
[11:57:41] Starting 'default'...
[11:57:41] Finished 'default' after 12 μs
/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/node_modules/escope/escope.js:73
throw new Error(text);
^
Error
at assert (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/node_modules/escope/escope.js:73:19)
at Referencer.extend.ImportDeclaration (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/node_modules/escope/escope.js:1348:13)
at Referencer.Visitor.visit (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:109:34)
at Referencer.Visitor.visitChildren (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:88:38)
at Referencer.extend.Program (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/node_modules/escope/escope.js:1201:18)
at Referencer.Visitor.visit (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/node_modules/escope/node_modules/esrecurse/esrecurse.js:109:34)
at Object.analyze (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/node_modules/escope/escope.js:1392:20)
at EventEmitter.module.exports.api.verify (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/node_modules/eslint/lib/eslint.js:623:35)
at verify (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/index.js:21:25)
at DestroyableTransform._transform (/Users/kentor/stuff/eslint-test/node_modules/gulp-eslint/index.js:44:18)
I'm finding that when .eslintrc's are defined for specific directories and there is also a root .eslintrc, gulp-eslint is utilizing the root level. I confirmed this by manually running eslint to confirm it is correctly leveraging the nearest parent to the javascript file.
pull request #23
I use eslint-plugin-nodeca to check indentation.
When I run node_modules/eslint/bin/eslint.js src/app.js
, eslint runs properly.
But, when I run gulp lint
I get the following error:
Error: Definition for rule 'nodeca/indent' was not found.
What am I missing here?
To check the gulp task and the eslint config, have a look here.
gulp-eslint is (still) using jscs but should (at least for consistency) rather switch to eslint
I use gulp-eslint as follows:
var standaloneScript = 'public/api/config-api.js';
gulp.task('eslint', function () {
return gulp.src(standaloneScript)
.pipe($.eslint())
.pipe($.eslint.format())
.pipe($.eslint.failOnError());
});
In my root folder I have a eslintrc specified. But eslint crashes because of the indent rule. It says:
Configuration for rule "indent" is invalid:
Value "4" must be an enum value.
//...
"rules": {
"indent": [4, 4],
//...
What can I do? Removing indent works, but this is not an option for me. Could you help me to resolve this issue?
Things tend to break when running the gulp task. Any idea what may cause this?
Log:
~/Code/fb master*
❯ gulp lint
[gulp] Using file /home/yoshua/Code/fb/gulpfile.js
[gulp] Working directory changed to /home/yoshua/Code/fb
[gulp] Running 'lint'...
[gulp] Finished 'lint' in 21 ms
/home/yoshua/Code/fb/node_modules/gulp-eslint/node_modules/eslint/lib/formatters/stylish.js:36
rules = config.rules || {};
^
TypeError: Cannot read property 'rules' of undefined
at module.exports (/home/yoshua/Code/fb/node_modules/gulp-eslint/node_modules/eslint/lib/formatters/stylish.js:36:23)
at Object.exports.writeResults (/home/yoshua/Code/fb/node_modules/gulp-eslint/util.js:147:16)
at Stream.<anonymous> (/home/yoshua/Code/fb/node_modules/gulp-eslint/index.js:96:8)
at Stream.g (events.js:196:16)
at Stream.EventEmitter.emit (events.js:101:17)
at end (/home/yoshua/Code/fb/node_modules/gulp-eslint/node_modules/event-stream/node_modules/map-stream/index.js:116:39)
at Stream.stream.end (/home/yoshua/Code/fb/node_modules/gulp-eslint/node_modules/event-stream/node_modules/map-stream/index.js:122:5)
at Stream.onend (stream.js:79:10)
at Stream.EventEmitter.emit (events.js:126:20)
at end (/home/yoshua/Code/fb/node_modules/gulp/node_modules/vinyl-fs/node_modules/map-stream/index.js:116:39)
~/Code/fb master*
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.