Skip to content

Commit 732433c

Browse files
authored
fix: allow any type for meta.docs.recommended in custom rules (#19995)
1 parent 34f0723 commit 732433c

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

docs/src/extend/custom-rules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The source file for a rule exports an object with the following properties. Both
5050
- `docs`: (`object`) Properties often used for documentation generation and tooling. Required for core rules and optional for custom rules. Custom rules can include additional properties here as needed.
5151

5252
- `description`: (`string`) Provides a short description of the rule. For core rules, this is used in [rules index](../rules/).
53-
- `recommended`: (`boolean`) For core rules, this specifies whether the rule is enabled by the `recommended` config from `@eslint/js`.
53+
- `recommended`: (`unknown`) For core rules, this is a boolean value specifying whether the rule is enabled by the `recommended` config from `@eslint/js`.
5454
- `url`: (`string`) Specifies the URL at which the full documentation can be accessed. Code editors often use this to provide a helpful link on highlighted rule violations.
5555

5656
- `fixable`: (`string`) Either `"code"` or `"whitespace"` if the `--fix` option on the [command line](../use/command-line-interface#--fix) automatically fixes problems reported by the rule.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@
107107
"@eslint-community/eslint-utils": "^4.2.0",
108108
"@eslint-community/regexpp": "^4.12.1",
109109
"@eslint/config-array": "^0.21.0",
110-
"@eslint/config-helpers": "^0.3.0",
111-
"@eslint/core": "^0.15.0",
110+
"@eslint/config-helpers": "^0.3.1",
111+
"@eslint/core": "^0.15.2",
112112
"@eslint/eslintrc": "^3.3.1",
113113
"@eslint/js": "9.32.0",
114-
"@eslint/plugin-kit": "^0.3.4",
114+
"@eslint/plugin-kit": "^0.3.5",
115115
"@humanfs/node": "^0.16.6",
116116
"@humanwhocodes/module-importer": "^1.0.1",
117117
"@humanwhocodes/retry": "^0.4.2",

tests/lib/types/types.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,21 @@ type DeprecatedRuleContextKeys =
897897
},
898898
});
899899

900+
// `meta.docs.recommended` can be any type
901+
(): JSRuleDefinition => ({
902+
create() {
903+
return {};
904+
},
905+
meta: {
906+
docs: {
907+
recommended: {
908+
severity: "warn",
909+
options: ["never"],
910+
},
911+
},
912+
},
913+
});
914+
900915
// #endregion
901916

902917
// #region Linter

0 commit comments

Comments
 (0)