Update checked-in dependencies
This commit is contained in:
parent
a8ade63a2f
commit
452ffd6e8e
3120 changed files with 20845 additions and 14941 deletions
2
node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
2
node_modules/@eslint/eslintrc/conf/environments.js
generated
vendored
|
|
@ -23,7 +23,7 @@ function getDiff(current, prev) {
|
|||
const retv = {};
|
||||
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
if (!Object.hasOwnProperty.call(prev, key)) {
|
||||
if (!Object.hasOwn(prev, key)) {
|
||||
retv[key] = value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs
generated
vendored
33
node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs
generated
vendored
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var util = require('util');
|
||||
var path = require('path');
|
||||
var util = require('node:util');
|
||||
var path = require('node:path');
|
||||
var Ajv = require('ajv');
|
||||
var globals = require('globals');
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
|||
map[value] = index;
|
||||
return map;
|
||||
}, {}),
|
||||
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
||||
VALID_SEVERITIES = new Set([0, 1, 2, "off", "warn", "error"]);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
|
|
@ -99,7 +99,7 @@ function isValidSeverity(ruleConfig) {
|
|||
if (typeof severity === "string") {
|
||||
severity = severity.toLowerCase();
|
||||
}
|
||||
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
||||
return VALID_SEVERITIES.has(severity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -381,7 +381,7 @@ var ajvOrig = (additionalOptions = {}) => {
|
|||
});
|
||||
|
||||
ajv.addMetaSchema(metaSchema);
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
// eslint-disable-next-line no-underscore-dangle -- part of the API
|
||||
ajv._opts.defaultMeta = metaSchema.id;
|
||||
|
||||
return ajv;
|
||||
|
|
@ -541,7 +541,7 @@ function getDiff(current, prev) {
|
|||
const retv = {};
|
||||
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
if (!Object.hasOwnProperty.call(prev, key)) {
|
||||
if (!Object.hasOwn(prev, key)) {
|
||||
retv[key] = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -765,6 +765,9 @@ const noOptionsSchema = Object.freeze({
|
|||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validator for configuration objects.
|
||||
*/
|
||||
class ConfigValidator {
|
||||
constructor({ builtInRules = new Map() } = {}) {
|
||||
this.builtInRules = builtInRules;
|
||||
|
|
@ -824,6 +827,7 @@ class ConfigValidator {
|
|||
* Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.
|
||||
* @param {options} options The given options for the rule.
|
||||
* @returns {number|string} The rule's severity value
|
||||
* @throws {Error} If the severity is invalid.
|
||||
*/
|
||||
validateRuleSeverity(options) {
|
||||
const severity = Array.isArray(options) ? options[0] : options;
|
||||
|
|
@ -842,6 +846,7 @@ class ConfigValidator {
|
|||
* @param {{create: Function}} rule The rule to validate
|
||||
* @param {Array} localOptions The options for the rule, excluding severity
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleSchema(rule, localOptions) {
|
||||
if (!ruleValidators.has(rule)) {
|
||||
|
|
@ -883,6 +888,7 @@ class ConfigValidator {
|
|||
* @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,
|
||||
* no source is prepended to the message.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleOptions(rule, ruleId, options, source = null) {
|
||||
try {
|
||||
|
|
@ -914,8 +920,9 @@ class ConfigValidator {
|
|||
* Validates an environment object
|
||||
* @param {Object} environment The environment config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the environment is invalid.
|
||||
*/
|
||||
validateEnvironment(
|
||||
environment,
|
||||
|
|
@ -943,7 +950,7 @@ class ConfigValidator {
|
|||
* Validates a rules config object
|
||||
* @param {Object} rulesConfig The rules config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @param {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRules(
|
||||
|
|
@ -987,8 +994,9 @@ class ConfigValidator {
|
|||
* Validate `processor` configuration.
|
||||
* @param {string|undefined} processorName The processor name.
|
||||
* @param {string} source The name of config file.
|
||||
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
||||
* @param {(id:string) => Processor} getProcessor The getter of defined processors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the processor is invalid.
|
||||
*/
|
||||
validateProcessor(processorName, source, getProcessor) {
|
||||
if (processorName && !getProcessor(processorName)) {
|
||||
|
|
@ -1027,6 +1035,7 @@ class ConfigValidator {
|
|||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the config is invalid.
|
||||
*/
|
||||
validateConfigSchema(config, source = null) {
|
||||
validateSchema = validateSchema || ajv.compile(configSchema);
|
||||
|
|
@ -1035,7 +1044,7 @@ class ConfigValidator {
|
|||
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
||||
}
|
||||
|
||||
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
||||
if (Object.hasOwn(config, "ecmaFeatures")) {
|
||||
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
||||
}
|
||||
}
|
||||
|
|
@ -1044,8 +1053,8 @@ class ConfigValidator {
|
|||
* Validates an entire config object.
|
||||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @param {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @returns {void}
|
||||
*/
|
||||
validate(config, source, getAdditionalRule, getAdditionalEnv) {
|
||||
|
|
|
|||
2
node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map
generated
vendored
2
node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
93
node_modules/@eslint/eslintrc/dist/eslintrc.cjs
generated
vendored
93
node_modules/@eslint/eslintrc/dist/eslintrc.cjs
generated
vendored
|
|
@ -3,18 +3,18 @@
|
|||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var debugOrig = require('debug');
|
||||
var fs = require('fs');
|
||||
var fs = require('node:fs');
|
||||
var importFresh = require('import-fresh');
|
||||
var Module = require('module');
|
||||
var path = require('path');
|
||||
var Module = require('node:module');
|
||||
var path = require('node:path');
|
||||
var stripComments = require('strip-json-comments');
|
||||
var assert = require('assert');
|
||||
var assert = require('node:assert');
|
||||
var ignore = require('ignore');
|
||||
var util = require('util');
|
||||
var util = require('node:util');
|
||||
var minimatch = require('minimatch');
|
||||
var Ajv = require('ajv');
|
||||
var globals = require('globals');
|
||||
var os = require('os');
|
||||
var os = require('node:os');
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
|
|
@ -142,6 +142,9 @@ const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]);
|
|||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents a set of glob patterns to ignore against a base path.
|
||||
*/
|
||||
class IgnorePattern {
|
||||
|
||||
/**
|
||||
|
|
@ -178,9 +181,7 @@ class IgnorePattern {
|
|||
debug$3("Create with: %o", ignorePatterns);
|
||||
|
||||
const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));
|
||||
const patterns = [].concat(
|
||||
...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))
|
||||
);
|
||||
const patterns = ignorePatterns.flatMap(p => p.getPatternsRelativeTo(basePath));
|
||||
const ig = ignore__default["default"]({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]);
|
||||
const dotIg = ignore__default["default"]({ allowRelativePaths: true }).add(patterns);
|
||||
|
||||
|
|
@ -380,10 +381,10 @@ class ExtractedConfig {
|
|||
*/
|
||||
toCompatibleObjectAsConfigFileContent() {
|
||||
const {
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* eslint-disable no-unused-vars -- needed to make `config` correct */
|
||||
configNameOfNoInlineConfig: _ignore1,
|
||||
processor: _ignore2,
|
||||
/* eslint-enable no-unused-vars */
|
||||
/* eslint-enable no-unused-vars -- needed to make `config` correct */
|
||||
ignores,
|
||||
...config
|
||||
} = this;
|
||||
|
|
@ -575,6 +576,7 @@ class PluginConflictError extends Error {
|
|||
* @param {Record<string, DependentPlugin>} target The destination to merge
|
||||
* @param {Record<string, DependentPlugin>|undefined} source The source to merge.
|
||||
* @returns {void}
|
||||
* @throws {PluginConflictError} When a plugin was conflicted.
|
||||
*/
|
||||
function mergePlugins(target, source) {
|
||||
if (!isNonNullObject(source)) {
|
||||
|
|
@ -655,6 +657,7 @@ function mergeRuleConfigs(target, source) {
|
|||
* @param {ConfigArray} instance The config elements.
|
||||
* @param {number[]} indices The indices to use.
|
||||
* @returns {ExtractedConfig} The extracted config.
|
||||
* @throws {Error} When a plugin is conflicted.
|
||||
*/
|
||||
function createConfig(instance, indices) {
|
||||
const config = new ExtractedConfig();
|
||||
|
|
@ -988,8 +991,8 @@ class ConfigDependency {
|
|||
this.importerPath = importerPath;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Converts this instance to a JSON compatible object.
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
|
|
@ -1003,14 +1006,14 @@ class ConfigDependency {
|
|||
return obj;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Custom inspect method for Node.js `console.log()`.
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util__default["default"].inspect.custom]() {
|
||||
const {
|
||||
definition: _ignore1, // eslint-disable-line no-unused-vars
|
||||
original: _ignore2, // eslint-disable-line no-unused-vars
|
||||
definition: _ignore1, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
|
||||
original: _ignore2, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
|
||||
...obj
|
||||
} = this;
|
||||
|
||||
|
|
@ -1109,6 +1112,7 @@ class OverrideTester {
|
|||
* @param {string|string[]} excludedFiles The glob patterns for excluded files.
|
||||
* @param {string} basePath The path to the base directory to test paths.
|
||||
* @returns {OverrideTester|null} The created instance or `null`.
|
||||
* @throws {Error} When invalid patterns are given.
|
||||
*/
|
||||
static create(files, excludedFiles, basePath) {
|
||||
const includePatterns = normalizePatterns(files);
|
||||
|
|
@ -1198,6 +1202,7 @@ class OverrideTester {
|
|||
* Test if a given path is matched or not.
|
||||
* @param {string} filePath The absolute path to the target file.
|
||||
* @returns {boolean} `true` if the path was matched.
|
||||
* @throws {Error} When invalid `filePath` is given.
|
||||
*/
|
||||
test(filePath) {
|
||||
if (typeof filePath !== "string" || !path__default["default"].isAbsolute(filePath)) {
|
||||
|
|
@ -1211,8 +1216,8 @@ class OverrideTester {
|
|||
));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Converts this instance to a JSON compatible object.
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
|
|
@ -1228,8 +1233,8 @@ class OverrideTester {
|
|||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Custom inspect method for Node.js `console.log()`.
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util__default["default"].inspect.custom]() {
|
||||
|
|
@ -1257,7 +1262,7 @@ const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
|||
map[value] = index;
|
||||
return map;
|
||||
}, {}),
|
||||
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
||||
VALID_SEVERITIES = new Set([0, 1, 2, "off", "warn", "error"]);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
|
|
@ -1327,7 +1332,7 @@ function isValidSeverity(ruleConfig) {
|
|||
if (typeof severity === "string") {
|
||||
severity = severity.toLowerCase();
|
||||
}
|
||||
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
||||
return VALID_SEVERITIES.has(severity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1609,7 +1614,7 @@ var ajvOrig = (additionalOptions = {}) => {
|
|||
});
|
||||
|
||||
ajv.addMetaSchema(metaSchema);
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
// eslint-disable-next-line no-underscore-dangle -- part of the API
|
||||
ajv._opts.defaultMeta = metaSchema.id;
|
||||
|
||||
return ajv;
|
||||
|
|
@ -1769,7 +1774,7 @@ function getDiff(current, prev) {
|
|||
const retv = {};
|
||||
|
||||
for (const [key, value] of Object.entries(current)) {
|
||||
if (!Object.hasOwnProperty.call(prev, key)) {
|
||||
if (!Object.hasOwn(prev, key)) {
|
||||
retv[key] = value;
|
||||
}
|
||||
}
|
||||
|
|
@ -1993,6 +1998,9 @@ const noOptionsSchema = Object.freeze({
|
|||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validator for configuration objects.
|
||||
*/
|
||||
class ConfigValidator {
|
||||
constructor({ builtInRules = new Map() } = {}) {
|
||||
this.builtInRules = builtInRules;
|
||||
|
|
@ -2052,6 +2060,7 @@ class ConfigValidator {
|
|||
* Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.
|
||||
* @param {options} options The given options for the rule.
|
||||
* @returns {number|string} The rule's severity value
|
||||
* @throws {Error} If the severity is invalid.
|
||||
*/
|
||||
validateRuleSeverity(options) {
|
||||
const severity = Array.isArray(options) ? options[0] : options;
|
||||
|
|
@ -2070,6 +2079,7 @@ class ConfigValidator {
|
|||
* @param {{create: Function}} rule The rule to validate
|
||||
* @param {Array} localOptions The options for the rule, excluding severity
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleSchema(rule, localOptions) {
|
||||
if (!ruleValidators.has(rule)) {
|
||||
|
|
@ -2111,6 +2121,7 @@ class ConfigValidator {
|
|||
* @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,
|
||||
* no source is prepended to the message.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleOptions(rule, ruleId, options, source = null) {
|
||||
try {
|
||||
|
|
@ -2142,8 +2153,9 @@ class ConfigValidator {
|
|||
* Validates an environment object
|
||||
* @param {Object} environment The environment config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the environment is invalid.
|
||||
*/
|
||||
validateEnvironment(
|
||||
environment,
|
||||
|
|
@ -2171,7 +2183,7 @@ class ConfigValidator {
|
|||
* Validates a rules config object
|
||||
* @param {Object} rulesConfig The rules config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @param {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRules(
|
||||
|
|
@ -2215,8 +2227,9 @@ class ConfigValidator {
|
|||
* Validate `processor` configuration.
|
||||
* @param {string|undefined} processorName The processor name.
|
||||
* @param {string} source The name of config file.
|
||||
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
||||
* @param {(id:string) => Processor} getProcessor The getter of defined processors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the processor is invalid.
|
||||
*/
|
||||
validateProcessor(processorName, source, getProcessor) {
|
||||
if (processorName && !getProcessor(processorName)) {
|
||||
|
|
@ -2255,6 +2268,7 @@ class ConfigValidator {
|
|||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the config is invalid.
|
||||
*/
|
||||
validateConfigSchema(config, source = null) {
|
||||
validateSchema = validateSchema || ajv.compile(configSchema);
|
||||
|
|
@ -2263,7 +2277,7 @@ class ConfigValidator {
|
|||
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
||||
}
|
||||
|
||||
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
||||
if (Object.hasOwn(config, "ecmaFeatures")) {
|
||||
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
||||
}
|
||||
}
|
||||
|
|
@ -2272,8 +2286,8 @@ class ConfigValidator {
|
|||
* Validates an entire config object.
|
||||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @param {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @returns {void}
|
||||
*/
|
||||
validate(config, source, getAdditionalRule, getAdditionalEnv) {
|
||||
|
|
@ -2426,6 +2440,7 @@ const createRequire = Module__default["default"].createRequire;
|
|||
* @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be
|
||||
* a file rather than a directory, but the file need not actually exist.
|
||||
* @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`
|
||||
* @throws {Error} When the module cannot be resolved.
|
||||
*/
|
||||
function resolve(moduleName, relativeToPath) {
|
||||
try {
|
||||
|
|
@ -2686,7 +2701,7 @@ function loadPackageJSONConfigFile(filePath) {
|
|||
try {
|
||||
const packageData = loadJSONConfigFile(filePath);
|
||||
|
||||
if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) {
|
||||
if (!Object.hasOwn(packageData, "eslintConfig")) {
|
||||
throw Object.assign(
|
||||
new Error("package.json file doesn't have 'eslintConfig' field."),
|
||||
{ code: "ESLINT_CONFIG_FIELD_NOT_FOUND" }
|
||||
|
|
@ -2705,6 +2720,7 @@ function loadPackageJSONConfigFile(filePath) {
|
|||
* Loads a `.eslintignore` from a file.
|
||||
* @param {string} filePath The filename to load.
|
||||
* @returns {string[]} The ignore patterns from the file.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
* @private
|
||||
*/
|
||||
function loadESLintIgnoreFile(filePath) {
|
||||
|
|
@ -2777,7 +2793,7 @@ function loadConfigFile(filePath) {
|
|||
function writeDebugLogForLoading(request, relativeTo, filePath) {
|
||||
/* istanbul ignore next */
|
||||
if (debug$2.enabled) {
|
||||
let nameAndVersion = null;
|
||||
let nameAndVersion = null; // eslint-disable-line no-useless-assignment -- known bug in the rule
|
||||
|
||||
try {
|
||||
const packageJsonPath = resolve(
|
||||
|
|
@ -2942,6 +2958,7 @@ class ConfigArrayFactory {
|
|||
* @param {Object} [options] The options.
|
||||
* @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.
|
||||
* @param {string} [options.name] The config name.
|
||||
* @throws {Error} If the config file is invalid.
|
||||
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
|
||||
*/
|
||||
loadInDirectory(directoryPath, { basePath, name } = {}) {
|
||||
|
|
@ -3027,6 +3044,7 @@ class ConfigArrayFactory {
|
|||
/**
|
||||
* Load `.eslintignore` file in the current working directory.
|
||||
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
|
||||
* @throws {Error} If the ignore file is invalid.
|
||||
*/
|
||||
loadDefaultESLintIgnore() {
|
||||
const slots = internalSlotsMap$1.get(this);
|
||||
|
|
@ -3039,7 +3057,7 @@ class ConfigArrayFactory {
|
|||
if (fs__default["default"].existsSync(packageJsonPath)) {
|
||||
const data = loadJSONConfigFile(packageJsonPath);
|
||||
|
||||
if (Object.hasOwnProperty.call(data, "eslintIgnore")) {
|
||||
if (Object.hasOwn(data, "eslintIgnore")) {
|
||||
if (!Array.isArray(data.eslintIgnore)) {
|
||||
throw new Error("Package.json eslintIgnore property requires an array of paths");
|
||||
}
|
||||
|
|
@ -3228,6 +3246,7 @@ class ConfigArrayFactory {
|
|||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtends(extendName, ctx) {
|
||||
|
|
@ -3251,6 +3270,7 @@ class ConfigArrayFactory {
|
|||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedBuiltInConfig(extendName, ctx) {
|
||||
|
|
@ -3300,6 +3320,7 @@ class ConfigArrayFactory {
|
|||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedPluginConfig(extendName, ctx) {
|
||||
|
|
@ -3337,6 +3358,7 @@ class ConfigArrayFactory {
|
|||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedShareableConfig(extendName, ctx) {
|
||||
|
|
@ -3758,7 +3780,7 @@ function createCLIConfigArray({
|
|||
*/
|
||||
class ConfigurationNotFoundError extends Error {
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
|
||||
/**
|
||||
* @param {string} directoryPath The directory path.
|
||||
*/
|
||||
|
|
@ -3910,6 +3932,7 @@ class CascadingConfigArrayFactory {
|
|||
* @param {string} directoryPath The path to a leaf directory.
|
||||
* @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.
|
||||
* @returns {ConfigArray} The loaded config.
|
||||
* @throws {Error} If a config file is invalid.
|
||||
* @private
|
||||
*/
|
||||
_loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {
|
||||
|
|
@ -4011,6 +4034,7 @@ class CascadingConfigArrayFactory {
|
|||
* @param {string} directoryPath The path to the leaf directory to find config files.
|
||||
* @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.
|
||||
* @returns {ConfigArray} The loaded config.
|
||||
* @throws {Error} If a config file is invalid.
|
||||
* @private
|
||||
*/
|
||||
_finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {
|
||||
|
|
@ -4047,7 +4071,7 @@ class CascadingConfigArrayFactory {
|
|||
!directoryPath.startsWith(homePath)
|
||||
) {
|
||||
const lastElement =
|
||||
personalConfigArray[personalConfigArray.length - 1];
|
||||
personalConfigArray.at(-1);
|
||||
|
||||
emitDeprecationWarning(
|
||||
lastElement.filePath,
|
||||
|
|
@ -4119,6 +4143,7 @@ const cafactory = Symbol("cafactory");
|
|||
* @param {ReadOnlyMap<string,Processor>} options.pluginProcessors A map of plugin processor
|
||||
* names to objects.
|
||||
* @returns {Object} A flag-config-style config object.
|
||||
* @throws {Error} If a plugin or environment cannot be resolved.
|
||||
*/
|
||||
function translateESLintRC(eslintrcConfig, {
|
||||
resolveConfigRelativeTo,
|
||||
|
|
@ -4301,7 +4326,7 @@ class FlatCompat {
|
|||
this[cafactory] = new ConfigArrayFactory({
|
||||
cwd: baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
getEslintAllConfig: () => {
|
||||
getEslintAllConfig() {
|
||||
|
||||
if (!allConfig) {
|
||||
throw new TypeError("Missing parameter 'allConfig' in FlatCompat constructor.");
|
||||
|
|
@ -4309,7 +4334,7 @@ class FlatCompat {
|
|||
|
||||
return allConfig;
|
||||
},
|
||||
getEslintRecommendedConfig: () => {
|
||||
getEslintRecommendedConfig() {
|
||||
|
||||
if (!recommendedConfig) {
|
||||
throw new TypeError("Missing parameter 'recommendedConfig' in FlatCompat constructor.");
|
||||
|
|
|
|||
2
node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map
generated
vendored
2
node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map
generated
vendored
File diff suppressed because one or more lines are too long
76
node_modules/@eslint/eslintrc/dist/eslintrc.d.cts
generated
vendored
Normal file
76
node_modules/@eslint/eslintrc/dist/eslintrc.d.cts
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* @fileoverview This file contains the core types for ESLint. It was initially extracted
|
||||
* from the `@types/eslint__eslintrc` package.
|
||||
*/
|
||||
|
||||
/*
|
||||
* MIT License
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* 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
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE
|
||||
*/
|
||||
|
||||
import type { Linter } from "eslint";
|
||||
|
||||
/**
|
||||
* A compatibility class for working with configs.
|
||||
*/
|
||||
export class FlatCompat {
|
||||
constructor({
|
||||
baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
recommendedConfig,
|
||||
allConfig,
|
||||
}?: {
|
||||
/**
|
||||
* default: process.cwd()
|
||||
*/
|
||||
baseDirectory?: string;
|
||||
resolvePluginsRelativeTo?: string;
|
||||
recommendedConfig?: Linter.LegacyConfig;
|
||||
allConfig?: Linter.LegacyConfig;
|
||||
});
|
||||
|
||||
/**
|
||||
* Translates an ESLintRC-style config into a flag-config-style config.
|
||||
* @param eslintrcConfig The ESLintRC-style config object.
|
||||
* @returns A flag-config-style config object.
|
||||
*/
|
||||
config(eslintrcConfig: Linter.LegacyConfig): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `env` section of an ESLintRC-style config.
|
||||
* @param envConfig The `env` section of an ESLintRC config.
|
||||
* @returns An array of flag-config objects representing the environments.
|
||||
*/
|
||||
env(envConfig: { [name: string]: boolean }): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `extends` section of an ESLintRC-style config.
|
||||
* @param configsToExtend The names of the configs to load.
|
||||
* @returns An array of flag-config objects representing the config.
|
||||
*/
|
||||
extends(...configsToExtend: string[]): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `plugins` section of an ESLintRC-style config.
|
||||
* @param plugins The names of the plugins to load.
|
||||
* @returns An array of flag-config objects representing the plugins.
|
||||
*/
|
||||
plugins(...plugins: string[]): Linter.Config[];
|
||||
}
|
||||
10
node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
10
node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js
generated
vendored
|
|
@ -23,8 +23,8 @@
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
import debugOrig from "debug";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { ConfigArrayFactory } from "./config-array-factory.js";
|
||||
import {
|
||||
|
|
@ -193,7 +193,7 @@ function createCLIConfigArray({
|
|||
*/
|
||||
class ConfigurationNotFoundError extends Error {
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
|
||||
/**
|
||||
* @param {string} directoryPath The directory path.
|
||||
*/
|
||||
|
|
@ -345,6 +345,7 @@ class CascadingConfigArrayFactory {
|
|||
* @param {string} directoryPath The path to a leaf directory.
|
||||
* @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.
|
||||
* @returns {ConfigArray} The loaded config.
|
||||
* @throws {Error} If a config file is invalid.
|
||||
* @private
|
||||
*/
|
||||
_loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {
|
||||
|
|
@ -446,6 +447,7 @@ class CascadingConfigArrayFactory {
|
|||
* @param {string} directoryPath The path to the leaf directory to find config files.
|
||||
* @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.
|
||||
* @returns {ConfigArray} The loaded config.
|
||||
* @throws {Error} If a config file is invalid.
|
||||
* @private
|
||||
*/
|
||||
_finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {
|
||||
|
|
@ -482,7 +484,7 @@ class CascadingConfigArrayFactory {
|
|||
!directoryPath.startsWith(homePath)
|
||||
) {
|
||||
const lastElement =
|
||||
personalConfigArray[personalConfigArray.length - 1];
|
||||
personalConfigArray.at(-1);
|
||||
|
||||
emitDeprecationWarning(
|
||||
lastElement.filePath,
|
||||
|
|
|
|||
19
node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
19
node_modules/@eslint/eslintrc/lib/config-array-factory.js
generated
vendored
|
|
@ -39,10 +39,10 @@
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
import debugOrig from "debug";
|
||||
import fs from "fs";
|
||||
import fs from "node:fs";
|
||||
import importFresh from "import-fresh";
|
||||
import { createRequire } from "module";
|
||||
import path from "path";
|
||||
import { createRequire } from "node:module";
|
||||
import path from "node:path";
|
||||
import stripComments from "strip-json-comments";
|
||||
|
||||
import {
|
||||
|
|
@ -254,7 +254,7 @@ function loadPackageJSONConfigFile(filePath) {
|
|||
try {
|
||||
const packageData = loadJSONConfigFile(filePath);
|
||||
|
||||
if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) {
|
||||
if (!Object.hasOwn(packageData, "eslintConfig")) {
|
||||
throw Object.assign(
|
||||
new Error("package.json file doesn't have 'eslintConfig' field."),
|
||||
{ code: "ESLINT_CONFIG_FIELD_NOT_FOUND" }
|
||||
|
|
@ -273,6 +273,7 @@ function loadPackageJSONConfigFile(filePath) {
|
|||
* Loads a `.eslintignore` from a file.
|
||||
* @param {string} filePath The filename to load.
|
||||
* @returns {string[]} The ignore patterns from the file.
|
||||
* @throws {Error} If the file cannot be read.
|
||||
* @private
|
||||
*/
|
||||
function loadESLintIgnoreFile(filePath) {
|
||||
|
|
@ -345,7 +346,7 @@ function loadConfigFile(filePath) {
|
|||
function writeDebugLogForLoading(request, relativeTo, filePath) {
|
||||
/* istanbul ignore next */
|
||||
if (debug.enabled) {
|
||||
let nameAndVersion = null;
|
||||
let nameAndVersion = null; // eslint-disable-line no-useless-assignment -- known bug in the rule
|
||||
|
||||
try {
|
||||
const packageJsonPath = ModuleResolver.resolve(
|
||||
|
|
@ -510,6 +511,7 @@ class ConfigArrayFactory {
|
|||
* @param {Object} [options] The options.
|
||||
* @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.
|
||||
* @param {string} [options.name] The config name.
|
||||
* @throws {Error} If the config file is invalid.
|
||||
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
|
||||
*/
|
||||
loadInDirectory(directoryPath, { basePath, name } = {}) {
|
||||
|
|
@ -595,6 +597,7 @@ class ConfigArrayFactory {
|
|||
/**
|
||||
* Load `.eslintignore` file in the current working directory.
|
||||
* @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.
|
||||
* @throws {Error} If the ignore file is invalid.
|
||||
*/
|
||||
loadDefaultESLintIgnore() {
|
||||
const slots = internalSlotsMap.get(this);
|
||||
|
|
@ -607,7 +610,7 @@ class ConfigArrayFactory {
|
|||
if (fs.existsSync(packageJsonPath)) {
|
||||
const data = loadJSONConfigFile(packageJsonPath);
|
||||
|
||||
if (Object.hasOwnProperty.call(data, "eslintIgnore")) {
|
||||
if (Object.hasOwn(data, "eslintIgnore")) {
|
||||
if (!Array.isArray(data.eslintIgnore)) {
|
||||
throw new Error("Package.json eslintIgnore property requires an array of paths");
|
||||
}
|
||||
|
|
@ -796,6 +799,7 @@ class ConfigArrayFactory {
|
|||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtends(extendName, ctx) {
|
||||
|
|
@ -819,6 +823,7 @@ class ConfigArrayFactory {
|
|||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedBuiltInConfig(extendName, ctx) {
|
||||
|
|
@ -868,6 +873,7 @@ class ConfigArrayFactory {
|
|||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedPluginConfig(extendName, ctx) {
|
||||
|
|
@ -905,6 +911,7 @@ class ConfigArrayFactory {
|
|||
* @param {string} extendName The name of a base config.
|
||||
* @param {ConfigArrayFactoryLoadingContext} ctx The loading context.
|
||||
* @returns {IterableIterator<ConfigArrayElement>} The normalized config.
|
||||
* @throws {Error} If the extended config file can't be loaded.
|
||||
* @private
|
||||
*/
|
||||
_loadExtendedShareableConfig(extendName, ctx) {
|
||||
|
|
|
|||
2
node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
2
node_modules/@eslint/eslintrc/lib/config-array/config-array.js
generated
vendored
|
|
@ -178,6 +178,7 @@ class PluginConflictError extends Error {
|
|||
* @param {Record<string, DependentPlugin>} target The destination to merge
|
||||
* @param {Record<string, DependentPlugin>|undefined} source The source to merge.
|
||||
* @returns {void}
|
||||
* @throws {PluginConflictError} When a plugin was conflicted.
|
||||
*/
|
||||
function mergePlugins(target, source) {
|
||||
if (!isNonNullObject(source)) {
|
||||
|
|
@ -258,6 +259,7 @@ function mergeRuleConfigs(target, source) {
|
|||
* @param {ConfigArray} instance The config elements.
|
||||
* @param {number[]} indices The indices to use.
|
||||
* @returns {ExtractedConfig} The extracted config.
|
||||
* @throws {Error} When a plugin is conflicted.
|
||||
*/
|
||||
function createConfig(instance, indices) {
|
||||
const config = new ExtractedConfig();
|
||||
|
|
|
|||
10
node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
10
node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js
generated
vendored
|
|
@ -15,7 +15,7 @@
|
|||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
|
||||
import util from "util";
|
||||
import util from "node:util";
|
||||
|
||||
/**
|
||||
* The class is to store parsers or plugins.
|
||||
|
|
@ -88,8 +88,8 @@ class ConfigDependency {
|
|||
this.importerPath = importerPath;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Converts this instance to a JSON compatible object.
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
|
|
@ -103,14 +103,14 @@ class ConfigDependency {
|
|||
return obj;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Custom inspect method for Node.js `console.log()`.
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util.inspect.custom]() {
|
||||
const {
|
||||
definition: _ignore1, // eslint-disable-line no-unused-vars
|
||||
original: _ignore2, // eslint-disable-line no-unused-vars
|
||||
definition: _ignore1, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
|
||||
original: _ignore2, // eslint-disable-line no-unused-vars -- needed to make `obj` correct
|
||||
...obj
|
||||
} = this;
|
||||
|
||||
|
|
|
|||
4
node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
4
node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js
generated
vendored
|
|
@ -120,10 +120,10 @@ class ExtractedConfig {
|
|||
*/
|
||||
toCompatibleObjectAsConfigFileContent() {
|
||||
const {
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* eslint-disable no-unused-vars -- needed to make `config` correct */
|
||||
configNameOfNoInlineConfig: _ignore1,
|
||||
processor: _ignore2,
|
||||
/* eslint-enable no-unused-vars */
|
||||
/* eslint-enable no-unused-vars -- needed to make `config` correct */
|
||||
ignores,
|
||||
...config
|
||||
} = this;
|
||||
|
|
|
|||
11
node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
11
node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js
generated
vendored
|
|
@ -32,8 +32,8 @@
|
|||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import assert from "assert";
|
||||
import path from "path";
|
||||
import assert from "node:assert";
|
||||
import path from "node:path";
|
||||
import ignore from "ignore";
|
||||
import debugOrig from "debug";
|
||||
|
||||
|
|
@ -117,6 +117,9 @@ const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]);
|
|||
// Public
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Represents a set of glob patterns to ignore against a base path.
|
||||
*/
|
||||
class IgnorePattern {
|
||||
|
||||
/**
|
||||
|
|
@ -153,9 +156,7 @@ class IgnorePattern {
|
|||
debug("Create with: %o", ignorePatterns);
|
||||
|
||||
const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));
|
||||
const patterns = [].concat(
|
||||
...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))
|
||||
);
|
||||
const patterns = ignorePatterns.flatMap(p => p.getPatternsRelativeTo(basePath));
|
||||
const ig = ignore({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]);
|
||||
const dotIg = ignore({ allowRelativePaths: true }).add(patterns);
|
||||
|
||||
|
|
|
|||
12
node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
12
node_modules/@eslint/eslintrc/lib/config-array/override-tester.js
generated
vendored
|
|
@ -17,9 +17,9 @@
|
|||
* @author Toru Nagashima <https://github.com/mysticatea>
|
||||
*/
|
||||
|
||||
import assert from "assert";
|
||||
import path from "path";
|
||||
import util from "util";
|
||||
import assert from "node:assert";
|
||||
import path from "node:path";
|
||||
import util from "node:util";
|
||||
import minimatch from "minimatch";
|
||||
|
||||
const { Minimatch } = minimatch;
|
||||
|
|
@ -94,6 +94,7 @@ class OverrideTester {
|
|||
* @param {string|string[]} excludedFiles The glob patterns for excluded files.
|
||||
* @param {string} basePath The path to the base directory to test paths.
|
||||
* @returns {OverrideTester|null} The created instance or `null`.
|
||||
* @throws {Error} When invalid patterns are given.
|
||||
*/
|
||||
static create(files, excludedFiles, basePath) {
|
||||
const includePatterns = normalizePatterns(files);
|
||||
|
|
@ -183,6 +184,7 @@ class OverrideTester {
|
|||
* Test if a given path is matched or not.
|
||||
* @param {string} filePath The absolute path to the target file.
|
||||
* @returns {boolean} `true` if the path was matched.
|
||||
* @throws {Error} When invalid `filePath` is given.
|
||||
*/
|
||||
test(filePath) {
|
||||
if (typeof filePath !== "string" || !path.isAbsolute(filePath)) {
|
||||
|
|
@ -196,8 +198,8 @@ class OverrideTester {
|
|||
));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Converts this instance to a JSON compatible object.
|
||||
* @returns {Object} a JSON compatible object.
|
||||
*/
|
||||
toJSON() {
|
||||
|
|
@ -213,8 +215,8 @@ class OverrideTester {
|
|||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line jsdoc/require-description
|
||||
/**
|
||||
* Custom inspect method for Node.js `console.log()`.
|
||||
* @returns {Object} an object to display by `console.log()`.
|
||||
*/
|
||||
[util.inspect.custom]() {
|
||||
|
|
|
|||
7
node_modules/@eslint/eslintrc/lib/flat-compat.js
generated
vendored
7
node_modules/@eslint/eslintrc/lib/flat-compat.js
generated
vendored
|
|
@ -8,7 +8,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
import createDebug from "debug";
|
||||
import path from "path";
|
||||
import path from "node:path";
|
||||
|
||||
import environments from "../conf/environments.js";
|
||||
import { ConfigArrayFactory } from "./config-array-factory.js";
|
||||
|
|
@ -37,6 +37,7 @@ const cafactory = Symbol("cafactory");
|
|||
* @param {ReadOnlyMap<string,Processor>} options.pluginProcessors A map of plugin processor
|
||||
* names to objects.
|
||||
* @returns {Object} A flag-config-style config object.
|
||||
* @throws {Error} If a plugin or environment cannot be resolved.
|
||||
*/
|
||||
function translateESLintRC(eslintrcConfig, {
|
||||
resolveConfigRelativeTo,
|
||||
|
|
@ -219,7 +220,7 @@ class FlatCompat {
|
|||
this[cafactory] = new ConfigArrayFactory({
|
||||
cwd: baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
getEslintAllConfig: () => {
|
||||
getEslintAllConfig() {
|
||||
|
||||
if (!allConfig) {
|
||||
throw new TypeError("Missing parameter 'allConfig' in FlatCompat constructor.");
|
||||
|
|
@ -227,7 +228,7 @@ class FlatCompat {
|
|||
|
||||
return allConfig;
|
||||
},
|
||||
getEslintRecommendedConfig: () => {
|
||||
getEslintRecommendedConfig() {
|
||||
|
||||
if (!recommendedConfig) {
|
||||
throw new TypeError("Missing parameter 'recommendedConfig' in FlatCompat constructor.");
|
||||
|
|
|
|||
2
node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
2
node_modules/@eslint/eslintrc/lib/shared/ajv.js
generated
vendored
|
|
@ -184,7 +184,7 @@ export default (additionalOptions = {}) => {
|
|||
});
|
||||
|
||||
ajv.addMetaSchema(metaSchema);
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
// eslint-disable-next-line no-underscore-dangle -- part of the API
|
||||
ajv._opts.defaultMeta = metaSchema.id;
|
||||
|
||||
return ajv;
|
||||
|
|
|
|||
4
node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
4
node_modules/@eslint/eslintrc/lib/shared/config-ops.js
generated
vendored
|
|
@ -13,7 +13,7 @@ const RULE_SEVERITY_STRINGS = ["off", "warn", "error"],
|
|||
map[value] = index;
|
||||
return map;
|
||||
}, {}),
|
||||
VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"];
|
||||
VALID_SEVERITIES = new Set([0, 1, 2, "off", "warn", "error"]);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
|
|
@ -83,7 +83,7 @@ function isValidSeverity(ruleConfig) {
|
|||
if (typeof severity === "string") {
|
||||
severity = severity.toLowerCase();
|
||||
}
|
||||
return VALID_SEVERITIES.indexOf(severity) !== -1;
|
||||
return VALID_SEVERITIES.has(severity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
25
node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
25
node_modules/@eslint/eslintrc/lib/shared/config-validator.js
generated
vendored
|
|
@ -3,7 +3,7 @@
|
|||
* @author Brandon Mills
|
||||
*/
|
||||
|
||||
/* eslint class-methods-use-this: "off" */
|
||||
/* eslint class-methods-use-this: "off" -- not needed in this file */
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Typedefs
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import util from "util";
|
||||
import util from "node:util";
|
||||
import * as ConfigOps from "./config-ops.js";
|
||||
import { emitDeprecationWarning } from "./deprecation-warnings.js";
|
||||
import ajvOrig from "./ajv.js";
|
||||
|
|
@ -51,6 +51,9 @@ const noOptionsSchema = Object.freeze({
|
|||
// Exports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Validator for configuration objects.
|
||||
*/
|
||||
export default class ConfigValidator {
|
||||
constructor({ builtInRules = new Map() } = {}) {
|
||||
this.builtInRules = builtInRules;
|
||||
|
|
@ -110,6 +113,7 @@ export default class ConfigValidator {
|
|||
* Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.
|
||||
* @param {options} options The given options for the rule.
|
||||
* @returns {number|string} The rule's severity value
|
||||
* @throws {Error} If the severity is invalid.
|
||||
*/
|
||||
validateRuleSeverity(options) {
|
||||
const severity = Array.isArray(options) ? options[0] : options;
|
||||
|
|
@ -128,6 +132,7 @@ export default class ConfigValidator {
|
|||
* @param {{create: Function}} rule The rule to validate
|
||||
* @param {Array} localOptions The options for the rule, excluding severity
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleSchema(rule, localOptions) {
|
||||
if (!ruleValidators.has(rule)) {
|
||||
|
|
@ -169,6 +174,7 @@ export default class ConfigValidator {
|
|||
* @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,
|
||||
* no source is prepended to the message.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the options are invalid.
|
||||
*/
|
||||
validateRuleOptions(rule, ruleId, options, source = null) {
|
||||
try {
|
||||
|
|
@ -200,8 +206,9 @@ export default class ConfigValidator {
|
|||
* Validates an environment object
|
||||
* @param {Object} environment The environment config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the environment is invalid.
|
||||
*/
|
||||
validateEnvironment(
|
||||
environment,
|
||||
|
|
@ -229,7 +236,7 @@ export default class ConfigValidator {
|
|||
* Validates a rules config object
|
||||
* @param {Object} rulesConfig The rules config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @param {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules
|
||||
* @returns {void}
|
||||
*/
|
||||
validateRules(
|
||||
|
|
@ -273,8 +280,9 @@ export default class ConfigValidator {
|
|||
* Validate `processor` configuration.
|
||||
* @param {string|undefined} processorName The processor name.
|
||||
* @param {string} source The name of config file.
|
||||
* @param {function(id:string): Processor} getProcessor The getter of defined processors.
|
||||
* @param {(id:string) => Processor} getProcessor The getter of defined processors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the processor is invalid.
|
||||
*/
|
||||
validateProcessor(processorName, source, getProcessor) {
|
||||
if (processorName && !getProcessor(processorName)) {
|
||||
|
|
@ -313,6 +321,7 @@ export default class ConfigValidator {
|
|||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @returns {void}
|
||||
* @throws {Error} If the config is invalid.
|
||||
*/
|
||||
validateConfigSchema(config, source = null) {
|
||||
validateSchema = validateSchema || ajv.compile(configSchema);
|
||||
|
|
@ -321,7 +330,7 @@ export default class ConfigValidator {
|
|||
throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`);
|
||||
}
|
||||
|
||||
if (Object.hasOwnProperty.call(config, "ecmaFeatures")) {
|
||||
if (Object.hasOwn(config, "ecmaFeatures")) {
|
||||
emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES");
|
||||
}
|
||||
}
|
||||
|
|
@ -330,8 +339,8 @@ export default class ConfigValidator {
|
|||
* Validates an entire config object.
|
||||
* @param {Object} config The config object to validate.
|
||||
* @param {string} source The name of the configuration source to report in any errors.
|
||||
* @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @param {(ruleId:string) => Object} [getAdditionalRule] A map from strings to loaded rules.
|
||||
* @param {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded envs.
|
||||
* @returns {void}
|
||||
*/
|
||||
validate(config, source, getAdditionalRule, getAdditionalEnv) {
|
||||
|
|
|
|||
2
node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
2
node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js
generated
vendored
|
|
@ -7,7 +7,7 @@
|
|||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
import path from "path";
|
||||
import path from "node:path";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Private
|
||||
|
|
|
|||
3
node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
3
node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js
generated
vendored
|
|
@ -3,7 +3,7 @@
|
|||
* @author Teddy Katz
|
||||
*/
|
||||
|
||||
import Module from "module";
|
||||
import Module from "node:module";
|
||||
|
||||
/*
|
||||
* `Module.createRequire` is added in v12.2.0. It supports URL as well.
|
||||
|
|
@ -17,6 +17,7 @@ const createRequire = Module.createRequire;
|
|||
* @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be
|
||||
* a file rather than a directory, but the file need not actually exist.
|
||||
* @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`
|
||||
* @throws {Error} When the module cannot be resolved.
|
||||
*/
|
||||
function resolve(moduleName, relativeToPath) {
|
||||
try {
|
||||
|
|
|
|||
76
node_modules/@eslint/eslintrc/lib/types/index.d.ts
generated
vendored
Normal file
76
node_modules/@eslint/eslintrc/lib/types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* @fileoverview This file contains the core types for ESLint. It was initially extracted
|
||||
* from the `@types/eslint__eslintrc` package.
|
||||
*/
|
||||
|
||||
/*
|
||||
* MIT License
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* 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
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE
|
||||
*/
|
||||
|
||||
import type { Linter } from "eslint";
|
||||
|
||||
/**
|
||||
* A compatibility class for working with configs.
|
||||
*/
|
||||
export class FlatCompat {
|
||||
constructor({
|
||||
baseDirectory,
|
||||
resolvePluginsRelativeTo,
|
||||
recommendedConfig,
|
||||
allConfig,
|
||||
}?: {
|
||||
/**
|
||||
* default: process.cwd()
|
||||
*/
|
||||
baseDirectory?: string;
|
||||
resolvePluginsRelativeTo?: string;
|
||||
recommendedConfig?: Linter.LegacyConfig;
|
||||
allConfig?: Linter.LegacyConfig;
|
||||
});
|
||||
|
||||
/**
|
||||
* Translates an ESLintRC-style config into a flag-config-style config.
|
||||
* @param eslintrcConfig The ESLintRC-style config object.
|
||||
* @returns A flag-config-style config object.
|
||||
*/
|
||||
config(eslintrcConfig: Linter.LegacyConfig): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `env` section of an ESLintRC-style config.
|
||||
* @param envConfig The `env` section of an ESLintRC config.
|
||||
* @returns An array of flag-config objects representing the environments.
|
||||
*/
|
||||
env(envConfig: { [name: string]: boolean }): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `extends` section of an ESLintRC-style config.
|
||||
* @param configsToExtend The names of the configs to load.
|
||||
* @returns An array of flag-config objects representing the config.
|
||||
*/
|
||||
extends(...configsToExtend: string[]): Linter.Config[];
|
||||
|
||||
/**
|
||||
* Translates the `plugins` section of an ESLintRC-style config.
|
||||
* @param plugins The names of the plugins to load.
|
||||
* @returns An array of flag-config objects representing the plugins.
|
||||
*/
|
||||
plugins(...plugins: string[]): Linter.Config[];
|
||||
}
|
||||
20
node_modules/@eslint/eslintrc/package.json
generated
vendored
20
node_modules/@eslint/eslintrc/package.json
generated
vendored
|
|
@ -1,13 +1,15 @@
|
|||
{
|
||||
"name": "@eslint/eslintrc",
|
||||
"version": "3.2.0",
|
||||
"version": "3.3.0",
|
||||
"description": "The legacy ESLintRC config file format for ESLint",
|
||||
"type": "module",
|
||||
"main": "./dist/eslintrc.cjs",
|
||||
"types": "./dist/eslintrc.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./lib/index.js",
|
||||
"require": "./dist/eslintrc.cjs"
|
||||
"require": "./dist/eslintrc.cjs",
|
||||
"types": "./lib/types/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./universal": {
|
||||
|
|
@ -26,7 +28,7 @@
|
|||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"build": "rollup -c && node -e \"fs.copyFileSync('./lib/types/index.d.ts', './dist/eslintrc.d.cts')\"",
|
||||
"lint": "eslint . --report-unused-disable-directives",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"prepare": "npm run build",
|
||||
|
|
@ -35,7 +37,8 @@
|
|||
"release:generate:beta": "eslint-generate-prerelease beta",
|
||||
"release:generate:rc": "eslint-generate-prerelease rc",
|
||||
"release:publish": "eslint-publish-release",
|
||||
"test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'"
|
||||
"test": "mocha -R progress -c 'tests/lib/*.cjs' && c8 mocha -R progress -c 'tests/lib/**/*.js'",
|
||||
"test:types": "tsc -p tests/lib/types/tsconfig.json"
|
||||
},
|
||||
"repository": "eslint/eslintrc",
|
||||
"funding": "https://opencollective.com/eslint",
|
||||
|
|
@ -53,17 +56,16 @@
|
|||
"devDependencies": {
|
||||
"c8": "^7.7.3",
|
||||
"chai": "^4.3.4",
|
||||
"eslint": "^7.31.0",
|
||||
"eslint-config-eslint": "^7.0.0",
|
||||
"eslint-plugin-jsdoc": "^35.4.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint": "^9.20.1",
|
||||
"eslint-config-eslint": "^11.0.0",
|
||||
"eslint-release": "^3.2.0",
|
||||
"fs-teardown": "^0.1.3",
|
||||
"mocha": "^9.0.3",
|
||||
"rollup": "^2.70.1",
|
||||
"shelljs": "^0.8.5",
|
||||
"sinon": "^11.1.2",
|
||||
"temp-dir": "^2.0.0"
|
||||
"temp-dir": "^2.0.0",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"ajv": "^6.12.4",
|
||||
|
|
|
|||
3
node_modules/@eslint/eslintrc/universal.js
generated
vendored
3
node_modules/@eslint/eslintrc/universal.js
generated
vendored
|
|
@ -1,3 +1,5 @@
|
|||
/* global module, require -- required for CJS file */
|
||||
|
||||
// Jest (and probably some other runtimes with custom implementations of
|
||||
// `require`) doesn't support `exports` in `package.json`, so this file is here
|
||||
// to help them load this module. Note that it is also `.js` and not `.cjs` for
|
||||
|
|
@ -5,5 +7,4 @@
|
|||
// since Jest doesn't respect `module` outside of ESM mode it still works in
|
||||
// this case (and the `require` in _this_ file does specify the extension).
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
module.exports = require("./dist/eslintrc-universal.cjs");
|
||||
|
|
|
|||
2
node_modules/@eslint/js/package.json
generated
vendored
2
node_modules/@eslint/js/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@eslint/js",
|
||||
"version": "9.20.0",
|
||||
"version": "9.21.0",
|
||||
"description": "ESLint JavaScript language implementation",
|
||||
"main": "./src/index.js",
|
||||
"types": "./types/index.d.ts",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue