feat(linter): add schema for consistent-generic-constructors (#23353)

This commit is contained in:
Sysix committed 2026-06-12 15:07:59 +00:00
1 parent 2783295639
commit 59db0bd215
4 files changed
+79 -5

No files matched your search

@@ -189,6 +189,7 @@ export type ImportKind = "none" | "all" | "multiple" | "single";
*/
export type SortOrder = "desc" | "asc";
export type ClassLiteralPropertyStyleOption = "fields" | "getters";
export type PreferGenericType = "constructor" | "type-annotation";
export type ConsistentIndexedObjectStyleConfig = "record" | "index-signature";
export type ArrayLiteralTypeAssertions = "allow" | "allow-as-parameter" | "never";
export type AssertionStyle = "as" | "angle-bracket" | "never";
@@ -1286,7 +1287,7 @@ export interface DummyRuleMap {
| AllowWarnDeny
| [AllowWarnDeny]
| [AllowWarnDeny, ClassLiteralPropertyStyleOption];
"typescript/consistent-generic-constructors"?: DummyRule;
"typescript/consistent-generic-constructors"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, PreferGenericType];
"typescript/consistent-indexed-object-style"?:
| AllowWarnDeny
| [AllowWarnDeny]
+1 -2
View File
@@ -13,7 +13,7 @@ use crate::rules::RuleEnum;
/// These should return the DummyRule struct/schema instead of the actual rule struct/schema,
/// until we verify that the rule's schema is valid and can be generated by schemars.
#[cfg(feature = "ruledocs")]
const NO_VERIFIED_VALID_SCHEMA: [&str; 35] = [
const NO_VERIFIED_VALID_SCHEMA: [&str; 34] = [
"eslint/func-name-matching", // second config can be on first position like [AllowWarnDeny, Config1, Config2] | [AllowWarnDeny, Config1] | [AllowWarnDeny, Config2]
"eslint/no-restricted-globals", // uses spread syntax like [AllowWarnDeny, ...Config]
"eslint/no-restricted-imports", // uses spread syntax like [AllowWarnDeny, ...Config]
@@ -43,7 +43,6 @@ const NO_VERIFIED_VALID_SCHEMA: [&str; 35] = [
"react_perf/jsx-no-new-object-as-prop",
"typescript/array-type",
"typescript/ban-ts-comment",
"typescript/consistent-generic-constructors",
"typescript/no-restricted-types",
"unicorn/filename-case",
"unicorn/import-style",
+38 -1
View File
@@ -6364,7 +6364,24 @@
]
},
"typescript/consistent-generic-constructors": {
"$ref": "#/definitions/DummyRule"
"anyOf": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"type": "array",
"items": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"$ref": "#/definitions/PreferGenericType"
}
],
"maxItems": 2,
"minItems": 1
}
]
},
"typescript/consistent-indexed-object-style": {
"anyOf": [
@@ -14835,6 +14852,26 @@
},
"additionalProperties": false
},
"PreferGenericType": {
"oneOf": [
{
"description": "Type arguments that only appear on the type annotation are disallowed.",
"type": "string",
"enum": [
"constructor"
],
"markdownDescription": "Type arguments that only appear on the type annotation are disallowed."
},
{
"description": "Type arguments that only appear on the constructor are disallowed.",
"type": "string",
"enum": [
"type-annotation"
],
"markdownDescription": "Type arguments that only appear on the constructor are disallowed."
}
]
},
"PreferImportInMockConfig": {
"type": "object",
"required": [
@@ -6368,7 +6368,24 @@ expression: json
]
},
"typescript/consistent-generic-constructors": {
"$ref": "#/definitions/DummyRule"
"anyOf": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"type": "array",
"items": [
{
"$ref": "#/definitions/AllowWarnDeny"
},
{
"$ref": "#/definitions/PreferGenericType"
}
],
"maxItems": 2,
"minItems": 1
}
]
},
"typescript/consistent-indexed-object-style": {
"anyOf": [
@@ -14839,6 +14856,26 @@ expression: json
},
"additionalProperties": false
},
"PreferGenericType": {
"oneOf": [
{
"description": "Type arguments that only appear on the type annotation are disallowed.",
"type": "string",
"enum": [
"constructor"
],
"markdownDescription": "Type arguments that only appear on the type annotation are disallowed."
},
{
"description": "Type arguments that only appear on the constructor are disallowed.",
"type": "string",
"enum": [
"type-annotation"
],
"markdownDescription": "Type arguments that only appear on the constructor are disallowed."
}
]
},
"PreferImportInMockConfig": {
"type": "object",
"required": [