eslint-webpack-plugin
Advanced tools
Comparing version 3.0.0 to 3.0.1
/** | ||
* @template T | ||
* @param {T} value | ||
* @return { | ||
T extends (null | undefined) | ||
? [] | ||
: T extends string | ||
? [string] | ||
: T extends readonly unknown[] | ||
? T | ||
: T extends Iterable<infer T> | ||
? T[] | ||
: [T] | ||
} | ||
*/ | ||
export function arrify<T>( | ||
value: T | ||
): T extends null | undefined | ||
? [] | ||
: T extends string | ||
? [string] | ||
: T extends readonly unknown[] | ||
? T | ||
: T extends Iterable<infer T_1> | ||
? T_1[] | ||
: [T]; | ||
/** | ||
* @param {string|string[]} files | ||
@@ -3,0 +29,0 @@ * @param {string} context |
@@ -10,4 +10,2 @@ "use strict"; | ||
var _arrify = _interopRequireDefault(require("arrify")); | ||
var _micromatch = require("micromatch"); | ||
@@ -80,3 +78,3 @@ | ||
exclude: (0, _utils.parseFiles)(this.options.exclude || [], this.getContext(compiler)), | ||
extensions: (0, _arrify.default)(this.options.extensions), | ||
extensions: (0, _utils.arrify)(this.options.extensions), | ||
files: (0, _utils.parseFiles)(this.options.files || '', this.getContext(compiler)) | ||
@@ -83,0 +81,0 @@ }; |
@@ -6,2 +6,3 @@ "use strict"; | ||
}); | ||
exports.arrify = arrify; | ||
exports.parseFiles = parseFiles; | ||
@@ -15,4 +16,2 @@ exports.parseFoldersToGlobs = parseFoldersToGlobs; | ||
var _arrify = _interopRequireDefault(require("arrify")); | ||
var _normalizePath = _interopRequireDefault(require("normalize-path")); | ||
@@ -25,2 +24,43 @@ | ||
/** | ||
* @template T | ||
* @param {T} value | ||
* @return { | ||
T extends (null | undefined) | ||
? [] | ||
: T extends string | ||
? [string] | ||
: T extends readonly unknown[] | ||
? T | ||
: T extends Iterable<infer T> | ||
? T[] | ||
: [T] | ||
} | ||
*/ | ||
function arrify(value) { | ||
// eslint-disable-next-line no-undefined | ||
if (value === null || value === undefined) { | ||
// @ts-ignore | ||
return []; | ||
} | ||
if (Array.isArray(value)) { | ||
// @ts-ignore | ||
return value; | ||
} | ||
if (typeof value === 'string') { | ||
// @ts-ignore | ||
return [value]; | ||
} // @ts-ignore | ||
if (typeof value[Symbol.iterator] === 'function') { | ||
// @ts-ignore | ||
return [...value]; | ||
} // @ts-ignore | ||
return [value]; | ||
} | ||
/** | ||
* @param {string|string[]} files | ||
@@ -30,4 +70,6 @@ * @param {string} context | ||
*/ | ||
function parseFiles(files, context) { | ||
return (0, _arrify.default)(files).map(( | ||
return arrify(files).map(( | ||
/** @type {string} */ | ||
@@ -44,3 +86,3 @@ file) => (0, _normalizePath.default)((0, _path.resolve)(context, file))); | ||
function parseFoldersToGlobs(patterns, extensions = []) { | ||
const extensionsList = (0, _arrify.default)(extensions); | ||
const extensionsList = arrify(extensions); | ||
const [prefix, postfix] = extensionsList.length > 1 ? ['{', '}'] : ['', '']; | ||
@@ -50,3 +92,3 @@ const extensionsGlob = extensionsList.map(( | ||
extension) => extension.replace(/^\./u, '')).join(','); | ||
return (0, _arrify.default)(patterns).map(( | ||
return arrify(patterns).map(( | ||
/** @type {string} */ | ||
@@ -53,0 +95,0 @@ pattern) => { |
{ | ||
"name": "eslint-webpack-plugin", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A ESLint plugin for webpack", | ||
@@ -50,3 +50,2 @@ "license": "MIT", | ||
"@types/eslint": "^7.2.14", | ||
"arrify": "^3.0.0", | ||
"jest-worker": "^27.0.6", | ||
@@ -53,0 +52,0 @@ "micromatch": "^4.0.4", |
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
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
43430
7
1100
1
- Removedarrify@^3.0.0
- Removedarrify@3.0.0(transitive)