Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2024-02-26 18:08:09 +00:00
parent 36f1104e11
commit 66c3cec3e8
167 changed files with 6046 additions and 3631 deletions

30
node_modules/eslint/lib/api.js generated vendored
View file

@ -9,17 +9,45 @@
// Requirements
//-----------------------------------------------------------------------------
const { ESLint } = require("./eslint");
const { ESLint, FlatESLint } = require("./eslint");
const { shouldUseFlatConfig } = require("./eslint/flat-eslint");
const { Linter } = require("./linter");
const { RuleTester } = require("./rule-tester");
const { SourceCode } = require("./source-code");
//-----------------------------------------------------------------------------
// Functions
//-----------------------------------------------------------------------------
/**
* Loads the correct ESLint constructor given the options.
* @param {Object} [options] The options object
* @param {boolean} [options.useFlatConfig] Whether or not to use a flat config
* @param {string} [options.cwd] The current working directory
* @returns {Promise<ESLint|LegacyESLint>} The ESLint constructor
*/
async function loadESLint({ useFlatConfig, cwd = process.cwd() } = {}) {
/*
* Note: The v9.x version of this function doesn't have a cwd option
* because it's not used. It's only used in the v8.x version of this
* function.
*/
const shouldESLintUseFlatConfig = typeof useFlatConfig === "boolean"
? useFlatConfig
: await shouldUseFlatConfig({ cwd });
return shouldESLintUseFlatConfig ? FlatESLint : ESLint;
}
//-----------------------------------------------------------------------------
// Exports
//-----------------------------------------------------------------------------
module.exports = {
Linter,
loadESLint,
ESLint,
RuleTester,
SourceCode

View file

@ -53,6 +53,15 @@ function isNonNullObject(value) {
return typeof value === "object" && value !== null;
}
/**
* Check if a value is a non-null non-array object.
* @param {any} value The value to check.
* @returns {boolean} `true` if the value is a non-null non-array object.
*/
function isNonArrayObject(value) {
return isNonNullObject(value) && !Array.isArray(value);
}
/**
* Check if a value is undefined.
* @param {any} value The value to check.
@ -63,19 +72,27 @@ function isUndefined(value) {
}
/**
* Deeply merges two objects.
* Deeply merges two non-array objects.
* @param {Object} first The base object.
* @param {Object} second The overrides object.
* @param {Map<string, Map<string, Object>>} [mergeMap] Maps the combination of first and second arguments to a merged result.
* @returns {Object} An object with properties from both first and second.
*/
function deepMerge(first = {}, second = {}) {
function deepMerge(first, second, mergeMap = new Map()) {
/*
* If the second value is an array, just return it. We don't merge
* arrays because order matters and we can't know the correct order.
*/
if (Array.isArray(second)) {
return second;
let secondMergeMap = mergeMap.get(first);
if (secondMergeMap) {
const result = secondMergeMap.get(second);
if (result) {
// If this combination of first and second arguments has been already visited, return the previously created result.
return result;
}
} else {
secondMergeMap = new Map();
mergeMap.set(first, secondMergeMap);
}
/*
@ -89,27 +106,25 @@ function deepMerge(first = {}, second = {}) {
...second
};
delete result.__proto__; // eslint-disable-line no-proto -- don't merge own property "__proto__"
// Store the pending result for this combination of first and second arguments.
secondMergeMap.set(second, result);
for (const key of Object.keys(second)) {
// avoid hairy edge case
if (key === "__proto__") {
if (key === "__proto__" || !Object.prototype.propertyIsEnumerable.call(first, key)) {
continue;
}
const firstValue = first[key];
const secondValue = second[key];
if (isNonNullObject(firstValue)) {
result[key] = deepMerge(firstValue, secondValue);
} else if (isUndefined(firstValue)) {
if (isNonNullObject(secondValue)) {
result[key] = deepMerge(
Array.isArray(secondValue) ? [] : {},
secondValue
);
} else if (!isUndefined(secondValue)) {
result[key] = secondValue;
}
if (isNonArrayObject(firstValue) && isNonArrayObject(secondValue)) {
result[key] = deepMerge(firstValue, secondValue, mergeMap);
} else if (isUndefined(secondValue)) {
result[key] = firstValue;
}
}

View file

@ -682,6 +682,13 @@ class ESLint {
}
}
/**
* The type of configuration used by this class.
* @type {string}
* @static
*/
ESLint.configType = "eslintrc";
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------

View file

@ -91,7 +91,11 @@ const LintResultCache = require("../cli-engine/lint-result-cache");
// Helpers
//------------------------------------------------------------------------------
const FLAT_CONFIG_FILENAME = "eslint.config.js";
const FLAT_CONFIG_FILENAMES = [
"eslint.config.js",
"eslint.config.mjs",
"eslint.config.cjs"
];
const debug = require("debug")("eslint:flat-eslint");
const removedFormatters = new Set(["table", "codeframe"]);
const privateMembers = new WeakMap();
@ -248,7 +252,7 @@ function compareResultsByFilePath(a, b) {
*/
function findFlatConfigFile(cwd) {
return findUp(
FLAT_CONFIG_FILENAME,
FLAT_CONFIG_FILENAMES,
{ cwd }
);
}
@ -1112,11 +1116,20 @@ class FlatESLint {
}
}
/**
* The type of configuration used by this class.
* @type {string}
* @static
*/
FlatESLint.configType = "flat";
/**
* Returns whether flat config should be used.
* @param {Object} [options] The options for this function.
* @param {string} [options.cwd] The current working directory.
* @returns {Promise<boolean>} Whether flat config should be used.
*/
async function shouldUseFlatConfig() {
async function shouldUseFlatConfig({ cwd = process.cwd() } = {}) {
switch (process.env.ESLINT_USE_FLAT_CONFIG) {
case "true":
return true;
@ -1128,7 +1141,7 @@ async function shouldUseFlatConfig() {
* If neither explicitly enabled nor disabled, then use the presence
* of a flat config file to determine enablement.
*/
return !!(await findFlatConfigFile(process.cwd()));
return !!(await findFlatConfigFile(cwd));
}
}

2
node_modules/eslint/lib/options.js generated vendored
View file

@ -168,7 +168,7 @@ module.exports = function(usingFlatConfig) {
alias: "c",
type: "path::String",
description: usingFlatConfig
? "Use this configuration instead of eslint.config.js"
? "Use this configuration instead of eslint.config.js, eslint.config.mjs, or eslint.config.cjs"
: "Use this configuration, overriding .eslintrc.* config options if present"
},
envFlag,

View file

@ -13,6 +13,7 @@
const
assert = require("assert"),
util = require("util"),
path = require("path"),
equal = require("fast-deep-equal"),
Traverser = require("../shared/traverser"),
{ getRuleOptionsSchema } = require("../config/flat-config-helpers"),
@ -592,7 +593,15 @@ class FlatRuleTester {
* @private
*/
function runRuleForItem(item) {
const configs = new FlatConfigArray(testerConfig, { baseConfig });
const flatConfigArrayOptions = {
baseConfig
};
if (item.filename) {
flatConfigArrayOptions.basePath = path.parse(item.filename).root;
}
const configs = new FlatConfigArray(testerConfig, flatConfigArrayOptions);
/*
* Modify the returned config so that the parser is wrapped to catch

8
node_modules/eslint/package.json generated vendored
View file

@ -1,6 +1,6 @@
{
"name": "eslint",
"version": "8.56.0",
"version": "8.57.0",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
"description": "An AST-based pattern checker for JavaScript.",
"bin": {
@ -65,8 +65,8 @@
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "8.56.0",
"@humanwhocodes/config-array": "^0.11.13",
"@eslint/js": "8.57.0",
"@humanwhocodes/config-array": "^0.11.14",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"@ungap/structured-clone": "^1.2.0",
@ -122,7 +122,7 @@
"eslint-plugin-eslint-plugin": "^5.2.1",
"eslint-plugin-internal-rules": "file:tools/internal-rules",
"eslint-plugin-jsdoc": "^46.2.5",
"eslint-plugin-n": "^16.4.0",
"eslint-plugin-n": "^16.6.0",
"eslint-plugin-unicorn": "^49.0.0",
"eslint-release": "^3.2.0",
"eslump": "^3.0.0",