]> git.proxmox.com Git - pve-eslint.git/blobdiff - eslint/lib/shared/types.js
import 8.23.1 source
[pve-eslint.git] / eslint / lib / shared / types.js
index ab59207a6b116432a2d86e036e0737b3ce8817ba..60f9f1d6afe9e2945c2a3d25d76552121876abf7 100644 (file)
@@ -21,7 +21,7 @@ module.exports = {};
 /**
  * @typedef {Object} ParserOptions
  * @property {EcmaFeatures} [ecmaFeatures] The optional features.
- * @property {3|5|6|7|8|9|10|11|12|13|2015|2016|2017|2018|2019|2020|2021|2022} [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.
  */
@@ -105,6 +105,21 @@ module.exports = {};
  * @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.
@@ -121,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.
@@ -132,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.
@@ -158,3 +173,27 @@ 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.
+ */
+
+/**
+ * A formatter function.
+ * @callback FormatterFunction
+ * @param {LintResult[]} results The list of linting results.
+ * @param {{cwd: string, rulesMeta: Record<string, RuleMeta>}} [context] A context object.
+ * @returns {string | Promise<string>} Formatted text.
+ */