gulp-eslint
Advanced tools
Comparing version 0.13.2 to 0.14.0
# Changelog | ||
## 0.14.0 | ||
* Bump eslint dependency to ^0.23.0 | ||
* Remove no-longer-needed code | ||
* Fix project eslintrc syntax | ||
## 0.13.2 | ||
@@ -4,0 +10,0 @@ |
22
index.js
@@ -5,3 +5,2 @@ 'use strict'; | ||
var PluginError = require('gulp-util').PluginError; | ||
var eslint = require('eslint').linter; | ||
var CLIEngine = require('eslint').CLIEngine; | ||
@@ -12,2 +11,4 @@ var util = require('./util'); | ||
* Append eslint result to each file | ||
* @param {(object|string)} [options] - Configure rules, env, global, and other options for running eslint | ||
* @returns {stream} gulp file stream | ||
*/ | ||
@@ -19,11 +20,4 @@ function gulpEslint(options) { | ||
function verify(filePath, str) { | ||
// mimic CLIEngine::processFile | ||
var config = linter.getConfigForFile(filePath); | ||
util.loadPlugins(config.plugins, linter); | ||
var messages = eslint.verify(str, config, filePath); | ||
//eslint.reset(); | ||
return { | ||
filePath: filePath, | ||
messages: messages | ||
}; | ||
// woot! eslint now supports text processing with localized config files! | ||
return linter.executeOnText(str, filePath).results[0]; | ||
} | ||
@@ -54,2 +48,3 @@ | ||
* Fail when an eslint error is found in eslint results. | ||
* @returns {stream} gulp file stream | ||
*/ | ||
@@ -83,2 +78,3 @@ gulpEslint.failOnError = function() { | ||
* Fail when the stream ends if any eslint error(s) occurred | ||
* @returns {stream} gulp file stream | ||
*/ | ||
@@ -113,2 +109,5 @@ gulpEslint.failAfterError = function() { | ||
* Wait until all files have been linted and format all results at once. | ||
* @param {(string|function)} [formatter=stylish] - The name or function for a eslint result formatter | ||
* @param {(function|stream)} [writable=gulp-util.log] - A funtion or stream to write the formatted eslint results. | ||
* @returns {stream} gulp file stream | ||
*/ | ||
@@ -138,2 +137,5 @@ gulpEslint.format = function(formatter, writable) { | ||
* Format the results of each file individually. | ||
* @param {(string|function)} [formatter=stylish] - The name or function for a eslint result formatter | ||
* @param {(function|stream)} [writable=gulp-util.log] - A funtion or stream to write the formatted eslint results. | ||
* @returns {stream} gulp file stream | ||
*/ | ||
@@ -140,0 +142,0 @@ gulpEslint.formatEach = function(formatter, writable) { |
{ | ||
"name": "gulp-eslint", | ||
"version": "0.13.2", | ||
"version": "0.14.0", | ||
"description": "A gulp plugin for processing files with eslint", | ||
@@ -49,3 +49,3 @@ "repository": "adametry/gulp-eslint", | ||
"bufferstreams": "1.0.1", | ||
"eslint": "^0.22.1", | ||
"eslint": "^0.23.0", | ||
"gulp-util": "^3.0.4", | ||
@@ -52,0 +52,0 @@ "object-assign": "^3.0.0" |
35
util.js
@@ -16,2 +16,5 @@ 'use strict'; | ||
* Convenience method for creating a transform stream in object mode | ||
* @param {function} transform - An async function that is called for each stream chunk | ||
* @param {function} [flush] - An async function that is called before closing the stream | ||
* @returns {stream} A transform stream | ||
*/ | ||
@@ -32,2 +35,5 @@ exports.transform = function(transform, flush) { | ||
* but resolve .eslintignore based on file's directory rather than process.cwd() | ||
* @param {object} file - file with a "path" property | ||
* @param {object} options - linter options | ||
* @returns {boolean} Whether the path is ignored | ||
*/ | ||
@@ -54,20 +60,5 @@ exports.isPathIgnored = function(file, options) { | ||
/** | ||
* Mimic the CLIEngine::loadPlugins | ||
*/ | ||
exports.loadPlugins = function(pluginNames, linter) { | ||
// Replicate the cli-engine's internal loadPlugins method; | ||
// However, use the fancy new addPlugin method to populate the internal loadedPlugins table | ||
if (pluginNames) { | ||
pluginNames.forEach(function loadAndAddPlugin(pluginName) { | ||
var pluginNamespace = esUtil.getNamespace(pluginName), | ||
pluginNameWithoutPrefix = esUtil.removePluginPrefix(esUtil.removeNameSpace(pluginName)), | ||
plugin = require(pluginNamespace + esUtil.PLUGIN_NAME_PREFIX + pluginNameWithoutPrefix); | ||
// Use the fancy new addPlugin method... | ||
linter.addPlugin(pluginName, plugin); | ||
}); | ||
} | ||
}; | ||
/** | ||
* Create config helper to merge various config sources | ||
* @param {object} options - options to migrate | ||
* @returns {object} migrated options | ||
*/ | ||
@@ -122,2 +113,4 @@ exports.migrateOptions = function migrateOptions(options) { | ||
* Resolve writable | ||
* @param {object} message - an eslint message | ||
* @returns {boolean} whether the message is an error message | ||
*/ | ||
@@ -135,2 +128,4 @@ exports.isErrorMessage = function(message) { | ||
* @exception TypeError thrown if unable to resolve the formatter type | ||
* @param {(string|function)} [formatter=stylish] - A name to resolve as a formatter. If a function is provided, the same function is returned. | ||
* @returns {function} An eslint formatter | ||
*/ | ||
@@ -154,2 +149,4 @@ exports.resolveFormatter = function(formatter) { | ||
* Resolve writable | ||
* @param {(function|stream)} [writable=gulp-util.log] - A stream or function to resolve as a format writer | ||
* @returns {function} A function that writes formatted messages | ||
*/ | ||
@@ -167,2 +164,6 @@ exports.resolveWritable = function(writable) { | ||
* Write formatter results to writable/output | ||
* @param {object[]} results - A list of eslint results | ||
* @param {function} formatter - A function used to format eslint results | ||
* @param {function} writable - A function used to write formatted eslint results | ||
* @returns {undefined} void | ||
*/ | ||
@@ -169,0 +170,0 @@ exports.writeResults = function(results, formatter, writable) { |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
21839
295
1
+ Addedeslint@0.23.0(transitive)
+ Addedglobals@8.18.0(transitive)
- Removedeslint@0.22.1(transitive)
- Removedglobals@6.4.1(transitive)
Updatedeslint@^0.23.0