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
14
node_modules/eslint-module-utils/CHANGELOG.md
generated
vendored
14
node_modules/eslint-module-utils/CHANGELOG.md
generated
vendored
|
|
@ -5,6 +5,14 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
|
|||
|
||||
## Unreleased
|
||||
|
||||
## v2.8.0 - 2023-04-14
|
||||
|
||||
### New
|
||||
- `parse`: support flat config ([#2714], thanks [@DMartens])
|
||||
|
||||
### Fixed
|
||||
- Improve performance of `fullResolve` for large projects ([#2755], thanks [@leipert])
|
||||
|
||||
## v2.7.4 - 2022-08-11
|
||||
|
||||
### Fixed
|
||||
|
|
@ -16,7 +24,7 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
|
|||
## v2.7.3 - 2022-01-26
|
||||
|
||||
### Fixed
|
||||
- [Fix] `parse`: restore compatibility by making the return value `ast` again ([#2350], thanks [@ljharb])
|
||||
- `parse`: restore compatibility by making the return value `ast` again ([#2350], thanks [@ljharb])
|
||||
|
||||
## v2.7.2 - 2022-01-01
|
||||
|
||||
|
|
@ -123,6 +131,8 @@ Yanked due to critical issue with cache key resulting from #839.
|
|||
### Fixed
|
||||
- `unambiguous.test()` regex is now properly in multiline mode
|
||||
|
||||
[#2755]: https://github.com/import-js/eslint-plugin-import/pull/2755
|
||||
[#2714]: https://github.com/import-js/eslint-plugin-import/pull/2714
|
||||
[#2523]: https://github.com/import-js/eslint-plugin-import/pull/2523
|
||||
[#2431]: https://github.com/import-js/eslint-plugin-import/pull/2431
|
||||
[#2350]: https://github.com/import-js/eslint-plugin-import/issues/2350
|
||||
|
|
@ -155,11 +165,13 @@ Yanked due to critical issue with cache key resulting from #839.
|
|||
[@bradzacher]: https://github.com/bradzacher
|
||||
[@brettz9]: https://github.com/brettz9
|
||||
[@christophercurrie]: https://github.com/christophercurrie
|
||||
[@DMartens]: https://github.com/DMartens
|
||||
[@hulkish]: https://github.com/hulkish
|
||||
[@Hypnosphi]: https://github.com/Hypnosphi
|
||||
[@iamnapo]: https://github.com/iamnapo
|
||||
[@JounQin]: https://github.com/JounQin
|
||||
[@kaiyoma]: https://github.com/kaiyoma
|
||||
[@leipert]: https://github.com/leipert
|
||||
[@manuth]: https://github.com/manuth
|
||||
[@maxkomarychev]: https://github.com/maxkomarychev
|
||||
[@mgwalker]: https://github.com/mgwalker
|
||||
|
|
|
|||
7
node_modules/eslint-module-utils/ModuleCache.js
generated
vendored
7
node_modules/eslint-module-utils/ModuleCache.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const log = require('debug')('eslint-module-utils:ModuleCache');
|
||||
|
|
@ -23,8 +24,10 @@ class ModuleCache {
|
|||
if (this.map.has(cacheKey)) {
|
||||
const f = this.map.get(cacheKey);
|
||||
// check freshness
|
||||
if (process.hrtime(f.lastSeen)[0] < settings.lifetime) return f.result;
|
||||
} else log('cache miss for', cacheKey);
|
||||
if (process.hrtime(f.lastSeen)[0] < settings.lifetime) { return f.result; }
|
||||
} else {
|
||||
log('cache miss for', cacheKey);
|
||||
}
|
||||
// cache miss
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
|||
5
node_modules/eslint-module-utils/declaredScope.js
generated
vendored
5
node_modules/eslint-module-utils/declaredScope.js
generated
vendored
|
|
@ -1,9 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
exports.default = function declaredScope(context, name) {
|
||||
const references = context.getScope().references;
|
||||
const reference = references.find(x => x.identifier.name === name);
|
||||
if (!reference) return undefined;
|
||||
const reference = references.find((x) => x.identifier.name === name);
|
||||
if (!reference) { return undefined; }
|
||||
return reference.resolved.scope.type;
|
||||
};
|
||||
|
|
|
|||
11
node_modules/eslint-module-utils/hash.js
generated
vendored
11
node_modules/eslint-module-utils/hash.js
generated
vendored
|
|
@ -2,7 +2,9 @@
|
|||
* utilities for hashing config objects.
|
||||
* basically iteratively updates hash with a JSON-like format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const createHash = require('crypto').createHash;
|
||||
|
|
@ -10,7 +12,7 @@ const createHash = require('crypto').createHash;
|
|||
const stringify = JSON.stringify;
|
||||
|
||||
function hashify(value, hash) {
|
||||
if (!hash) hash = createHash('sha256');
|
||||
if (!hash) { hash = createHash('sha256'); }
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
hashArray(value, hash);
|
||||
|
|
@ -25,7 +27,7 @@ function hashify(value, hash) {
|
|||
exports.default = hashify;
|
||||
|
||||
function hashArray(array, hash) {
|
||||
if (!hash) hash = createHash('sha256');
|
||||
if (!hash) { hash = createHash('sha256'); }
|
||||
|
||||
hash.update('[');
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
|
|
@ -40,10 +42,10 @@ hashify.array = hashArray;
|
|||
exports.hashArray = hashArray;
|
||||
|
||||
function hashObject(object, hash) {
|
||||
if (!hash) hash = createHash('sha256');
|
||||
if (!hash) { hash = createHash('sha256'); }
|
||||
|
||||
hash.update('{');
|
||||
Object.keys(object).sort().forEach(key => {
|
||||
Object.keys(object).sort().forEach((key) => {
|
||||
hash.update(stringify(key));
|
||||
hash.update(':');
|
||||
hashify(object[key], hash);
|
||||
|
|
@ -56,4 +58,3 @@ function hashObject(object, hash) {
|
|||
hashify.object = hashObject;
|
||||
exports.hashObject = hashObject;
|
||||
|
||||
|
||||
|
|
|
|||
7
node_modules/eslint-module-utils/ignore.js
generated
vendored
7
node_modules/eslint-module-utils/ignore.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const extname = require('path').extname;
|
||||
|
|
@ -28,7 +29,7 @@ function makeValidExtensionSet(settings) {
|
|||
if (!Array.isArray(parserSettings)) {
|
||||
throw new TypeError('"settings" for ' + parser + ' must be an array');
|
||||
}
|
||||
parserSettings.forEach(ext => exts.add(ext));
|
||||
parserSettings.forEach((ext) => exts.add(ext));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,9 +39,9 @@ exports.getFileExtensions = makeValidExtensionSet;
|
|||
|
||||
exports.default = function ignore(path, context) {
|
||||
// check extension whitelist first (cheap)
|
||||
if (!hasValidExtension(path, context)) return true;
|
||||
if (!hasValidExtension(path, context)) { return true; }
|
||||
|
||||
if (!('import/ignore' in context.settings)) return false;
|
||||
if (!('import/ignore' in context.settings)) { return false; }
|
||||
const ignoreStrings = context.settings['import/ignore'];
|
||||
|
||||
for (let i = 0; i < ignoreStrings.length; i++) {
|
||||
|
|
|
|||
1
node_modules/eslint-module-utils/module-require.js
generated
vendored
1
node_modules/eslint-module-utils/module-require.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const Module = require('module');
|
||||
|
|
|
|||
88
node_modules/eslint-module-utils/moduleVisitor.js
generated
vendored
88
node_modules/eslint-module-utils/moduleVisitor.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
/**
|
||||
|
|
@ -16,14 +17,14 @@ exports.default = function visitModules(visitor, options) {
|
|||
|
||||
let ignoreRegExps = [];
|
||||
if (options.ignore != null) {
|
||||
ignoreRegExps = options.ignore.map(p => new RegExp(p));
|
||||
ignoreRegExps = options.ignore.map((p) => new RegExp(p));
|
||||
}
|
||||
|
||||
function checkSourceValue(source, importer) {
|
||||
if (source == null) return; //?
|
||||
if (source == null) { return; } //?
|
||||
|
||||
// handle ignore
|
||||
if (ignoreRegExps.some(re => re.test(source.value))) return;
|
||||
if (ignoreRegExps.some((re) => re.test(source.value))) { return; }
|
||||
|
||||
// fire visitor
|
||||
visitor(source, importer);
|
||||
|
|
@ -41,14 +42,14 @@ exports.default = function visitModules(visitor, options) {
|
|||
if (node.type === 'ImportExpression') {
|
||||
modulePath = node.source;
|
||||
} else if (node.type === 'CallExpression') {
|
||||
if (node.callee.type !== 'Import') return;
|
||||
if (node.arguments.length !== 1) return;
|
||||
if (node.callee.type !== 'Import') { return; }
|
||||
if (node.arguments.length !== 1) { return; }
|
||||
|
||||
modulePath = node.arguments[0];
|
||||
}
|
||||
|
||||
if (modulePath.type !== 'Literal') return;
|
||||
if (typeof modulePath.value !== 'string') return;
|
||||
if (modulePath.type !== 'Literal') { return; }
|
||||
if (typeof modulePath.value !== 'string') { return; }
|
||||
|
||||
checkSourceValue(modulePath, node);
|
||||
}
|
||||
|
|
@ -56,32 +57,35 @@ exports.default = function visitModules(visitor, options) {
|
|||
// for CommonJS `require` calls
|
||||
// adapted from @mctep: https://git.io/v4rAu
|
||||
function checkCommon(call) {
|
||||
if (call.callee.type !== 'Identifier') return;
|
||||
if (call.callee.name !== 'require') return;
|
||||
if (call.arguments.length !== 1) return;
|
||||
if (call.callee.type !== 'Identifier') { return; }
|
||||
if (call.callee.name !== 'require') { return; }
|
||||
if (call.arguments.length !== 1) { return; }
|
||||
|
||||
const modulePath = call.arguments[0];
|
||||
if (modulePath.type !== 'Literal') return;
|
||||
if (typeof modulePath.value !== 'string') return;
|
||||
if (modulePath.type !== 'Literal') { return; }
|
||||
if (typeof modulePath.value !== 'string') { return; }
|
||||
|
||||
checkSourceValue(modulePath, call);
|
||||
}
|
||||
|
||||
function checkAMD(call) {
|
||||
if (call.callee.type !== 'Identifier') return;
|
||||
if (call.callee.name !== 'require' &&
|
||||
call.callee.name !== 'define') return;
|
||||
if (call.arguments.length !== 2) return;
|
||||
if (call.callee.type !== 'Identifier') { return; }
|
||||
if (call.callee.name !== 'require' && call.callee.name !== 'define') { return; }
|
||||
if (call.arguments.length !== 2) { return; }
|
||||
|
||||
const modules = call.arguments[0];
|
||||
if (modules.type !== 'ArrayExpression') return;
|
||||
if (modules.type !== 'ArrayExpression') { return; }
|
||||
|
||||
for (const element of modules.elements) {
|
||||
if (element.type !== 'Literal') continue;
|
||||
if (typeof element.value !== 'string') continue;
|
||||
if (element.type !== 'Literal') { continue; }
|
||||
if (typeof element.value !== 'string') { continue; }
|
||||
|
||||
if (element.value === 'require' ||
|
||||
element.value === 'exports') continue; // magic modules: https://github.com/requirejs/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#magic-modules
|
||||
if (
|
||||
element.value === 'require'
|
||||
|| element.value === 'exports'
|
||||
) {
|
||||
continue; // magic modules: https://github.com/requirejs/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#magic-modules
|
||||
}
|
||||
|
||||
checkSourceValue(element, element);
|
||||
}
|
||||
|
|
@ -90,20 +94,20 @@ exports.default = function visitModules(visitor, options) {
|
|||
const visitors = {};
|
||||
if (options.esmodule) {
|
||||
Object.assign(visitors, {
|
||||
'ImportDeclaration': checkSource,
|
||||
'ExportNamedDeclaration': checkSource,
|
||||
'ExportAllDeclaration': checkSource,
|
||||
'CallExpression': checkImportCall,
|
||||
'ImportExpression': checkImportCall,
|
||||
ImportDeclaration: checkSource,
|
||||
ExportNamedDeclaration: checkSource,
|
||||
ExportAllDeclaration: checkSource,
|
||||
CallExpression: checkImportCall,
|
||||
ImportExpression: checkImportCall,
|
||||
});
|
||||
}
|
||||
|
||||
if (options.commonjs || options.amd) {
|
||||
const currentCallExpression = visitors['CallExpression'];
|
||||
visitors['CallExpression'] = function (call) {
|
||||
if (currentCallExpression) currentCallExpression(call);
|
||||
if (options.commonjs) checkCommon(call);
|
||||
if (options.amd) checkAMD(call);
|
||||
const currentCallExpression = visitors.CallExpression;
|
||||
visitors.CallExpression = function (call) {
|
||||
if (currentCallExpression) { currentCallExpression(call); }
|
||||
if (options.commonjs) { checkCommon(call); }
|
||||
if (options.amd) { checkAMD(call); }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -116,19 +120,19 @@ exports.default = function visitModules(visitor, options) {
|
|||
*/
|
||||
function makeOptionsSchema(additionalProperties) {
|
||||
const base = {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'commonjs': { 'type': 'boolean' },
|
||||
'amd': { 'type': 'boolean' },
|
||||
'esmodule': { 'type': 'boolean' },
|
||||
'ignore': {
|
||||
'type': 'array',
|
||||
'minItems': 1,
|
||||
'items': { 'type': 'string' },
|
||||
'uniqueItems': true,
|
||||
type: 'object',
|
||||
properties: {
|
||||
commonjs: { type: 'boolean' },
|
||||
amd: { type: 'boolean' },
|
||||
esmodule: { type: 'boolean' },
|
||||
ignore: {
|
||||
type: 'array',
|
||||
minItems: 1,
|
||||
items: { type: 'string' },
|
||||
uniqueItems: true,
|
||||
},
|
||||
},
|
||||
'additionalProperties': false,
|
||||
additionalProperties: false,
|
||||
};
|
||||
|
||||
if (additionalProperties) {
|
||||
|
|
|
|||
2
node_modules/eslint-module-utils/package.json
generated
vendored
2
node_modules/eslint-module-utils/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "eslint-module-utils",
|
||||
"version": "2.7.4",
|
||||
"version": "2.8.0",
|
||||
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
|
|
|
|||
44
node_modules/eslint-module-utils/parse.js
generated
vendored
44
node_modules/eslint-module-utils/parse.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const moduleRequire = require('./module-require').default;
|
||||
|
|
@ -23,10 +24,10 @@ function keysFromParser(parserPath, parserInstance, parsedResult) {
|
|||
if (parsedResult && parsedResult.visitorKeys) {
|
||||
return parsedResult.visitorKeys;
|
||||
}
|
||||
if (/.*espree.*/.test(parserPath)) {
|
||||
if (typeof parserPath === 'string' && (/.*espree.*/).test(parserPath)) {
|
||||
return parserInstance.VisitorKeys;
|
||||
}
|
||||
if (/.*babel-eslint.*/.test(parserPath)) {
|
||||
if (typeof parserPath === 'string' && (/.*babel-eslint.*/).test(parserPath)) {
|
||||
return getBabelEslintVisitorKeys(parserPath);
|
||||
}
|
||||
return null;
|
||||
|
|
@ -51,13 +52,13 @@ function transformHashbang(text) {
|
|||
}
|
||||
|
||||
exports.default = function parse(path, content, context) {
|
||||
if (context == null) { throw new Error('need context to parse properly'); }
|
||||
|
||||
if (context == null) throw new Error('need context to parse properly');
|
||||
// ESLint in "flat" mode only sets context.languageOptions.parserOptions
|
||||
let parserOptions = context.languageOptions && context.languageOptions.parserOptions || context.parserOptions;
|
||||
const parserOrPath = getParser(path, context);
|
||||
|
||||
let parserOptions = context.parserOptions;
|
||||
const parserPath = getParserPath(path, context);
|
||||
|
||||
if (!parserPath) throw new Error('parserPath is required!');
|
||||
if (!parserOrPath) { throw new Error('parserPath or languageOptions.parser is required!'); }
|
||||
|
||||
// hack: espree blows up with frozen options
|
||||
parserOptions = Object.assign({}, parserOptions);
|
||||
|
|
@ -84,7 +85,7 @@ exports.default = function parse(path, content, context) {
|
|||
delete parserOptions.projects;
|
||||
|
||||
// require the parser relative to the main module (i.e., ESLint)
|
||||
const parser = moduleRequire(parserPath);
|
||||
const parser = typeof parserOrPath === 'string' ? moduleRequire(parserOrPath) : parserOrPath;
|
||||
|
||||
// replicate bom strip and hashbang transform of ESLint
|
||||
// https://github.com/eslint/eslint/blob/b93af98b3c417225a027cabc964c38e779adb945/lib/linter/linter.js#L779
|
||||
|
|
@ -95,7 +96,7 @@ exports.default = function parse(path, content, context) {
|
|||
try {
|
||||
const parserRaw = parser.parseForESLint(content, parserOptions);
|
||||
ast = parserRaw.ast;
|
||||
return makeParseReturn(ast, keysFromParser(parserPath, parser, parserRaw));
|
||||
return makeParseReturn(ast, keysFromParser(parserOrPath, parser, parserRaw));
|
||||
} catch (e) {
|
||||
console.warn();
|
||||
console.warn('Error while parsing ' + parserOptions.filePath);
|
||||
|
|
@ -103,19 +104,34 @@ exports.default = function parse(path, content, context) {
|
|||
}
|
||||
if (!ast || typeof ast !== 'object') {
|
||||
console.warn(
|
||||
'`parseForESLint` from parser `' +
|
||||
parserPath +
|
||||
'` is invalid and will just be ignored'
|
||||
// Can only be invalid for custom parser per imports/parser
|
||||
'`parseForESLint` from parser `' + (typeof parserOrPath === 'string' ? parserOrPath : '`context.languageOptions.parser`') + '` is invalid and will just be ignored'
|
||||
);
|
||||
} else {
|
||||
return makeParseReturn(ast, keysFromParser(parserPath, parser, undefined));
|
||||
return makeParseReturn(ast, keysFromParser(parserOrPath, parser, undefined));
|
||||
}
|
||||
}
|
||||
|
||||
const ast = parser.parse(content, parserOptions);
|
||||
return makeParseReturn(ast, keysFromParser(parserPath, parser, undefined));
|
||||
return makeParseReturn(ast, keysFromParser(parserOrPath, parser, undefined));
|
||||
};
|
||||
|
||||
function getParser(path, context) {
|
||||
const parserPath = getParserPath(path, context);
|
||||
if (parserPath) {
|
||||
return parserPath;
|
||||
}
|
||||
const isFlat = context.languageOptions
|
||||
&& context.languageOptions.parser
|
||||
&& typeof context.languageOptions.parser !== 'string'
|
||||
&& (
|
||||
typeof context.languageOptions.parser.parse === 'function'
|
||||
|| typeof context.languageOptions.parser.parseForESLint === 'function'
|
||||
);
|
||||
|
||||
return isFlat ? context.languageOptions.parser : null;
|
||||
}
|
||||
|
||||
function getParserPath(path, context) {
|
||||
const parsers = context.settings['import/parsers'];
|
||||
if (parsers != null) {
|
||||
|
|
|
|||
9
node_modules/eslint-module-utils/pkgUp.js
generated
vendored
9
node_modules/eslint-module-utils/pkgUp.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const fs = require('fs');
|
||||
|
|
@ -6,22 +7,22 @@ const path = require('path');
|
|||
|
||||
/**
|
||||
* Derived significantly from package find-up@2.0.0. See license below.
|
||||
*
|
||||
*
|
||||
* @copyright Sindre Sorhus
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
|
|
|||
9
node_modules/eslint-module-utils/readPkgUp.js
generated
vendored
9
node_modules/eslint-module-utils/readPkgUp.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const fs = require('fs');
|
||||
|
|
@ -10,22 +11,22 @@ function stripBOM(str) {
|
|||
|
||||
/**
|
||||
* Derived significantly from read-pkg-up@2.0.0. See license below.
|
||||
*
|
||||
*
|
||||
* @copyright Sindre Sorhus
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
|
|
|
|||
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}".`);
|
||||
|
|
|
|||
3
node_modules/eslint-module-utils/unambiguous.js
generated
vendored
3
node_modules/eslint-module-utils/unambiguous.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
const pattern = /(^|;)\s*(export|import)((\s+\w)|(\s*[{*=]))|import\(/m;
|
||||
|
|
@ -25,5 +26,5 @@ const unambiguousNodeType = /^(?:(?:Exp|Imp)ort.*Declaration|TSExportAssignment)
|
|||
* @return {Boolean}
|
||||
*/
|
||||
exports.isModule = function isUnambiguousModule(ast) {
|
||||
return ast.body && ast.body.some(node => unambiguousNodeType.test(node.type));
|
||||
return ast.body && ast.body.some((node) => unambiguousNodeType.test(node.type));
|
||||
};
|
||||
|
|
|
|||
1
node_modules/eslint-module-utils/visit.js
generated
vendored
1
node_modules/eslint-module-utils/visit.js
generated
vendored
|
|
@ -1,4 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
exports.default = function visit(node, keys, visitorSpec) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue