Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2024-09-16 17:29:58 +00:00
parent 1afca056e3
commit 6989ba7bd2
3942 changed files with 55190 additions and 132206 deletions

View file

@ -5,6 +5,21 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
## Unreleased
## v2.11.0 - 2024-09-05
### New
- `declaredScope`: take a `node` for modern eslint versions (thanks [@michaelfaith])
## v2.10.0 - 2024-09-05
### New
- add context compatibility helpers ([#3049], thanks [@michaelfaith])
## v2.9.0 - 2024-09-02
### New
- add support for Flat Config ([#3018], thanks [@michaelfaith])
## v2.8.2 - 2024-08-25
### Fixed
@ -150,7 +165,9 @@ Yanked due to critical issue with cache key resulting from #839.
### Fixed
- `unambiguous.test()` regex is now properly in multiline mode
[#3049]: https://github.com/import-js/eslint-plugin-import/pull/3049
[#3039]: https://github.com/import-js/eslint-plugin-import/pull/3039
[#3018]: https://github.com/import-js/eslint-plugin-import/pull/3018
[#2963]: https://github.com/import-js/eslint-plugin-import/pull/2963
[#2755]: https://github.com/import-js/eslint-plugin-import/pull/2755
[#2714]: https://github.com/import-js/eslint-plugin-import/pull/2714
@ -197,6 +214,7 @@ Yanked due to critical issue with cache key resulting from #839.
[@manuth]: https://github.com/manuth
[@maxkomarychev]: https://github.com/maxkomarychev
[@mgwalker]: https://github.com/mgwalker
[@michaelfaith]: https://github.com/michaelfaith
[@Mysak0CZ]: https://github.com/Mysak0CZ
[@nicolo-ribaudo]: https://github.com/nicolo-ribaudo
[@pmcelhaney]: https://github.com/pmcelhaney

38
node_modules/eslint-module-utils/contextCompat.d.ts generated vendored Normal file
View file

@ -0,0 +1,38 @@
import { Scope, SourceCode, Rule } from 'eslint';
import * as ESTree from 'estree';
type LegacyContext = {
getFilename: () => string,
getPhysicalFilename: () => string,
getSourceCode: () => SourceCode,
getScope: never,
getAncestors: never,
getDeclaredVariables: never,
};
type NewContext = {
filename: string,
sourceCode: SourceCode,
getPhysicalFilename?: () => string,
getScope: () => Scope.Scope,
getAncestors: () => ESTree.Node[],
getDeclaredVariables: (node: ESTree.Node) => Scope.Variable[],
};
export type Context = LegacyContext | NewContext | Rule.RuleContext;
declare function getAncestors(context: Context, node: ESTree.Node): ESTree.Node[];
declare function getDeclaredVariables(context: Context, node: ESTree.Node): Scope.Variable[];
declare function getFilename(context: Context): string;
declare function getPhysicalFilename(context: Context): string;
declare function getScope(context: Context, node: ESTree.Node): Scope.Scope;
declare function getSourceCode(context: Context): SourceCode;
export {
getAncestors,
getDeclaredVariables,
getFilename,
getPhysicalFilename,
getScope,
getSourceCode,
};

72
node_modules/eslint-module-utils/contextCompat.js generated vendored Normal file
View file

@ -0,0 +1,72 @@
'use strict';
exports.__esModule = true;
/** @type {import('./contextCompat').getAncestors} */
function getAncestors(context, node) {
const sourceCode = getSourceCode(context);
if (sourceCode && sourceCode.getAncestors) {
return sourceCode.getAncestors(node);
}
return context.getAncestors();
}
/** @type {import('./contextCompat').getDeclaredVariables} */
function getDeclaredVariables(context, node) {
const sourceCode = getSourceCode(context);
if (sourceCode && sourceCode.getDeclaredVariables) {
return sourceCode.getDeclaredVariables(node);
}
return context.getDeclaredVariables(node);
}
/** @type {import('./contextCompat').getFilename} */
function getFilename(context) {
if ('filename' in context) {
return context.filename;
}
return context.getFilename();
}
/** @type {import('./contextCompat').getPhysicalFilename} */
function getPhysicalFilename(context) {
if (context.getPhysicalFilename) {
return context.getPhysicalFilename();
}
return getFilename(context);
}
/** @type {import('./contextCompat').getScope} */
function getScope(context, node) {
const sourceCode = getSourceCode(context);
if (sourceCode && sourceCode.getScope) {
return sourceCode.getScope(node);
}
return context.getScope();
}
/** @type {import('./contextCompat').getSourceCode} */
function getSourceCode(context) {
if ('sourceCode' in context) {
return context.sourceCode;
}
return context.getSourceCode();
}
module.exports = {
getAncestors,
getDeclaredVariables,
getFilename,
getPhysicalFilename,
getScope,
getSourceCode,
};

View file

@ -1,8 +1,10 @@
import { Rule, Scope } from 'eslint';
import * as ESTree from 'estree';
declare function declaredScope(
context: Rule.RuleContext,
name: string
name: string,
node?: ESTree.Node,
): Scope.Scope['type'] | undefined;
export default declaredScope;

View file

@ -2,9 +2,11 @@
exports.__esModule = true;
const { getScope } = require('./contextCompat');
/** @type {import('./declaredScope').default} */
exports.default = function declaredScope(context, name) {
const references = context.getScope().references;
exports.default = function declaredScope(context, name, node) {
const references = (node ? getScope(context, node) : context.getScope()).references;
const reference = references.find((x) => x.identifier.name === name);
if (!reference || !reference.resolved) { return undefined; }
return reference.resolved.scope.type;

View file

@ -14,7 +14,7 @@ const log = require('debug')('eslint-plugin-import:utils:ignore');
function makeValidExtensionSet(settings) {
// start with explicit JS-parsed extensions
/** @type {Set<import('./types').Extension>} */
const exts = new Set(settings['import/extensions'] || ['.js']);
const exts = new Set(settings['import/extensions'] || ['.js', '.mjs', '.cjs']);
// all alternate parser extensions are also valid
if ('import/parsers' in settings) {
@ -52,9 +52,13 @@ exports.hasValidExtension = hasValidExtension;
/** @type {import('./ignore').default} */
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++) {

View file

@ -1,12 +1,13 @@
{
"name": "eslint-module-utils",
"version": "2.8.2",
"version": "2.11.0",
"description": "Core utilities to support eslint-plugin-import and other module-related plugins.",
"engines": {
"node": ">=4"
},
"main": false,
"exports": {
"./contextCompat": "./contextCompat.js",
"./ModuleCache": "./ModuleCache.js",
"./ModuleCache.js": "./ModuleCache.js",
"./declaredScope": "./declaredScope.js",

View file

@ -5,6 +5,7 @@ exports.__esModule = true;
const fs = require('fs');
const Module = require('module');
const path = require('path');
const { getPhysicalFilename } = require('./contextCompat');
const hashObject = require('./hash').hashObject;
const ModuleCache = require('./ModuleCache').default;
@ -229,7 +230,7 @@ const erroredContexts = new Set();
*/
function resolve(p, context) {
try {
return relative(p, context.getPhysicalFilename ? context.getPhysicalFilename() : context.getFilename(), context.settings);
return relative(p, getPhysicalFilename(context), context.settings);
} catch (err) {
if (!erroredContexts.has(context)) {
// The `err.stack` string starts with `err.name` followed by colon and `err.message`.