Bump packages to fix linter

This commit is contained in:
Henry Mercer 2023-01-18 20:50:03 +00:00
parent ed9506bbaf
commit 0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions

View file

@ -27,7 +27,7 @@ module.exports = (additionalOptions = {}) => {
});
ajv.addMetaSchema(metaSchema);
// eslint-disable-next-line no-underscore-dangle
// eslint-disable-next-line no-underscore-dangle -- Ajv's API
ajv._opts.defaultMeta = metaSchema.id;
return ajv;

View file

@ -24,9 +24,13 @@
const
util = require("util"),
configSchema = require("../../conf/config-schema"),
BuiltInEnvironments = require("@eslint/eslintrc/conf/environments"),
BuiltInRules = require("../rules"),
ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"),
{
Legacy: {
ConfigOps,
environments: BuiltInEnvironments
}
} = require("@eslint/eslintrc"),
{ emitDeprecationWarning } = require("./deprecation-warnings");
const ajv = require("./ajv")();
@ -80,6 +84,7 @@ function getRuleOptionsSchema(rule) {
/**
* 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.
* @throws {Error} Wrong severity value.
* @returns {number|string} The rule's severity value
*/
function validateRuleSeverity(options) {
@ -98,6 +103,7 @@ function validateRuleSeverity(options) {
* Validates the non-severity options passed to a rule, based on its schema.
* @param {{create: Function}} rule The rule to validate
* @param {Array} localOptions The options for the rule, excluding severity
* @throws {Error} Any rule validation errors.
* @returns {void}
*/
function validateRuleSchema(rule, localOptions) {
@ -128,6 +134,7 @@ function validateRuleSchema(rule, localOptions) {
* @param {Array|number} options The given options for the rule.
* @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.
* @throws {Error} Upon any bad rule configuration.
* @returns {void}
*/
function validateRuleOptions(rule, ruleId, options, source = null) {
@ -152,7 +159,7 @@ function validateRuleOptions(rule, ruleId, options, source = null) {
* 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}
*/
function validateEnvironment(
@ -181,7 +188,7 @@ function validateEnvironment(
* 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}
*/
function validateRules(
@ -225,7 +232,8 @@ function validateGlobals(globalsConfig, source = null) {
* 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.
* @throws {Error} For invalid processor configuration.
* @returns {void}
*/
function validateProcessor(processorName, source, getProcessor) {
@ -264,6 +272,7 @@ function formatErrors(errors) {
* Validates the top level properties of the config object.
* @param {Object} config The config object to validate.
* @param {string} source The name of the configuration source to report in any errors.
* @throws {Error} For any config invalid per the schema.
* @returns {void}
*/
function validateConfigSchema(config, source = null) {
@ -282,8 +291,8 @@ function validateConfigSchema(config, source = null) {
* 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}
*/
function validate(config, source, getAdditionalRule, getAdditionalEnv) {

View file

@ -17,14 +17,7 @@ const path = require("path");
// Definitions for deprecation warnings.
const deprecationWarningMessages = {
ESLINT_LEGACY_ECMAFEATURES:
"The 'ecmaFeatures' config file property is deprecated and has no effect.",
ESLINT_PERSONAL_CONFIG_LOAD:
"'~/.eslintrc.*' config files have been deprecated. " +
"Please use a config file per project or the '--config' option.",
ESLINT_PERSONAL_CONFIG_SUPPRESS:
"'~/.eslintrc.*' config files have been deprecated. " +
"Please remove it or add 'root:true' to the config files in your " +
"projects in order to avoid loading '~/.eslintrc.*' accidentally."
"The 'ecmaFeatures' config file property is deprecated and has no effect."
};
const sourceFileErrorCache = new Set();

15
node_modules/eslint/lib/shared/directives.js generated vendored Normal file
View file

@ -0,0 +1,15 @@
/**
* @fileoverview Common utils for directives.
*
* This file contains only shared items for directives.
* If you make a utility for rules, please see `../rules/utils/ast-utils.js`.
*
* @author gfyoung <https://github.com/gfyoung>
*/
"use strict";
const directivesPattern = /^(eslint(?:-env|-enable|-disable(?:(?:-next)?-line)?)?|exported|globals?)(?:\s|$)/u;
module.exports = {
directivesPattern
};

View file

@ -5,9 +5,9 @@
"use strict";
/* eslint no-console: "off" */
/* eslint no-console: "off" -- Logging util */
/* istanbul ignore next */
/* c8 ignore next */
module.exports = {
/**

View file

@ -17,14 +17,7 @@
"use strict";
const Module = require("module");
/*
* `Module.createRequire` is added in v12.2.0. It supports URL as well.
* We only support the case where the argument is a filepath, not a URL.
*/
// eslint-disable-next-line node/no-unsupported-features/node-builtins, node/no-deprecated-api
const createRequire = Module.createRequire || Module.createRequireFromPath;
const { createRequire } = require("module");
module.exports = {
@ -33,6 +26,7 @@ module.exports = {
* @param {string} moduleName The name of a Node module, or a path to a Node module.
* @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.
* @throws {Error} Any error from `module.createRequire` or its `resolve`.
* @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`
*/
resolve(moduleName, relativeToPath) {

View file

@ -40,6 +40,7 @@ function environment() {
* Synchronously executes a shell command and formats the result.
* @param {string} cmd The command to execute.
* @param {Array} args The arguments to be executed with the command.
* @throws {Error} As may be collected by `cross-spawn.sync`.
* @returns {string} The version returned by the command.
*/
function execCommand(cmd, args) {
@ -73,6 +74,7 @@ function environment() {
/**
* Gets bin version.
* @param {string} bin The bin to check.
* @throws {Error} As may be collected by `cross-spawn.sync`.
* @returns {string} The normalized version returned by the command.
*/
function getBinVersion(bin) {
@ -90,11 +92,12 @@ function environment() {
* Gets installed npm package version.
* @param {string} pkg The package to check.
* @param {boolean} global Whether to check globally or not.
* @throws {Error} As may be collected by `cross-spawn.sync`.
* @returns {string} The normalized version returned by the command.
*/
function getNpmPackageVersion(pkg, { global = false } = {}) {
const npmBinArgs = ["bin", "-g"];
const npmLsArgs = ["ls", "--depth=0", "--json", "eslint"];
const npmLsArgs = ["ls", "--depth=0", "--json", pkg];
if (global) {
npmLsArgs.push("-g");

View file

@ -65,16 +65,16 @@ class Traverser {
this._leave = null;
}
// eslint-disable-next-line jsdoc/require-description
/**
* Gives current node.
* @returns {ASTNode} The current node.
*/
current() {
return this._current;
}
// eslint-disable-next-line jsdoc/require-description
/**
* Gives a copy of the ancestor nodes.
* @returns {ASTNode[]} The ancestor nodes.
*/
parents() {

View file

@ -21,8 +21,18 @@ module.exports = {};
/**
* @typedef {Object} ParserOptions
* @property {EcmaFeatures} [ecmaFeatures] The optional features.
* @property {3|5|6|7|8|9|10|11|12|2015|2016|2017|2018|2019|2020|2021} [ecmaVersion] The ECMAScript version (or revision number).
* @property {3|5|6|7|8|9|10|11|12|13|14|2015|2016|2017|2018|2019|2020|2021|2022|2023} [ecmaVersion] The ECMAScript version (or revision number).
* @property {"script"|"module"} [sourceType] The source code type.
* @property {boolean} [allowReserved] Allowing the use of reserved words as identifiers in ES3.
*/
/**
* @typedef {Object} LanguageOptions
* @property {number|"latest"} [ecmaVersion] The ECMAScript version (or revision number).
* @property {Record<string, GlobalConf>} [globals] The global variable settings.
* @property {"script"|"module"|"commonjs"} [sourceType] The source code type.
* @property {string|Object} [parser] The parser to use.
* @property {Object} [parserOptions] The parser options to use.
*/
/**
@ -83,18 +93,33 @@ module.exports = {};
/**
* @typedef {Object} LintMessage
* @property {number} column The 1-based column number.
* @property {number|undefined} column The 1-based column number.
* @property {number} [endColumn] The 1-based column number of the end location.
* @property {number} [endLine] The 1-based line number of the end location.
* @property {boolean} fatal If `true` then this is a fatal error.
* @property {{range:[number,number], text:string}} [fix] Information for autofix.
* @property {number} line The 1-based line number.
* @property {number|undefined} line The 1-based line number.
* @property {string} message The error message.
* @property {string|null} ruleId The ID of the rule which makes this message.
* @property {0|1|2} severity The severity of this message.
* @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions.
*/
/**
* @typedef {Object} SuppressedLintMessage
* @property {number|undefined} column The 1-based column number.
* @property {number} [endColumn] The 1-based column number of the end location.
* @property {number} [endLine] The 1-based line number of the end location.
* @property {boolean} fatal If `true` then this is a fatal error.
* @property {{range:[number,number], text:string}} [fix] Information for autofix.
* @property {number|undefined} line The 1-based line number.
* @property {string} message The error message.
* @property {string|null} ruleId The ID of the rule which makes this message.
* @property {0|1|2} severity The severity of this message.
* @property {Array<{kind: string, justification: string}>} suppressions The suppression info.
* @property {Array<{desc?: string, messageId?: string, fix: {range: [number, number], text: string}}>} [suggestions] Information for suggestions.
*/
/**
* @typedef {Object} SuggestionResult
* @property {string} desc A short description.
@ -111,7 +136,6 @@ module.exports = {};
/**
* @typedef {Object} RuleMetaDocs
* @property {string} category The category of the rule.
* @property {string} description The description of the rule.
* @property {boolean} recommended If `true` then the rule is included in `eslint:recommended` preset.
* @property {string} url The URL of the rule documentation.
@ -122,6 +146,7 @@ module.exports = {};
* @property {boolean} [deprecated] If `true` then the rule has been deprecated.
* @property {RuleMetaDocs} docs The document information of the rule.
* @property {"code"|"whitespace"} [fixable] The autofix type.
* @property {boolean} [hasSuggestions] If `true` then the rule provides suggestions.
* @property {Record<string,string>} [messages] The messages the rule reports.
* @property {string[]} [replacedBy] The IDs of the alternative rules.
* @property {Array|Object} schema The option schema of the rule.
@ -148,3 +173,40 @@ module.exports = {};
* @property {string} ruleId The rule ID.
* @property {string[]} replacedBy The rule IDs that replace this deprecated rule.
*/
/**
* A linting result.
* @typedef {Object} LintResult
* @property {string} filePath The path to the file that was linted.
* @property {LintMessage[]} messages All of the messages for the result.
* @property {SuppressedLintMessage[]} suppressedMessages All of the suppressed messages for the result.
* @property {number} errorCount Number of errors for the result.
* @property {number} fatalErrorCount Number of fatal errors for the result.
* @property {number} warningCount Number of warnings for the result.
* @property {number} fixableErrorCount Number of fixable errors for the result.
* @property {number} fixableWarningCount Number of fixable warnings for the result.
* @property {string} [source] The source code of the file that was linted.
* @property {string} [output] The source code of the file that was linted, with as many fixes applied as possible.
* @property {DeprecatedRuleInfo[]} usedDeprecatedRules The list of used deprecated rules.
*/
/**
* Information provided when the maximum warning threshold is exceeded.
* @typedef {Object} MaxWarningsExceeded
* @property {number} maxWarnings Number of warnings to trigger nonzero exit code.
* @property {number} foundWarnings Number of warnings found while linting.
*/
/**
* Metadata about results for formatters.
* @typedef {Object} ResultsMeta
* @property {MaxWarningsExceeded} [maxWarningsExceeded] Present if the maxWarnings threshold was exceeded.
*/
/**
* A formatter function.
* @callback FormatterFunction
* @param {LintResult[]} results The list of linting results.
* @param {{cwd: string, maxWarningsExceeded?: MaxWarningsExceeded, rulesMeta: Record<string, RuleMeta>}} [context] A context object.
* @returns {string | Promise<string>} Formatted text.
*/