Update checked-in dependencies
This commit is contained in:
parent
fa428daf9c
commit
b3bf514df4
216 changed files with 4342 additions and 1611 deletions
40
node_modules/eslint-module-utils/ignore.js
generated
vendored
40
node_modules/eslint-module-utils/ignore.js
generated
vendored
|
|
@ -7,20 +7,14 @@ const extname = require('path').extname;
|
|||
const log = require('debug')('eslint-plugin-import:utils:ignore');
|
||||
|
||||
// one-shot memoized
|
||||
let cachedSet; let lastSettings;
|
||||
function validExtensions(context) {
|
||||
if (cachedSet && context.settings === lastSettings) {
|
||||
return cachedSet;
|
||||
}
|
||||
|
||||
lastSettings = context.settings;
|
||||
cachedSet = makeValidExtensionSet(context.settings);
|
||||
return cachedSet;
|
||||
}
|
||||
/** @type {Set<import('./types').Extension>} */ let cachedSet;
|
||||
/** @type {import('./types').ESLintSettings} */ let lastSettings;
|
||||
|
||||
/** @type {import('./ignore').getFileExtensions} */
|
||||
function makeValidExtensionSet(settings) {
|
||||
// start with explicit JS-parsed extensions
|
||||
const exts = new Set(settings['import/extensions'] || [ '.js' ]);
|
||||
/** @type {Set<import('./types').Extension>} */
|
||||
const exts = new Set(settings['import/extensions'] || ['.js']);
|
||||
|
||||
// all alternate parser extensions are also valid
|
||||
if ('import/parsers' in settings) {
|
||||
|
|
@ -37,6 +31,25 @@ function makeValidExtensionSet(settings) {
|
|||
}
|
||||
exports.getFileExtensions = makeValidExtensionSet;
|
||||
|
||||
/** @type {(context: import('eslint').Rule.RuleContext) => Set<import('./types').Extension>} */
|
||||
function validExtensions(context) {
|
||||
if (cachedSet && context.settings === lastSettings) {
|
||||
return cachedSet;
|
||||
}
|
||||
|
||||
lastSettings = context.settings;
|
||||
cachedSet = makeValidExtensionSet(context.settings);
|
||||
return cachedSet;
|
||||
}
|
||||
|
||||
/** @type {import('./ignore').hasValidExtension} */
|
||||
function hasValidExtension(path, context) {
|
||||
// eslint-disable-next-line no-extra-parens
|
||||
return validExtensions(context).has(/** @type {import('./types').Extension} */ (extname(path)));
|
||||
}
|
||||
exports.hasValidExtension = hasValidExtension;
|
||||
|
||||
/** @type {import('./ignore').default} */
|
||||
exports.default = function ignore(path, context) {
|
||||
// check extension whitelist first (cheap)
|
||||
if (!hasValidExtension(path, context)) { return true; }
|
||||
|
|
@ -54,8 +67,3 @@ exports.default = function ignore(path, context) {
|
|||
|
||||
return false;
|
||||
};
|
||||
|
||||
function hasValidExtension(path, context) {
|
||||
return validExtensions(context).has(extname(path));
|
||||
}
|
||||
exports.hasValidExtension = hasValidExtension;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue