Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fbb8be9

Browse filesBrowse files
authored
fix: add info to ESLint.DeprecatedRuleUse type (#19701)
* fix: add `info` to `ESLint.DeprecatedRuleUse` type * fix typo
1 parent f0f0d46 commit fbb8be9
Copy full SHA for fbb8be9

File tree

5 files changed

+34
-3
lines changed
Filter options

5 files changed

+34
-3
lines changed

‎lib/cli-engine/cli-engine.js

Copy file name to clipboardExpand all lines: lib/cli-engine/cli-engine.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]);
5858
//------------------------------------------------------------------------------
5959

6060
// For VSCode IntelliSense
61-
/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */
6261
/** @typedef {import("../shared/types").LintMessage} LintMessage */
6362
/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */
6463
/** @typedef {import("../shared/types").ParserOptions} ParserOptions */
6564
/** @typedef {import("../shared/types").RuleConf} RuleConf */
6665
/** @typedef {import("../types").ESLint.ConfigData} ConfigData */
66+
/** @typedef {import("../types").ESLint.DeprecatedRuleUse} DeprecatedRuleInfo */
6767
/** @typedef {import("../types").ESLint.FormatterFunction} FormatterFunction */
6868
/** @typedef {import("../types").ESLint.Plugin} Plugin */
6969
/** @typedef {import("../types").Rule.RuleModule} Rule */

‎lib/eslint/eslint.js

Copy file name to clipboardExpand all lines: lib/eslint/eslint.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ const { ConfigLoader, LegacyConfigLoader } = require("../config/config-loader");
5757
* @import { CLIEngineLintReport } from "./legacy-eslint.js";
5858
* @import { FlatConfigArray } from "../config/flat-config-array.js";
5959
* @import { RuleDefinition } from "@eslint/core";
60-
* @import { DeprecatedRuleInfo, LintMessage, LintResult, ResultsMeta } from "../shared/types.js";
60+
* @import { LintMessage, LintResult, ResultsMeta } from "../shared/types.js";
6161
*/
6262

6363
/** @typedef {ReturnType<ConfigArray.extractConfig>} ExtractedConfig */
6464
/** @typedef {import("../types").Linter.Config} Config */
65+
/** @typedef {import("../types").ESLint.DeprecatedRuleUse} DeprecatedRuleInfo */
6566
/** @typedef {import("../types").ESLint.Plugin} Plugin */
6667

6768
/**

‎lib/eslint/legacy-eslint.js

Copy file name to clipboardExpand all lines: lib/eslint/legacy-eslint.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ const { version } = require("../../package.json");
3030
//------------------------------------------------------------------------------
3131

3232
/** @typedef {import("../cli-engine/cli-engine").LintReport} CLIEngineLintReport */
33-
/** @typedef {import("../shared/types").DeprecatedRuleInfo} DeprecatedRuleInfo */
3433
/** @typedef {import("../shared/types").LintMessage} LintMessage */
3534
/** @typedef {import("../shared/types").SuppressedLintMessage} SuppressedLintMessage */
3635
/** @typedef {import("../shared/types").LintResult} LintResult */
3736
/** @typedef {import("../shared/types").ResultsMeta} ResultsMeta */
3837
/** @typedef {import("../types").ESLint.ConfigData} ConfigData */
38+
/** @typedef {import("../types").ESLint.DeprecatedRuleUse} DeprecatedRuleInfo */
3939
/** @typedef {import("../types").ESLint.Plugin} Plugin */
4040
/** @typedef {import("../types").Rule.RuleModule} Rule */
4141

‎lib/types/index.d.ts

Copy file name to clipboardExpand all lines: lib/types/index.d.ts
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,9 +2057,25 @@ export namespace ESLint {
20572057
};
20582058
}
20592059

2060+
/**
2061+
* Information about deprecated rules.
2062+
*/
20602063
interface DeprecatedRuleUse {
2064+
/**
2065+
* The rule ID.
2066+
*/
20612067
ruleId: string;
2068+
2069+
/**
2070+
* The rule IDs that replace this deprecated rule.
2071+
*/
20622072
replacedBy: string[];
2073+
2074+
/**
2075+
* The raw deprecated info provided by the rule.
2076+
* Unset if the rule's `meta.deprecated` property is a boolean.
2077+
*/
2078+
info?: DeprecatedInfo;
20632079
}
20642080

20652081
interface ResultsMeta {

‎tests/lib/types/types.test.ts

Copy file name to clipboardExpand all lines: tests/lib/types/types.test.ts
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,6 +1774,20 @@ for (const result of results) {
17741774
};
17751775
delete result.stats;
17761776

1777+
const deprecatedRule = result.usedDeprecatedRules[0];
1778+
deprecatedRule.ruleId = "foo";
1779+
deprecatedRule.replacedBy = ["bar"];
1780+
deprecatedRule.info = {
1781+
message: "use bar instead",
1782+
replacedBy: [
1783+
{
1784+
rule: {
1785+
name: "bar",
1786+
},
1787+
},
1788+
],
1789+
};
1790+
17771791
for (const message of result.messages) {
17781792
message.ruleId = "foo";
17791793
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.