update socials section
This commit is contained in:
		
							
								
								
									
										34
									
								
								node_modules/eslint/lib/shared/ajv.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								node_modules/eslint/lib/shared/ajv.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| /** | ||||
|  * @fileoverview The instance of Ajv validator. | ||||
|  * @author Evgeny Poberezkin | ||||
|  */ | ||||
| "use strict"; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Requirements | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| const Ajv = require("ajv"), | ||||
|     metaSchema = require("ajv/lib/refs/json-schema-draft-04.json"); | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Public Interface | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| module.exports = (additionalOptions = {}) => { | ||||
|     const ajv = new Ajv({ | ||||
|         meta: false, | ||||
|         useDefaults: true, | ||||
|         validateSchema: false, | ||||
|         missingRefs: "ignore", | ||||
|         verbose: true, | ||||
|         schemaId: "auto", | ||||
|         ...additionalOptions | ||||
|     }); | ||||
|  | ||||
|     ajv.addMetaSchema(metaSchema); | ||||
|     // eslint-disable-next-line no-underscore-dangle -- Ajv's API | ||||
|     ajv._opts.defaultMeta = metaSchema.id; | ||||
|  | ||||
|     return ajv; | ||||
| }; | ||||
							
								
								
									
										29
									
								
								node_modules/eslint/lib/shared/ast-utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								node_modules/eslint/lib/shared/ast-utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| /** | ||||
|  * @fileoverview Common utils for AST. | ||||
|  * | ||||
|  * This file contains only shared items for core and rules. | ||||
|  * If you make a utility for rules, please see `../rules/utils/ast-utils.js`. | ||||
|  * | ||||
|  * @author Toru Nagashima <https://github.com/mysticatea> | ||||
|  */ | ||||
| "use strict"; | ||||
|  | ||||
| const breakableTypePattern = /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/u; | ||||
| const lineBreakPattern = /\r\n|[\r\n\u2028\u2029]/u; | ||||
| const shebangPattern = /^#!([^\r\n]+)/u; | ||||
|  | ||||
| /** | ||||
|  * Creates a version of the `lineBreakPattern` regex with the global flag. | ||||
|  * Global regexes are mutable, so this needs to be a function instead of a constant. | ||||
|  * @returns {RegExp} A global regular expression that matches line terminators | ||||
|  */ | ||||
| function createGlobalLinebreakMatcher() { | ||||
|     return new RegExp(lineBreakPattern.source, "gu"); | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|     breakableTypePattern, | ||||
|     lineBreakPattern, | ||||
|     createGlobalLinebreakMatcher, | ||||
|     shebangPattern | ||||
| }; | ||||
							
								
								
									
										347
									
								
								node_modules/eslint/lib/shared/config-validator.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										347
									
								
								node_modules/eslint/lib/shared/config-validator.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,347 @@ | ||||
| /* | ||||
|  * STOP!!! DO NOT MODIFY. | ||||
|  * | ||||
|  * This file is part of the ongoing work to move the eslintrc-style config | ||||
|  * system into the @eslint/eslintrc package. This file needs to remain | ||||
|  * unchanged in order for this work to proceed. | ||||
|  * | ||||
|  * If you think you need to change this file, please contact @nzakas first. | ||||
|  * | ||||
|  * Thanks in advance for your cooperation. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @fileoverview Validates configs. | ||||
|  * @author Brandon Mills | ||||
|  */ | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Requirements | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| const | ||||
|     util = require("util"), | ||||
|     configSchema = require("../../conf/config-schema"), | ||||
|     BuiltInRules = require("../rules"), | ||||
|     { | ||||
|         Legacy: { | ||||
|             ConfigOps, | ||||
|             environments: BuiltInEnvironments | ||||
|         } | ||||
|     } = require("@eslint/eslintrc"), | ||||
|     { emitDeprecationWarning } = require("./deprecation-warnings"); | ||||
|  | ||||
| const ajv = require("./ajv")(); | ||||
| const ruleValidators = new WeakMap(); | ||||
| const noop = Function.prototype; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Private | ||||
| //------------------------------------------------------------------------------ | ||||
| let validateSchema; | ||||
| const severityMap = { | ||||
|     error: 2, | ||||
|     warn: 1, | ||||
|     off: 0 | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Gets a complete options schema for a rule. | ||||
|  * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object | ||||
|  * @returns {Object} JSON Schema for the rule's options. | ||||
|  */ | ||||
| function getRuleOptionsSchema(rule) { | ||||
|     if (!rule) { | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|     const schema = rule.schema || rule.meta && rule.meta.schema; | ||||
|  | ||||
|     // Given a tuple of schemas, insert warning level at the beginning | ||||
|     if (Array.isArray(schema)) { | ||||
|         if (schema.length) { | ||||
|             return { | ||||
|                 type: "array", | ||||
|                 items: schema, | ||||
|                 minItems: 0, | ||||
|                 maxItems: schema.length | ||||
|             }; | ||||
|         } | ||||
|         return { | ||||
|             type: "array", | ||||
|             minItems: 0, | ||||
|             maxItems: 0 | ||||
|         }; | ||||
|  | ||||
|     } | ||||
|  | ||||
|     // Given a full schema, leave it alone | ||||
|     return schema || null; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 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) { | ||||
|     const severity = Array.isArray(options) ? options[0] : options; | ||||
|     const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; | ||||
|  | ||||
|     if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { | ||||
|         return normSeverity; | ||||
|     } | ||||
|  | ||||
|     throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); | ||||
|  | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 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) { | ||||
|     if (!ruleValidators.has(rule)) { | ||||
|         const schema = getRuleOptionsSchema(rule); | ||||
|  | ||||
|         if (schema) { | ||||
|             ruleValidators.set(rule, ajv.compile(schema)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     const validateRule = ruleValidators.get(rule); | ||||
|  | ||||
|     if (validateRule) { | ||||
|         validateRule(localOptions); | ||||
|         if (validateRule.errors) { | ||||
|             throw new Error(validateRule.errors.map( | ||||
|                 error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` | ||||
|             ).join("")); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Validates a rule's options against its schema. | ||||
|  * @param {{create: Function}|null} rule The rule that the config is being validated for | ||||
|  * @param {string} ruleId The rule's unique name. | ||||
|  * @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) { | ||||
|     try { | ||||
|         const severity = validateRuleSeverity(options); | ||||
|  | ||||
|         if (severity !== 0) { | ||||
|             validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); | ||||
|         } | ||||
|     } catch (err) { | ||||
|         const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; | ||||
|  | ||||
|         if (typeof source === "string") { | ||||
|             throw new Error(`${source}:\n\t${enhancedMessage}`); | ||||
|         } else { | ||||
|             throw new Error(enhancedMessage); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 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 {(envId:string) => Object} [getAdditionalEnv] A map from strings to loaded environments. | ||||
|  * @returns {void} | ||||
|  */ | ||||
| function validateEnvironment( | ||||
|     environment, | ||||
|     source, | ||||
|     getAdditionalEnv = noop | ||||
| ) { | ||||
|  | ||||
|     // not having an environment is ok | ||||
|     if (!environment) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     Object.keys(environment).forEach(id => { | ||||
|         const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null; | ||||
|  | ||||
|         if (!env) { | ||||
|             const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; | ||||
|  | ||||
|             throw new Error(message); | ||||
|         } | ||||
|     }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 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 {(ruleId:string) => Object} getAdditionalRule A map from strings to loaded rules | ||||
|  * @returns {void} | ||||
|  */ | ||||
| function validateRules( | ||||
|     rulesConfig, | ||||
|     source, | ||||
|     getAdditionalRule = noop | ||||
| ) { | ||||
|     if (!rulesConfig) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     Object.keys(rulesConfig).forEach(id => { | ||||
|         const rule = getAdditionalRule(id) || BuiltInRules.get(id) || null; | ||||
|  | ||||
|         validateRuleOptions(rule, id, rulesConfig[id], source); | ||||
|     }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Validates a `globals` section of a config file | ||||
|  * @param {Object} globalsConfig The `globals` section | ||||
|  * @param {string|null} source The name of the configuration source to report in the event of an error. | ||||
|  * @returns {void} | ||||
|  */ | ||||
| function validateGlobals(globalsConfig, source = null) { | ||||
|     if (!globalsConfig) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     Object.entries(globalsConfig) | ||||
|         .forEach(([configuredGlobal, configuredValue]) => { | ||||
|             try { | ||||
|                 ConfigOps.normalizeConfigGlobal(configuredValue); | ||||
|             } catch (err) { | ||||
|                 throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); | ||||
|             } | ||||
|         }); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Validate `processor` configuration. | ||||
|  * @param {string|undefined} processorName The processor name. | ||||
|  * @param {string} source The name of config file. | ||||
|  * @param {(id:string) => Processor} getProcessor The getter of defined processors. | ||||
|  * @throws {Error} For invalid processor configuration. | ||||
|  * @returns {void} | ||||
|  */ | ||||
| function validateProcessor(processorName, source, getProcessor) { | ||||
|     if (processorName && !getProcessor(processorName)) { | ||||
|         throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Formats an array of schema validation errors. | ||||
|  * @param {Array} errors An array of error messages to format. | ||||
|  * @returns {string} Formatted error message | ||||
|  */ | ||||
| function formatErrors(errors) { | ||||
|     return errors.map(error => { | ||||
|         if (error.keyword === "additionalProperties") { | ||||
|             const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; | ||||
|  | ||||
|             return `Unexpected top-level property "${formattedPropertyPath}"`; | ||||
|         } | ||||
|         if (error.keyword === "type") { | ||||
|             const formattedField = error.dataPath.slice(1); | ||||
|             const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; | ||||
|             const formattedValue = JSON.stringify(error.data); | ||||
|  | ||||
|             return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; | ||||
|         } | ||||
|  | ||||
|         const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; | ||||
|  | ||||
|         return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; | ||||
|     }).map(message => `\t- ${message}.\n`).join(""); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 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) { | ||||
|     validateSchema = validateSchema || ajv.compile(configSchema); | ||||
|  | ||||
|     if (!validateSchema(config)) { | ||||
|         throw new Error(`ESLint configuration in ${source} is invalid:\n${formatErrors(validateSchema.errors)}`); | ||||
|     } | ||||
|  | ||||
|     if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { | ||||
|         emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); | ||||
|     } | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 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 {(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) { | ||||
|     validateConfigSchema(config, source); | ||||
|     validateRules(config.rules, source, getAdditionalRule); | ||||
|     validateEnvironment(config.env, source, getAdditionalEnv); | ||||
|     validateGlobals(config.globals, source); | ||||
|  | ||||
|     for (const override of config.overrides || []) { | ||||
|         validateRules(override.rules, source, getAdditionalRule); | ||||
|         validateEnvironment(override.env, source, getAdditionalEnv); | ||||
|         validateGlobals(config.globals, source); | ||||
|     } | ||||
| } | ||||
|  | ||||
| const validated = new WeakSet(); | ||||
|  | ||||
| /** | ||||
|  * Validate config array object. | ||||
|  * @param {ConfigArray} configArray The config array to validate. | ||||
|  * @returns {void} | ||||
|  */ | ||||
| function validateConfigArray(configArray) { | ||||
|     const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); | ||||
|     const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); | ||||
|     const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); | ||||
|  | ||||
|     // Validate. | ||||
|     for (const element of configArray) { | ||||
|         if (validated.has(element)) { | ||||
|             continue; | ||||
|         } | ||||
|         validated.add(element); | ||||
|  | ||||
|         validateEnvironment(element.env, element.name, getPluginEnv); | ||||
|         validateGlobals(element.globals, element.name); | ||||
|         validateProcessor(element.processor, element.name, getPluginProcessor); | ||||
|         validateRules(element.rules, element.name, getPluginRule); | ||||
|     } | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Public Interface | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| module.exports = { | ||||
|     getRuleOptionsSchema, | ||||
|     validate, | ||||
|     validateConfigArray, | ||||
|     validateConfigSchema, | ||||
|     validateRuleOptions | ||||
| }; | ||||
							
								
								
									
										58
									
								
								node_modules/eslint/lib/shared/deprecation-warnings.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								node_modules/eslint/lib/shared/deprecation-warnings.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| /** | ||||
|  * @fileoverview Provide the function that emits deprecation warnings. | ||||
|  * @author Toru Nagashima <http://github.com/mysticatea> | ||||
|  */ | ||||
| "use strict"; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Requirements | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| const path = require("path"); | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Private | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| // Definitions for deprecation warnings. | ||||
| const deprecationWarningMessages = { | ||||
|     ESLINT_LEGACY_ECMAFEATURES: | ||||
|         "The 'ecmaFeatures' config file property is deprecated and has no effect." | ||||
| }; | ||||
|  | ||||
| const sourceFileErrorCache = new Set(); | ||||
|  | ||||
| /** | ||||
|  * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted | ||||
|  * for each unique file path, but repeated invocations with the same file path have no effect. | ||||
|  * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active. | ||||
|  * @param {string} source The name of the configuration source to report the warning for. | ||||
|  * @param {string} errorCode The warning message to show. | ||||
|  * @returns {void} | ||||
|  */ | ||||
| function emitDeprecationWarning(source, errorCode) { | ||||
|     const cacheKey = JSON.stringify({ source, errorCode }); | ||||
|  | ||||
|     if (sourceFileErrorCache.has(cacheKey)) { | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     sourceFileErrorCache.add(cacheKey); | ||||
|  | ||||
|     const rel = path.relative(process.cwd(), source); | ||||
|     const message = deprecationWarningMessages[errorCode]; | ||||
|  | ||||
|     process.emitWarning( | ||||
|         `${message} (found in "${rel}")`, | ||||
|         "DeprecationWarning", | ||||
|         errorCode | ||||
|     ); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Public Interface | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| module.exports = { | ||||
|     emitDeprecationWarning | ||||
| }; | ||||
							
								
								
									
										15
									
								
								node_modules/eslint/lib/shared/directives.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								node_modules/eslint/lib/shared/directives.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal 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 | ||||
| }; | ||||
							
								
								
									
										30
									
								
								node_modules/eslint/lib/shared/logging.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								node_modules/eslint/lib/shared/logging.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| /** | ||||
|  * @fileoverview Handle logging for ESLint | ||||
|  * @author Gyandeep Singh | ||||
|  */ | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| /* eslint no-console: "off" -- Logging util */ | ||||
|  | ||||
| /* c8 ignore next */ | ||||
| module.exports = { | ||||
|  | ||||
|     /** | ||||
|      * Cover for console.log | ||||
|      * @param {...any} args The elements to log. | ||||
|      * @returns {void} | ||||
|      */ | ||||
|     info(...args) { | ||||
|         console.log(...args); | ||||
|     }, | ||||
|  | ||||
|     /** | ||||
|      * Cover for console.error | ||||
|      * @param {...any} args The elements to log. | ||||
|      * @returns {void} | ||||
|      */ | ||||
|     error(...args) { | ||||
|         console.error(...args); | ||||
|     } | ||||
| }; | ||||
							
								
								
									
										50
									
								
								node_modules/eslint/lib/shared/relative-module-resolver.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								node_modules/eslint/lib/shared/relative-module-resolver.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| /* | ||||
|  * STOP!!! DO NOT MODIFY. | ||||
|  * | ||||
|  * This file is part of the ongoing work to move the eslintrc-style config | ||||
|  * system into the @eslint/eslintrc package. This file needs to remain | ||||
|  * unchanged in order for this work to proceed. | ||||
|  * | ||||
|  * If you think you need to change this file, please contact @nzakas first. | ||||
|  * | ||||
|  * Thanks in advance for your cooperation. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * Utility for resolving a module relative to another module | ||||
|  * @author Teddy Katz | ||||
|  */ | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| const { createRequire } = require("module"); | ||||
|  | ||||
| module.exports = { | ||||
|  | ||||
|     /** | ||||
|      * Resolves a Node module relative to another module | ||||
|      * @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) { | ||||
|         try { | ||||
|             return createRequire(relativeToPath).resolve(moduleName); | ||||
|         } catch (error) { | ||||
|  | ||||
|             // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future. | ||||
|             if ( | ||||
|                 typeof error === "object" && | ||||
|                 error !== null && | ||||
|                 error.code === "MODULE_NOT_FOUND" && | ||||
|                 !error.requireStack && | ||||
|                 error.message.includes(moduleName) | ||||
|             ) { | ||||
|                 error.message += `\nRequire stack:\n- ${relativeToPath}`; | ||||
|             } | ||||
|             throw error; | ||||
|         } | ||||
|     } | ||||
| }; | ||||
							
								
								
									
										167
									
								
								node_modules/eslint/lib/shared/runtime-info.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								node_modules/eslint/lib/shared/runtime-info.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,167 @@ | ||||
| /** | ||||
|  * @fileoverview Utility to get information about the execution environment. | ||||
|  * @author Kai Cataldo | ||||
|  */ | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Requirements | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| const path = require("path"); | ||||
| const spawn = require("cross-spawn"); | ||||
| const os = require("os"); | ||||
| const log = require("../shared/logging"); | ||||
| const packageJson = require("../../package.json"); | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Helpers | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * Generates and returns execution environment information. | ||||
|  * @returns {string} A string that contains execution environment information. | ||||
|  */ | ||||
| function environment() { | ||||
|     const cache = new Map(); | ||||
|  | ||||
|     /** | ||||
|      * Checks if a path is a child of a directory. | ||||
|      * @param {string} parentPath The parent path to check. | ||||
|      * @param {string} childPath The path to check. | ||||
|      * @returns {boolean} Whether or not the given path is a child of a directory. | ||||
|      */ | ||||
|     function isChildOfDirectory(parentPath, childPath) { | ||||
|         return !path.relative(parentPath, childPath).startsWith(".."); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 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) { | ||||
|         const key = [cmd, ...args].join(" "); | ||||
|  | ||||
|         if (cache.has(key)) { | ||||
|             return cache.get(key); | ||||
|         } | ||||
|  | ||||
|         const process = spawn.sync(cmd, args, { encoding: "utf8" }); | ||||
|  | ||||
|         if (process.error) { | ||||
|             throw process.error; | ||||
|         } | ||||
|  | ||||
|         const result = process.stdout.trim(); | ||||
|  | ||||
|         cache.set(key, result); | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Normalizes a version number. | ||||
|      * @param {string} versionStr The string to normalize. | ||||
|      * @returns {string} The normalized version number. | ||||
|      */ | ||||
|     function normalizeVersionStr(versionStr) { | ||||
|         return versionStr.startsWith("v") ? versionStr : `v${versionStr}`; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 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) { | ||||
|         const binArgs = ["--version"]; | ||||
|  | ||||
|         try { | ||||
|             return normalizeVersionStr(execCommand(bin, binArgs)); | ||||
|         } catch (e) { | ||||
|             log.error(`Error finding ${bin} version running the command \`${bin} ${binArgs.join(" ")}\``); | ||||
|             throw e; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 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", pkg]; | ||||
|  | ||||
|         if (global) { | ||||
|             npmLsArgs.push("-g"); | ||||
|         } | ||||
|  | ||||
|         try { | ||||
|             const parsedStdout = JSON.parse(execCommand("npm", npmLsArgs)); | ||||
|  | ||||
|             /* | ||||
|              * Checking globally returns an empty JSON object, while local checks | ||||
|              * include the name and version of the local project. | ||||
|              */ | ||||
|             if (Object.keys(parsedStdout).length === 0 || !(parsedStdout.dependencies && parsedStdout.dependencies.eslint)) { | ||||
|                 return "Not found"; | ||||
|             } | ||||
|  | ||||
|             const [, processBinPath] = process.argv; | ||||
|             let npmBinPath; | ||||
|  | ||||
|             try { | ||||
|                 npmBinPath = execCommand("npm", npmBinArgs); | ||||
|             } catch (e) { | ||||
|                 log.error(`Error finding npm binary path when running command \`npm ${npmBinArgs.join(" ")}\``); | ||||
|                 throw e; | ||||
|             } | ||||
|  | ||||
|             const isGlobal = isChildOfDirectory(npmBinPath, processBinPath); | ||||
|             let pkgVersion = parsedStdout.dependencies.eslint.version; | ||||
|  | ||||
|             if ((global && isGlobal) || (!global && !isGlobal)) { | ||||
|                 pkgVersion += " (Currently used)"; | ||||
|             } | ||||
|  | ||||
|             return normalizeVersionStr(pkgVersion); | ||||
|         } catch (e) { | ||||
|             log.error(`Error finding ${pkg} version running the command \`npm ${npmLsArgs.join(" ")}\``); | ||||
|             throw e; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     return [ | ||||
|         "Environment Info:", | ||||
|         "", | ||||
|         `Node version: ${getBinVersion("node")}`, | ||||
|         `npm version: ${getBinVersion("npm")}`, | ||||
|         `Local ESLint version: ${getNpmPackageVersion("eslint", { global: false })}`, | ||||
|         `Global ESLint version: ${getNpmPackageVersion("eslint", { global: true })}`, | ||||
|         `Operating System: ${os.platform()} ${os.release()}` | ||||
|     ].join("\n"); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Returns version of currently executing ESLint. | ||||
|  * @returns {string} The version from the currently executing ESLint's package.json. | ||||
|  */ | ||||
| function version() { | ||||
|     return `v${packageJson.version}`; | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Public Interface | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| module.exports = { | ||||
|     environment, | ||||
|     version | ||||
| }; | ||||
							
								
								
									
										49
									
								
								node_modules/eslint/lib/shared/severity.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								node_modules/eslint/lib/shared/severity.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| /** | ||||
|  * @fileoverview Helpers for severity values (e.g. normalizing different types). | ||||
|  * @author Bryan Mishkin | ||||
|  */ | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| /** | ||||
|  * Convert severity value of different types to a string. | ||||
|  * @param {string|number} severity severity value | ||||
|  * @throws error if severity is invalid | ||||
|  * @returns {string} severity string | ||||
|  */ | ||||
| function normalizeSeverityToString(severity) { | ||||
|     if ([2, "2", "error"].includes(severity)) { | ||||
|         return "error"; | ||||
|     } | ||||
|     if ([1, "1", "warn"].includes(severity)) { | ||||
|         return "warn"; | ||||
|     } | ||||
|     if ([0, "0", "off"].includes(severity)) { | ||||
|         return "off"; | ||||
|     } | ||||
|     throw new Error(`Invalid severity value: ${severity}`); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Convert severity value of different types to a number. | ||||
|  * @param {string|number} severity severity value | ||||
|  * @throws error if severity is invalid | ||||
|  * @returns {number} severity number | ||||
|  */ | ||||
| function normalizeSeverityToNumber(severity) { | ||||
|     if ([2, "2", "error"].includes(severity)) { | ||||
|         return 2; | ||||
|     } | ||||
|     if ([1, "1", "warn"].includes(severity)) { | ||||
|         return 1; | ||||
|     } | ||||
|     if ([0, "0", "off"].includes(severity)) { | ||||
|         return 0; | ||||
|     } | ||||
|     throw new Error(`Invalid severity value: ${severity}`); | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|     normalizeSeverityToString, | ||||
|     normalizeSeverityToNumber | ||||
| }; | ||||
							
								
								
									
										60
									
								
								node_modules/eslint/lib/shared/string-utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								node_modules/eslint/lib/shared/string-utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| /** | ||||
|  * @fileoverview Utilities to operate on strings. | ||||
|  * @author Stephen Wade | ||||
|  */ | ||||
|  | ||||
| "use strict"; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Requirements | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| const Graphemer = require("graphemer").default; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Helpers | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| // eslint-disable-next-line no-control-regex -- intentionally including control characters | ||||
| const ASCII_REGEX = /^[\u0000-\u007f]*$/u; | ||||
|  | ||||
| /** @type {Graphemer | undefined} */ | ||||
| let splitter; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Public Interface | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * Converts the first letter of a string to uppercase. | ||||
|  * @param {string} string The string to operate on | ||||
|  * @returns {string} The converted string | ||||
|  */ | ||||
| function upperCaseFirst(string) { | ||||
|     if (string.length <= 1) { | ||||
|         return string.toUpperCase(); | ||||
|     } | ||||
|     return string[0].toUpperCase() + string.slice(1); | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Counts graphemes in a given string. | ||||
|  * @param {string} value A string to count graphemes. | ||||
|  * @returns {number} The number of graphemes in `value`. | ||||
|  */ | ||||
| function getGraphemeCount(value) { | ||||
|     if (ASCII_REGEX.test(value)) { | ||||
|         return value.length; | ||||
|     } | ||||
|  | ||||
|     if (!splitter) { | ||||
|         splitter = new Graphemer(); | ||||
|     } | ||||
|  | ||||
|     return splitter.countGraphemes(value); | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|     upperCaseFirst, | ||||
|     getGraphemeCount | ||||
| }; | ||||
							
								
								
									
										195
									
								
								node_modules/eslint/lib/shared/traverser.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										195
									
								
								node_modules/eslint/lib/shared/traverser.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,195 @@ | ||||
| /** | ||||
|  * @fileoverview Traverser to traverse AST trees. | ||||
|  * @author Nicholas C. Zakas | ||||
|  * @author Toru Nagashima | ||||
|  */ | ||||
| "use strict"; | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Requirements | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| const vk = require("eslint-visitor-keys"); | ||||
| const debug = require("debug")("eslint:traverser"); | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| // Helpers | ||||
| //------------------------------------------------------------------------------ | ||||
|  | ||||
| /** | ||||
|  * Do nothing. | ||||
|  * @returns {void} | ||||
|  */ | ||||
| function noop() { | ||||
|  | ||||
|     // do nothing. | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Check whether the given value is an ASTNode or not. | ||||
|  * @param {any} x The value to check. | ||||
|  * @returns {boolean} `true` if the value is an ASTNode. | ||||
|  */ | ||||
| function isNode(x) { | ||||
|     return x !== null && typeof x === "object" && typeof x.type === "string"; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * Get the visitor keys of a given node. | ||||
|  * @param {Object} visitorKeys The map of visitor keys. | ||||
|  * @param {ASTNode} node The node to get their visitor keys. | ||||
|  * @returns {string[]} The visitor keys of the node. | ||||
|  */ | ||||
| function getVisitorKeys(visitorKeys, node) { | ||||
|     let keys = visitorKeys[node.type]; | ||||
|  | ||||
|     if (!keys) { | ||||
|         keys = vk.getKeys(node); | ||||
|         debug("Unknown node type \"%s\": Estimated visitor keys %j", node.type, keys); | ||||
|     } | ||||
|  | ||||
|     return keys; | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * The traverser class to traverse AST trees. | ||||
|  */ | ||||
| class Traverser { | ||||
|     constructor() { | ||||
|         this._current = null; | ||||
|         this._parents = []; | ||||
|         this._skipped = false; | ||||
|         this._broken = false; | ||||
|         this._visitorKeys = null; | ||||
|         this._enter = null; | ||||
|         this._leave = null; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gives current node. | ||||
|      * @returns {ASTNode} The current node. | ||||
|      */ | ||||
|     current() { | ||||
|         return this._current; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Gives a copy of the ancestor nodes. | ||||
|      * @returns {ASTNode[]} The ancestor nodes. | ||||
|      */ | ||||
|     parents() { | ||||
|         return this._parents.slice(0); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Break the current traversal. | ||||
|      * @returns {void} | ||||
|      */ | ||||
|     break() { | ||||
|         this._broken = true; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Skip child nodes for the current traversal. | ||||
|      * @returns {void} | ||||
|      */ | ||||
|     skip() { | ||||
|         this._skipped = true; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Traverse the given AST tree. | ||||
|      * @param {ASTNode} node The root node to traverse. | ||||
|      * @param {Object} options The option object. | ||||
|      * @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`. | ||||
|      * @param {Function} [options.enter=noop] The callback function which is called on entering each node. | ||||
|      * @param {Function} [options.leave=noop] The callback function which is called on leaving each node. | ||||
|      * @returns {void} | ||||
|      */ | ||||
|     traverse(node, options) { | ||||
|         this._current = null; | ||||
|         this._parents = []; | ||||
|         this._skipped = false; | ||||
|         this._broken = false; | ||||
|         this._visitorKeys = options.visitorKeys || vk.KEYS; | ||||
|         this._enter = options.enter || noop; | ||||
|         this._leave = options.leave || noop; | ||||
|         this._traverse(node, null); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Traverse the given AST tree recursively. | ||||
|      * @param {ASTNode} node The current node. | ||||
|      * @param {ASTNode|null} parent The parent node. | ||||
|      * @returns {void} | ||||
|      * @private | ||||
|      */ | ||||
|     _traverse(node, parent) { | ||||
|         if (!isNode(node)) { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         this._current = node; | ||||
|         this._skipped = false; | ||||
|         this._enter(node, parent); | ||||
|  | ||||
|         if (!this._skipped && !this._broken) { | ||||
|             const keys = getVisitorKeys(this._visitorKeys, node); | ||||
|  | ||||
|             if (keys.length >= 1) { | ||||
|                 this._parents.push(node); | ||||
|                 for (let i = 0; i < keys.length && !this._broken; ++i) { | ||||
|                     const child = node[keys[i]]; | ||||
|  | ||||
|                     if (Array.isArray(child)) { | ||||
|                         for (let j = 0; j < child.length && !this._broken; ++j) { | ||||
|                             this._traverse(child[j], node); | ||||
|                         } | ||||
|                     } else { | ||||
|                         this._traverse(child, node); | ||||
|                     } | ||||
|                 } | ||||
|                 this._parents.pop(); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (!this._broken) { | ||||
|             this._leave(node, parent); | ||||
|         } | ||||
|  | ||||
|         this._current = parent; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Calculates the keys to use for traversal. | ||||
|      * @param {ASTNode} node The node to read keys from. | ||||
|      * @returns {string[]} An array of keys to visit on the node. | ||||
|      * @private | ||||
|      */ | ||||
|     static getKeys(node) { | ||||
|         return vk.getKeys(node); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Traverse the given AST tree. | ||||
|      * @param {ASTNode} node The root node to traverse. | ||||
|      * @param {Object} options The option object. | ||||
|      * @param {Object} [options.visitorKeys=DEFAULT_VISITOR_KEYS] The keys of each node types to traverse child nodes. Default is `./default-visitor-keys.json`. | ||||
|      * @param {Function} [options.enter=noop] The callback function which is called on entering each node. | ||||
|      * @param {Function} [options.leave=noop] The callback function which is called on leaving each node. | ||||
|      * @returns {void} | ||||
|      */ | ||||
|     static traverse(node, options) { | ||||
|         new Traverser().traverse(node, options); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * The default visitor keys. | ||||
|      * @type {Object} | ||||
|      */ | ||||
|     static get DEFAULT_VISITOR_KEYS() { | ||||
|         return vk.KEYS; | ||||
|     } | ||||
| } | ||||
|  | ||||
| module.exports = Traverser; | ||||
							
								
								
									
										216
									
								
								node_modules/eslint/lib/shared/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										216
									
								
								node_modules/eslint/lib/shared/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,216 @@ | ||||
| /** | ||||
|  * @fileoverview Define common types for input completion. | ||||
|  * @author Toru Nagashima <https://github.com/mysticatea> | ||||
|  */ | ||||
| "use strict"; | ||||
|  | ||||
| /** @type {any} */ | ||||
| module.exports = {}; | ||||
|  | ||||
| /** @typedef {boolean | "off" | "readable" | "readonly" | "writable" | "writeable"} GlobalConf */ | ||||
| /** @typedef {0 | 1 | 2 | "off" | "warn" | "error"} SeverityConf */ | ||||
| /** @typedef {SeverityConf | [SeverityConf, ...any[]]} RuleConf */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} EcmaFeatures | ||||
|  * @property {boolean} [globalReturn] Enabling `return` statements at the top-level. | ||||
|  * @property {boolean} [jsx] Enabling JSX syntax. | ||||
|  * @property {boolean} [impliedStrict] Enabling strict mode always. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} ParserOptions | ||||
|  * @property {EcmaFeatures} [ecmaFeatures] The optional features. | ||||
|  * @property {3|5|6|7|8|9|10|11|12|13|14|15|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024} [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. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} ConfigData | ||||
|  * @property {Record<string, boolean>} [env] The environment settings. | ||||
|  * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. | ||||
|  * @property {Record<string, GlobalConf>} [globals] The global variable settings. | ||||
|  * @property {string | string[]} [ignorePatterns] The glob patterns that ignore to lint. | ||||
|  * @property {boolean} [noInlineConfig] The flag that disables directive comments. | ||||
|  * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. | ||||
|  * @property {string} [parser] The path to a parser or the package name of a parser. | ||||
|  * @property {ParserOptions} [parserOptions] The parser options. | ||||
|  * @property {string[]} [plugins] The plugin specifiers. | ||||
|  * @property {string} [processor] The processor specifier. | ||||
|  * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. | ||||
|  * @property {boolean} [root] The root flag. | ||||
|  * @property {Record<string, RuleConf>} [rules] The rule settings. | ||||
|  * @property {Object} [settings] The shared settings. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} OverrideConfigData | ||||
|  * @property {Record<string, boolean>} [env] The environment settings. | ||||
|  * @property {string | string[]} [excludedFiles] The glob patterns for excluded files. | ||||
|  * @property {string | string[]} [extends] The path to other config files or the package name of shareable configs. | ||||
|  * @property {string | string[]} files The glob patterns for target files. | ||||
|  * @property {Record<string, GlobalConf>} [globals] The global variable settings. | ||||
|  * @property {boolean} [noInlineConfig] The flag that disables directive comments. | ||||
|  * @property {OverrideConfigData[]} [overrides] The override settings per kind of files. | ||||
|  * @property {string} [parser] The path to a parser or the package name of a parser. | ||||
|  * @property {ParserOptions} [parserOptions] The parser options. | ||||
|  * @property {string[]} [plugins] The plugin specifiers. | ||||
|  * @property {string} [processor] The processor specifier. | ||||
|  * @property {boolean} [reportUnusedDisableDirectives] The flag to report unused `eslint-disable` comments. | ||||
|  * @property {Record<string, RuleConf>} [rules] The rule settings. | ||||
|  * @property {Object} [settings] The shared settings. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} ParseResult | ||||
|  * @property {Object} ast The AST. | ||||
|  * @property {ScopeManager} [scopeManager] The scope manager of the AST. | ||||
|  * @property {Record<string, any>} [services] The services that the parser provides. | ||||
|  * @property {Record<string, string[]>} [visitorKeys] The visitor keys of the AST. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} Parser | ||||
|  * @property {(text:string, options:ParserOptions) => Object} parse The definition of global variables. | ||||
|  * @property {(text:string, options:ParserOptions) => ParseResult} [parseForESLint] The parser options that will be enabled under this environment. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} Environment | ||||
|  * @property {Record<string, GlobalConf>} [globals] The definition of global variables. | ||||
|  * @property {ParserOptions} [parserOptions] The parser options that will be enabled under this environment. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} LintMessage | ||||
|  * @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} [messageId] The ID of the message in the rule's meta. | ||||
|  * @property {(string|null)} nodeType Type of node | ||||
|  * @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} [messageId] The ID of the message in the rule's meta. | ||||
|  * @property {(string|null)} nodeType Type of node | ||||
|  * @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. | ||||
|  * @property {string} [messageId] Id referencing a message for the description. | ||||
|  * @property {{ text: string, range: number[] }} fix fix result info | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} Processor | ||||
|  * @property {(text:string, filename:string) => Array<string | { text:string, filename:string }>} [preprocess] The function to extract code blocks. | ||||
|  * @property {(messagesList:LintMessage[][], filename:string) => LintMessage[]} [postprocess] The function to merge messages. | ||||
|  * @property {boolean} [supportsAutofix] If `true` then it means the processor supports autofix. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} RuleMetaDocs | ||||
|  * @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. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} RuleMeta | ||||
|  * @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. | ||||
|  * @property {"problem"|"suggestion"|"layout"} type The rule type. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} Rule | ||||
|  * @property {Function} create The factory of the rule. | ||||
|  * @property {RuleMeta} meta The meta data of the rule. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * @typedef {Object} Plugin | ||||
|  * @property {Record<string, ConfigData>} [configs] The definition of plugin configs. | ||||
|  * @property {Record<string, Environment>} [environments] The definition of plugin environments. | ||||
|  * @property {Record<string, Processor>} [processors] The definition of plugin processors. | ||||
|  * @property {Record<string, Function | Rule>} [rules] The definition of plugin rules. | ||||
|  */ | ||||
|  | ||||
| /** | ||||
|  * Information of deprecated rules. | ||||
|  * @typedef {Object} DeprecatedRuleInfo | ||||
|  * @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. | ||||
|  */ | ||||
		Reference in New Issue
	
	Block a user