mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
feat(linter): add schema for typescript/no-duplicate-type-constituents (#23308)
This commit is contained in:
1 parent
937accf58f
commit
f9e36f1738
4 files changed
+89
-5
No files matched your search
@@ -1310,7 +1310,10 @@ export interface DummyRuleMap {
|
||||
| [AllowWarnDeny, NoConfusingVoidExpressionConfig];
|
||||
"typescript/no-deprecated"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, NoDeprecatedConfig];
|
||||
"typescript/no-duplicate-enum-values"?: RuleNoConfig;
|
||||
"typescript/no-duplicate-type-constituents"?: DummyRule;
|
||||
"typescript/no-duplicate-type-constituents"?:
|
||||
| AllowWarnDeny
|
||||
| [AllowWarnDeny]
|
||||
| [AllowWarnDeny, NoDuplicateTypeConstituentsConfig];
|
||||
"typescript/no-dynamic-delete"?: RuleNoConfig;
|
||||
"typescript/no-empty-interface"?: AllowWarnDeny | [AllowWarnDeny] | [AllowWarnDeny, NoEmptyInterface];
|
||||
"typescript/no-empty-object-type"?: DummyRule;
|
||||
@@ -4698,6 +4701,18 @@ export interface PackageSpecifier {
|
||||
*/
|
||||
package: string;
|
||||
}
|
||||
export interface NoDuplicateTypeConstituentsConfig {
|
||||
/**
|
||||
* Whether to ignore duplicate types in intersection types.
|
||||
* When true, allows `type T = A & A`.
|
||||
*/
|
||||
ignoreIntersections?: boolean;
|
||||
/**
|
||||
* Whether to ignore duplicate types in union types.
|
||||
* When true, allows `type T = A | A`.
|
||||
*/
|
||||
ignoreUnions?: boolean;
|
||||
}
|
||||
export interface NoEmptyInterface {
|
||||
/**
|
||||
* When set to `true`, allows empty interfaces that extend a single interface.
|
||||
|
||||
@@ -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; 42] = [
|
||||
const NO_VERIFIED_VALID_SCHEMA: [&str; 41] = [
|
||||
"eslint/func-name-matching",
|
||||
"eslint/no-restricted-globals",
|
||||
"eslint/no-restricted-imports",
|
||||
@@ -48,7 +48,6 @@ const NO_VERIFIED_VALID_SCHEMA: [&str; 42] = [
|
||||
"typescript/consistent-type-assertions",
|
||||
"typescript/consistent-type-imports",
|
||||
"typescript/no-empty-object-type",
|
||||
"typescript/no-duplicate-type-constituents",
|
||||
"typescript/no-restricted-types",
|
||||
"unicorn/filename-case",
|
||||
"unicorn/import-style",
|
||||
|
||||
@@ -6402,7 +6402,24 @@
|
||||
"$ref": "#/definitions/RuleNoConfig"
|
||||
},
|
||||
"typescript/no-duplicate-type-constituents": {
|
||||
"$ref": "#/definitions/DummyRule"
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/AllowWarnDeny"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"$ref": "#/definitions/AllowWarnDeny"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/NoDuplicateTypeConstituentsConfig"
|
||||
}
|
||||
],
|
||||
"maxItems": 2,
|
||||
"minItems": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"typescript/no-dynamic-delete": {
|
||||
"$ref": "#/definitions/RuleNoConfig"
|
||||
@@ -11456,6 +11473,24 @@
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"NoDuplicateTypeConstituentsConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ignoreIntersections": {
|
||||
"description": "Whether to ignore duplicate types in intersection types.\nWhen true, allows `type T = A & A`.",
|
||||
"default": false,
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Whether to ignore duplicate types in intersection types.\nWhen true, allows `type T = A & A`."
|
||||
},
|
||||
"ignoreUnions": {
|
||||
"description": "Whether to ignore duplicate types in union types.\nWhen true, allows `type T = A | A`.",
|
||||
"default": false,
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Whether to ignore duplicate types in union types.\nWhen true, allows `type T = A | A`."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"NoDuplicates": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -6406,7 +6406,24 @@ expression: json
|
||||
"$ref": "#/definitions/RuleNoConfig"
|
||||
},
|
||||
"typescript/no-duplicate-type-constituents": {
|
||||
"$ref": "#/definitions/DummyRule"
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/AllowWarnDeny"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"$ref": "#/definitions/AllowWarnDeny"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/NoDuplicateTypeConstituentsConfig"
|
||||
}
|
||||
],
|
||||
"maxItems": 2,
|
||||
"minItems": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"typescript/no-dynamic-delete": {
|
||||
"$ref": "#/definitions/RuleNoConfig"
|
||||
@@ -11460,6 +11477,24 @@ expression: json
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"NoDuplicateTypeConstituentsConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ignoreIntersections": {
|
||||
"description": "Whether to ignore duplicate types in intersection types.\nWhen true, allows `type T = A & A`.",
|
||||
"default": false,
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Whether to ignore duplicate types in intersection types.\nWhen true, allows `type T = A & A`."
|
||||
},
|
||||
"ignoreUnions": {
|
||||
"description": "Whether to ignore duplicate types in union types.\nWhen true, allows `type T = A | A`.",
|
||||
"default": false,
|
||||
"type": "boolean",
|
||||
"markdownDescription": "Whether to ignore duplicate types in union types.\nWhen true, allows `type T = A | A`."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"NoDuplicates": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in new issue
Block a user