Bump the npm group with 2 updates (#1819)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.45.0 to 8.46.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.45.0...v8.46.0) Updates `eslint-plugin-import` from 2.27.5 to 2.28.0 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.27.5...v2.28.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
a6b0ced86b
commit
e7e35baaf0
1408 changed files with 27215 additions and 9910 deletions
63
node_modules/eslint-module-utils/resolve.js
generated
vendored
63
node_modules/eslint-module-utils/resolve.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const fs = require('fs');
|
||||
|
|
@ -53,16 +54,16 @@ function tryRequire(target, sourceFile) {
|
|||
// https://stackoverflow.com/a/27382838
|
||||
exports.fileExistsWithCaseSync = function fileExistsWithCaseSync(filepath, cacheSettings, strict) {
|
||||
// don't care if the FS is case-sensitive
|
||||
if (CASE_SENSITIVE_FS) return true;
|
||||
if (CASE_SENSITIVE_FS) { return true; }
|
||||
|
||||
// null means it resolved to a builtin
|
||||
if (filepath === null) return true;
|
||||
if (filepath.toLowerCase() === process.cwd().toLowerCase() && !strict) return true;
|
||||
if (filepath === null) { return true; }
|
||||
if (filepath.toLowerCase() === process.cwd().toLowerCase() && !strict) { return true; }
|
||||
const parsedPath = path.parse(filepath);
|
||||
const dir = parsedPath.dir;
|
||||
|
||||
let result = fileExistsCache.get(filepath, cacheSettings);
|
||||
if (result != null) return result;
|
||||
if (result != null) { return result; }
|
||||
|
||||
// base case
|
||||
if (dir === '' || parsedPath.root === filepath) {
|
||||
|
|
@ -83,51 +84,47 @@ function relative(modulePath, sourceFile, settings) {
|
|||
return fullResolve(modulePath, sourceFile, settings).path;
|
||||
}
|
||||
|
||||
let prevSettings = null;
|
||||
let memoizedHash = '';
|
||||
function fullResolve(modulePath, sourceFile, settings) {
|
||||
// check if this is a bonus core module
|
||||
const coreSet = new Set(settings['import/core-modules']);
|
||||
if (coreSet.has(modulePath)) return { found: true, path: null };
|
||||
if (coreSet.has(modulePath)) { return { found: true, path: null }; }
|
||||
|
||||
const sourceDir = path.dirname(sourceFile);
|
||||
const cacheKey = sourceDir + hashObject(settings).digest('hex') + modulePath;
|
||||
|
||||
if (prevSettings !== settings) {
|
||||
memoizedHash = hashObject(settings).digest('hex');
|
||||
prevSettings = settings;
|
||||
}
|
||||
|
||||
const cacheKey = sourceDir + memoizedHash + modulePath;
|
||||
|
||||
const cacheSettings = ModuleCache.getSettings(settings);
|
||||
|
||||
const cachedPath = fileExistsCache.get(cacheKey, cacheSettings);
|
||||
if (cachedPath !== undefined) return { found: true, path: cachedPath };
|
||||
if (cachedPath !== undefined) { return { found: true, path: cachedPath }; }
|
||||
|
||||
function cache(resolvedPath) {
|
||||
fileExistsCache.set(cacheKey, resolvedPath);
|
||||
}
|
||||
|
||||
function withResolver(resolver, config) {
|
||||
|
||||
function v1() {
|
||||
try {
|
||||
const resolved = resolver.resolveImport(modulePath, sourceFile, config);
|
||||
if (resolved === undefined) return { found: false };
|
||||
return { found: true, path: resolved };
|
||||
} catch (err) {
|
||||
return { found: false };
|
||||
}
|
||||
}
|
||||
|
||||
function v2() {
|
||||
if (resolver.interfaceVersion === 2) {
|
||||
return resolver.resolve(modulePath, sourceFile, config);
|
||||
}
|
||||
|
||||
switch (resolver.interfaceVersion) {
|
||||
case 2:
|
||||
return v2();
|
||||
|
||||
default:
|
||||
case 1:
|
||||
return v1();
|
||||
try {
|
||||
const resolved = resolver.resolveImport(modulePath, sourceFile, config);
|
||||
if (resolved === undefined) { return { found: false }; }
|
||||
return { found: true, path: resolved };
|
||||
} catch (err) {
|
||||
return { found: false };
|
||||
}
|
||||
}
|
||||
|
||||
const configResolvers = (settings['import/resolver']
|
||||
|| { 'node': settings['import/resolve'] }); // backward compatibility
|
||||
const configResolvers = settings['import/resolver']
|
||||
|| { node: settings['import/resolve'] }; // backward compatibility
|
||||
|
||||
const resolvers = resolverReducer(configResolvers, new Map());
|
||||
|
||||
|
|
@ -137,7 +134,7 @@ function fullResolve(modulePath, sourceFile, settings) {
|
|||
const resolver = requireResolver(name, sourceFile);
|
||||
const resolved = withResolver(resolver, config);
|
||||
|
||||
if (!resolved.found) continue;
|
||||
if (!resolved.found) { continue; }
|
||||
|
||||
// else, counts
|
||||
cache(resolved.path);
|
||||
|
|
@ -152,7 +149,7 @@ exports.relative = relative;
|
|||
|
||||
function resolverReducer(resolvers, map) {
|
||||
if (Array.isArray(resolvers)) {
|
||||
resolvers.forEach(r => resolverReducer(r, map));
|
||||
resolvers.forEach((r) => resolverReducer(r, map));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
@ -178,9 +175,9 @@ function getBaseDir(sourceFile) {
|
|||
}
|
||||
function requireResolver(name, sourceFile) {
|
||||
// Try to resolve package with conventional name
|
||||
const resolver = tryRequire(`eslint-import-resolver-${name}`, sourceFile) ||
|
||||
tryRequire(name, sourceFile) ||
|
||||
tryRequire(path.resolve(getBaseDir(sourceFile), name));
|
||||
const resolver = tryRequire(`eslint-import-resolver-${name}`, sourceFile)
|
||||
|| tryRequire(name, sourceFile)
|
||||
|| tryRequire(path.resolve(getBaseDir(sourceFile), name));
|
||||
|
||||
if (!resolver) {
|
||||
const err = new Error(`unable to load resolver "${name}".`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue