gulp-eslint
Advanced tools
Comparing version 0.4.0 to 0.4.1
10
index.js
@@ -39,4 +39,4 @@ 'use strict'; | ||
file.eslint = verify(file.path, String(buf)); | ||
done(null, buf); | ||
cb(null, file); | ||
done(null, buf); | ||
})); | ||
@@ -94,4 +94,3 @@ | ||
cb(null, file); | ||
}).once('end', function() { | ||
}, function(cb) { | ||
// Only format results if files has been lint'd | ||
@@ -107,2 +106,3 @@ if (errorCount > 0) { | ||
} | ||
cb(); | ||
}); | ||
@@ -124,4 +124,3 @@ }; | ||
cb(null, file); | ||
}).once('finish', function() { | ||
}, function(cb) { | ||
// Only format results if files has been lint'd | ||
@@ -133,2 +132,3 @@ if (results.length) { | ||
results = []; | ||
cb(); | ||
}); | ||
@@ -135,0 +135,0 @@ }; |
{ | ||
"name": "gulp-eslint", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A gulp plugin for processing files with eslint", | ||
@@ -19,3 +19,5 @@ "repository": "adametry/gulp-eslint", | ||
"throw-on-error": "gulp throw-on-error", | ||
"throw-after-error": "gulp throw-after-error" | ||
"throw-after-error": "gulp throw-after-error", | ||
"coverage": "istanbul cover _mocha", | ||
"coveralls": "${npm_package_scripts_coverage} && istanbul-coveralls" | ||
}, | ||
@@ -39,3 +41,5 @@ "keywords": [ | ||
"author": "Adametry", | ||
"contribtutor": "Shinnosuke Watanabe <snnskwtnb@gmail.com> (https://github.com/shinnn)", | ||
"contributors": [ | ||
"Shinnosuke Watanabe <snnskwtnb@gmail.com> (https://github.com/shinnn)" | ||
], | ||
"licenses": [ | ||
@@ -51,2 +55,4 @@ { | ||
"gulp-util": "^3.0.1", | ||
"object-assign": "^2.0.0", | ||
"optional": "^0.1.2", | ||
"through2": "^0.6.3" | ||
@@ -56,6 +62,9 @@ }, | ||
"gulp": "*", | ||
"istanbul": "^0.3.5", | ||
"istanbul-coveralls": "^1.0.1", | ||
"jscs": "^1.11.0", | ||
"mocha": "*", | ||
"should": "^4.6.5", | ||
"through": "^2.3.6" | ||
"through": "^2.3.6", | ||
"vinyl": "^0.4.6" | ||
}, | ||
@@ -62,0 +71,0 @@ "jscsConfig": { |
@@ -1,14 +0,14 @@ | ||
# gulp-eslint [![Build Status](https://travis-ci.org/adametry/gulp-eslint.svg)](https://travis-ci.org/adametry/gulp-eslint) | ||
# gulp-eslint [![Build Status](https://travis-ci.org/adametry/gulp-eslint.svg)](https://travis-ci.org/adametry/gulp-eslint) [![Coverage Status](https://img.shields.io/coveralls/adametry/gulp-eslint.svg)](https://coveralls.io/r/adametry/gulp-eslint) | ||
> A [gulp](http://gulpjs.com/) plugin for [ESLint](http://eslint.org/). | ||
## Usage | ||
## Installation | ||
First, install `gulp-eslint` as a dependency: | ||
[Use npm](https://docs.npmjs.com/cli/install). | ||
```shell | ||
```sh | ||
npm install gulp-eslint | ||
``` | ||
Then, add it to your *gulpfile.js*: | ||
## Usage | ||
@@ -190,3 +190,2 @@ ```javascript | ||
eslint.format('junit', process.stdout) | ||
``` | ||
@@ -206,2 +205,3 @@ | ||
##Ignore Files | ||
Eslint will ignore files that do not have a `.js` file extension at the point of linting ([some plugins](https://github.com/wearefractal/gulp-coffee) may change file extensions mid-stream). This avoids unintentional linting of non-JavaScript files. | ||
@@ -208,0 +208,0 @@ |
74
util.js
@@ -5,2 +5,4 @@ 'use strict'; | ||
gutil = require('gulp-util'), | ||
objectAssign = require('object-assign'), | ||
optional = require('optional'), | ||
CLIEngine = require('eslint').CLIEngine, | ||
@@ -13,13 +15,2 @@ IgnoredPaths = require('eslint/lib/ignored-paths'), | ||
/** | ||
* Optional import, if not found, returns null. | ||
*/ | ||
function optional(name) { | ||
try { | ||
return require(name); | ||
} catch (error) { | ||
return null; | ||
} | ||
} | ||
/** | ||
* Mimic the CLIEngine.isPathIgnored, but resolve .eslintignore based on file's directory rather than process.cwd() | ||
@@ -58,53 +49,46 @@ */ | ||
*/ | ||
exports.migrateOptions = function migrateOptions(from) { | ||
var globals, envs; | ||
if (typeof from === 'string') { | ||
exports.migrateOptions = function migrateOptions(options) { | ||
if (typeof options === 'string') { | ||
// basic config path overload: gulpEslint('path/to/config.json') | ||
from = { | ||
configFile: from | ||
options = { | ||
configFile: options | ||
}; | ||
} else { | ||
options = objectAssign({}, options); | ||
} | ||
var to = {}; | ||
for (var key in from) { | ||
if (from.hasOwnProperty(key)) { | ||
to[key] = from[key]; | ||
} | ||
options.globals = options.globals || options.global; | ||
if (options.globals != null && Array.isArray(options.globals)) { | ||
options.globals = Object.keys(options.globals).map(function cliGlobal(key) { | ||
return options.globals[key] ? key + ':true' : key; | ||
}); | ||
} | ||
globals = to.globals || to.global; | ||
if (globals != null) { | ||
to.globals = Array.isArray(globals) ? | ||
globals : | ||
Object.keys(globals).map(function cliGlobal(key) { | ||
return globals[key] ? key + ':true' : key; | ||
}); | ||
options.envs = options.envs || options.env; | ||
if (options.envs != null && Array.isArray(options.envs)) { | ||
options.envs = Object.keys(options.envs).filter(function cliEnv(key) { | ||
return options.envs[key]; | ||
}); | ||
} | ||
envs = to.envs || to.env; | ||
if (envs) { | ||
to.envs = Array.isArray(envs) ? | ||
envs : | ||
Object.keys(envs).filter(function cliEnv(key) { | ||
return envs[key]; | ||
}); | ||
} | ||
if (to.config != null) { | ||
if (options.config != null) { | ||
// The "config" option has been deprecated. Use "configFile". | ||
to.configFile = to.config; | ||
options.configFile = options.config; | ||
} | ||
if (to.rulesdir != null) { | ||
if (options.rulesdir != null) { | ||
// The "rulesdir" option has been deprecated. Use "rulesPaths". | ||
to.rulesPaths = (typeof to.rulesdir === 'string') ? [to.rulesdir] : to.rulesdir; | ||
if (typeof options.rulesdir === 'string') { | ||
options.rulesPaths = [options.rulesdir]; | ||
} else { | ||
options.rulesPaths = options.rulesdir; | ||
} | ||
} | ||
if (to.eslintrc != null) { | ||
if (options.eslintrc != null) { | ||
// The "eslintrc" option has been deprecated. Use "useEslintrc". | ||
to.useEslintrc = to.eslintrc; | ||
options.useEslintrc = options.eslintrc; | ||
} | ||
return to; | ||
return options; | ||
}; | ||
@@ -111,0 +95,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
19563
1
0
6
8
280
+ Addedobject-assign@^2.0.0
+ Addedoptional@^0.1.2
+ Addedoptional@0.1.4(transitive)