Coder Social home page Coder Social logo

gulp-eslint's People

Contributors

5im0n avatar adametry avatar alyssaq avatar arnaudrinquin avatar aruberto avatar benmccann avatar bobthecow avatar boo1ean avatar csabapalfi avatar ehmicky avatar gabeno avatar ilanbiala avatar jakobo avatar jhorwit2 avatar jlandure avatar jrf0110 avatar kingdutch avatar michaelfoss avatar mightyiam avatar mjeanroy avatar ncuillery avatar posva avatar ptarjan avatar readmecritic avatar riddla avatar shinnn avatar soda0289 avatar tcoopman avatar trysound avatar willpracht avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-eslint's Issues

space-infix-ops and brackets in ternaries

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

eslint and React

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.

failOnError() shows no file or line information with the error

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

Create a branch @es6jsx

To track testing jsx support, it would be nice to create a branch with eslint dependence in v0.11.0-alpha.0 ?!

Cannot read property 'rules' of undefined

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*  

failAfterError is not triggered in 0.4.0

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
        }
    );
});

Reflect in README.md: .formatEach() or.format() are needed for output.

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.

eslint is at 0.18.0

Any chance on making dependencies like eslint a peerDependency so that they can be upgraded separately?

Shouldn't "eslint" be in "dependencies"?

  "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!

failOnError() throws "Unhandled 'error' event"

If have the following task:

gulp.task('lint', function () {
        gulp.src(src)
            .pipe(eslint())
            .pipe(eslint.formatEach())
            .pipe(eslint.failOnError());
    });

If stops after the first error and prints the error message. But i also get an error from events.js.

bildschirmfoto 2015-07-15 um 08 37 35

I am using io.js 2.3.4 and gulp 3.9.0

Unhandled stream error in pipe

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

Save output of eslint.format() in a file

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.

.eslintrc not resolving to nearest parent

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.

rulesPaths not working

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,
...

gulp-eslint broken with eslint 0.7.1

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

eslint dependency update

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.

Make eslint a peer dependency

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

ESLint doesn't exit on failOnError();

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?

Format checkstyle outputs xml

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 &apos;,&apos;. (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

Needs maintainers?

@adametry

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.

ecmaFeatures appears to be ignored

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.

gulp-eslint wont process more than 16 files

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..

Fails when parser is babel-eslint and using ES6 import syntax

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)

`"key-spacing"` with `"align": "colon"` problem

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.

Problem with eslintrc: "indent" is invalid: Value "4" must be an enum value

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?

outdated dependencies

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

`config` no longer allows you to set the configuration file.

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?

Possible not to `errorOnFail` when watching?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.