mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-06 17:34:25 +00:00
feat(linter): mark typescript rules as recommended from upstream (#27634)
Marks all `recommended` rules from `typescript-eslint` as recommended here too.
This commit is contained in:
1 parent
f41fb7edb8
commit
c44a355261
41 files changed
+50
-2
No files matched your search
@@ -49,6 +49,7 @@ declare_oxc_lint!(
|
||||
AwaitThenable(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
suggestion,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows awaiting a value that is not a Thenable.",
|
||||
|
||||
@@ -189,6 +189,7 @@ declare_oxc_lint!(
|
||||
BanTsComment,
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
conditional_fix,
|
||||
config = BanTsCommentConfig,
|
||||
version = "0.0.8",
|
||||
|
||||
@@ -37,6 +37,7 @@ declare_oxc_lint!(
|
||||
NoArrayDelete(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
suggestion,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows using the delete operator on array values.",
|
||||
|
||||
@@ -78,6 +78,7 @@ declare_oxc_lint!(
|
||||
NoBaseToString(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
config = NoBaseToStringConfig,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule requires `toString()` and `toLocaleString()` calls to only be called on objects which provide useful information when stringified.",
|
||||
|
||||
@@ -94,6 +94,7 @@ declare_oxc_lint!(
|
||||
NoDuplicateEnumValues,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
version = "0.0.8",
|
||||
short_description = "Disallow duplicate enum member values.",
|
||||
);
|
||||
|
||||
@@ -63,6 +63,7 @@ declare_oxc_lint!(
|
||||
NoDuplicateTypeConstituents(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
fix,
|
||||
config = NoDuplicateTypeConstituentsConfig,
|
||||
version = "1.12.0",
|
||||
|
||||
@@ -162,6 +162,7 @@ declare_oxc_lint!(
|
||||
NoEmptyObjectType,
|
||||
typescript,
|
||||
restriction,
|
||||
recommended,
|
||||
conditional_suggestion,
|
||||
config = NoEmptyObjectTypeConfig,
|
||||
version = "0.12.0",
|
||||
|
||||
@@ -72,6 +72,7 @@ declare_oxc_lint!(
|
||||
NoExplicitAny,
|
||||
typescript,
|
||||
restriction,
|
||||
recommended,
|
||||
conditional_fix,
|
||||
config = NoExplicitAny,
|
||||
version = "0.0.13",
|
||||
|
||||
@@ -74,6 +74,7 @@ declare_oxc_lint!(
|
||||
NoExtraNonNullAssertion,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
fix,
|
||||
version = "0.0.6",
|
||||
short_description = "Disallow extra non-null assertions.",
|
||||
|
||||
@@ -106,6 +106,7 @@ declare_oxc_lint!(
|
||||
NoFloatingPromises(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
suggestion,
|
||||
config = NoFloatingPromisesConfig,
|
||||
version = "1.11.0",
|
||||
|
||||
@@ -57,6 +57,7 @@ declare_oxc_lint!(
|
||||
NoForInArray(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows iterating over an array with a for-in loop.",
|
||||
);
|
||||
|
||||
@@ -50,6 +50,7 @@ declare_oxc_lint!(
|
||||
NoImpliedEval(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows the use of eval-like methods.",
|
||||
);
|
||||
|
||||
@@ -96,6 +96,7 @@ declare_oxc_lint!(
|
||||
NoMisusedNew,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
version = "0.0.7",
|
||||
short_description = "Enforce valid definitions of `new` and `constructor` in TypeScript.",
|
||||
);
|
||||
|
||||
@@ -125,6 +125,7 @@ declare_oxc_lint!(
|
||||
NoMisusedPromises(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
config = NoMisusedPromisesConfig,
|
||||
version = "1.11.0",
|
||||
short_description = "Disallow Promises in places not designed to handle them.",
|
||||
|
||||
@@ -113,6 +113,7 @@ declare_oxc_lint!(
|
||||
NoNamespace,
|
||||
typescript,
|
||||
restriction,
|
||||
recommended,
|
||||
config = NoNamespace,
|
||||
version = "0.0.8",
|
||||
short_description = "Disallow TypeScript namespaces.",
|
||||
|
||||
@@ -57,6 +57,7 @@ declare_oxc_lint!(
|
||||
NoNonNullAssertedOptionalChain,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
suggestion,
|
||||
version = "0.0.6",
|
||||
short_description = "Disallow non-null assertions after an optional chain expression.",
|
||||
|
||||
@@ -51,6 +51,7 @@ declare_oxc_lint!(
|
||||
NoRedundantTypeConstituents(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows type constituents of unions and intersections that are redundant.",
|
||||
);
|
||||
|
||||
@@ -115,6 +115,7 @@ declare_oxc_lint!(
|
||||
NoRequireImports,
|
||||
typescript,
|
||||
restriction,
|
||||
recommended,
|
||||
pending, // TODO: fixer (change require to import)
|
||||
config = NoRequireImportsConfig,
|
||||
version = "0.13.0",
|
||||
|
||||
@@ -96,6 +96,7 @@ declare_oxc_lint!(
|
||||
NoThisAlias,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
config = NoThisAliasConfig,
|
||||
version = "0.0.7",
|
||||
short_description = "Disallow aliasing of `this`.",
|
||||
|
||||
@@ -66,6 +66,7 @@ declare_oxc_lint!(
|
||||
NoUnnecessaryTypeAssertion(tsgolint),
|
||||
typescript,
|
||||
suspicious,
|
||||
recommended,
|
||||
fix,
|
||||
config = NoUnnecessaryTypeAssertionConfig,
|
||||
version = "1.12.0",
|
||||
|
||||
@@ -79,6 +79,7 @@ declare_oxc_lint!(
|
||||
NoUnnecessaryTypeConstraint,
|
||||
typescript,
|
||||
suspicious,
|
||||
recommended,
|
||||
suggestion,
|
||||
version = "0.0.6",
|
||||
short_description = "Disallow unnecessary constraints on generic types.",
|
||||
|
||||
@@ -53,6 +53,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeArgument(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows calling a function with an argument which is typed as `any`.",
|
||||
);
|
||||
|
||||
@@ -59,6 +59,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeAssignment(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows assigning a value with type `any` to variables and properties.",
|
||||
);
|
||||
|
||||
@@ -51,6 +51,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeCall(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows calling a value with type `any`.",
|
||||
);
|
||||
|
||||
@@ -45,6 +45,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeDeclarationMerging,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
version = "0.0.11",
|
||||
short_description = "Disallow unsafe declaration merging.",
|
||||
);
|
||||
|
||||
@@ -63,6 +63,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeEnumComparison(tsgolint),
|
||||
typescript,
|
||||
suspicious,
|
||||
recommended,
|
||||
suggestion,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows comparing an enum value with a non-enum value.",
|
||||
|
||||
@@ -55,6 +55,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeFunctionType,
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
version = "0.11.1",
|
||||
short_description = "Disallow using the unsafe built-in Function type.",
|
||||
);
|
||||
|
||||
@@ -62,6 +62,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeMemberAccess(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
config = NoUnsafeMemberAccessConfig,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows member access on a value with type `any`.",
|
||||
|
||||
@@ -58,6 +58,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeReturn(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows returning a value with type `any` from a function.",
|
||||
);
|
||||
|
||||
@@ -56,6 +56,7 @@ declare_oxc_lint!(
|
||||
NoUnsafeUnaryMinus(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows using the unary minus operator on a value which is not of type 'number' | 'bigint'.",
|
||||
);
|
||||
|
||||
@@ -53,6 +53,7 @@ declare_oxc_lint!(
|
||||
NoWrapperObjectTypes,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
fix,
|
||||
version = "0.8.0",
|
||||
short_description = "Disallow the use of wrapper object types.",
|
||||
|
||||
@@ -88,6 +88,7 @@ declare_oxc_lint!(
|
||||
OnlyThrowError(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
config = OnlyThrowErrorConfig,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows throwing non-Error values.",
|
||||
|
||||
@@ -56,6 +56,7 @@ declare_oxc_lint!(
|
||||
PreferAsConst,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
conditional_fix,
|
||||
version = "0.0.8",
|
||||
short_description = "Enforce the use of `as const` over literal types.",
|
||||
|
||||
@@ -58,6 +58,7 @@ declare_oxc_lint!(
|
||||
PreferNamespaceKeyword,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
fix,
|
||||
version = "0.7.0",
|
||||
short_description = "Require using `namespace` keyword over `module` keyword to declare custom TypeScript modules.",
|
||||
|
||||
@@ -77,6 +77,7 @@ declare_oxc_lint!(
|
||||
PreferPromiseRejectErrors(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
config = PreferPromiseRejectErrorsConfig,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule enforces passing an Error object to `Promise.reject()`.",
|
||||
|
||||
@@ -74,6 +74,7 @@ declare_oxc_lint!(
|
||||
RequireAwait(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
suggestion,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule disallows async functions which do not have an await expression.",
|
||||
|
||||
@@ -92,6 +92,7 @@ declare_oxc_lint!(
|
||||
RestrictPlusOperands(tsgolint),
|
||||
typescript,
|
||||
pedantic,
|
||||
recommended,
|
||||
config = RestrictPlusOperandsConfig,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule requires both operands of addition to be the same type and be number, string, or any.",
|
||||
|
||||
@@ -122,6 +122,7 @@ declare_oxc_lint!(
|
||||
RestrictTemplateExpressions(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
config = RestrictTemplateExpressionsConfig,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule restricts the types allowed in template literal expressions.",
|
||||
|
||||
@@ -88,6 +88,7 @@ declare_oxc_lint!(
|
||||
TripleSlashReference,
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
config = TripleSlashReferenceConfig,
|
||||
version = "0.2.0",
|
||||
short_description = "Disallow certain triple slash directives in favor of ES module import declarations.",
|
||||
|
||||
@@ -96,6 +96,7 @@ declare_oxc_lint!(
|
||||
UnboundMethod(tsgolint),
|
||||
typescript,
|
||||
correctness,
|
||||
recommended,
|
||||
config = UnboundMethodConfig,
|
||||
version = "1.12.0",
|
||||
short_description = "This rule enforces that unbound methods are called with their expected scope.",
|
||||
|
||||
@@ -162,8 +162,16 @@ fn test_rule_enum_flags() {
|
||||
("eslint", "no-alert", RuleFlags::empty()),
|
||||
("eslint", "no-debugger", RuleFlags::IS_RECOMMENDED),
|
||||
("eslint", "eqeqeq", RuleFlags::HAS_CONFIG),
|
||||
("typescript", "no-unsafe-assignment", RuleFlags::IS_TSGOLINT_RULE),
|
||||
("typescript", "no-floating-promises", RuleFlags::IS_TSGOLINT_RULE | RuleFlags::HAS_CONFIG),
|
||||
(
|
||||
"typescript",
|
||||
"no-unsafe-assignment",
|
||||
RuleFlags::IS_TSGOLINT_RULE | RuleFlags::IS_RECOMMENDED,
|
||||
),
|
||||
(
|
||||
"typescript",
|
||||
"no-floating-promises",
|
||||
RuleFlags::IS_TSGOLINT_RULE | RuleFlags::HAS_CONFIG | RuleFlags::IS_RECOMMENDED,
|
||||
),
|
||||
];
|
||||
|
||||
for (plugin, name, expected) in cases {
|
||||
|
||||
Reference in new issue
Block a user