Skip to content

Latest commit

 

History

History
631 lines (368 loc) · 18.5 KB

rules.md

File metadata and controls

631 lines (368 loc) · 18.5 KB
  • ✅ = Implemented in Oxc
  • ➕ = Can be implemented without simple_ts, but not implemented yet
  • ✨ = Will be implementable with simple_ts
  • ❌ = Can't be implemented with simple_ts

Already Implemented in Oxc

  • adjacent-overload-signatures
  • array-type
  • ban-tslint-comment
  • ban-ts-comment
  • ban-types
  • consistent-generic-constructors
  • consistent-indexed-object-style
  • consistent-type-definitions
  • consistent-type-imports
  • explicit-function-return-type
  • no-confusing-non-null-assertion
  • no-duplicate-enum-values
  • no-dynamic-delete
  • no-empty-interface
  • no-empty-object-type
  • no-explicit-any
  • no-extraneous-class
  • no-extra-non-null-assertion
  • no-import-type-side-effects
  • no-inferrable-types
  • no-misused-new
  • no-namespace
  • no-non-null-asserted-nullish-coalescing
  • no-non-null-asserted-optional-chain
  • no-non-null-assertion
  • no-require-imports
  • no-this-alias
  • no-unnecessary-type-constraint
  • no-unsafe-declaration-merging
  • no-unsafe-function-type
  • no-useless-empty-export
  • no-var-requires
  • no-wrapper-object-types
  • prefer-as-const
  • prefer-enum-initializers
  • prefer-for-of
  • prefer-function-type
  • prefer-literal-enum-member
  • prefer-namespace-keyword
  • prefer-ts-expect-error
  • triple-slash-reference

typescript-eslint's strict-type-checked-only rule set

https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict-type-checked-only.ts


https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/stylistic-type-checked-only.ts


Require that function overload signatures be consecutive ✅

Require consistently using either T[] or Array for arrays ✅

Disallow awaiting a value that is not a Thenable ✨

Disallow @ts- comments or require descriptions after directives ✅

Disallow // tslint: comments ✅

Enforce that literals on classes are exposed in a consistent style

Enforce that class methods utilize this

Enforce specifying generic type arguments on type annotation or constructor name of a constructor call ✅

Require or disallow the Record type ✅

Require return statements to either always or never specify values

Enforce consistent usage of type assertions

Enforce type definitions to consistently use either interface or type

Enforce consistent usage of type exports

Enforce consistent usage of type imports

Enforce default parameters to be last

Enforce dot notation whenever possible

Require explicit return types on functions and class methods

Require explicit accessibility modifiers on class properties and methods

Require explicit return and argument types on exported functions' and classes' public class methods

Require or disallow initialization in variable declarations

Enforce a maximum number of parameters in function definitions

Require a consistent member declaration order

Enforce using a particular method signature syntax

Enforce naming conventions for everything across a codebase

Disallow generic Array constructors ➕

Disallow using the delete operator on array values ✨

Require .toString() and .toLocaleString() to only be called on objects which provide useful information when stringified

Disallow non-null assertion in locations that may be confusing

Require expressions of type void to appear in statement position

Disallow using code marked as @deprecated

Disallow duplicate class members

Disallow duplicate enum member values

Disallow duplicate constituents of union or intersection types

Disallow using the delete operator on computed key expressions ✨

Disallow empty functions

Disallow the declaration of empty interfaces

Disallow accidentally using the "empty object" type

Disallow the any type

Disallow extra non-null assertions

Disallow classes used as namespaces

Require Promise-like statements to be handled appropriately

Disallow iterating over an array with a for-in loop

Disallow the use of eval()-like methods

Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers

Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean

Disallow this keywords outside of classes or class-like objects

Disallow void type outside of generic or return types

Disallow function declarations that contain unsafe references inside loop statements

Disallow literal numbers that lose precision

Disallow magic numbers

Disallow the void operator except when used to discard a value

Enforce valid definition of new and constructor

Disallow Promises in places not designed to handle them

Disallow enums from having both number and string members

Disallow TypeScript namespaces

Disallow non-null assertions in the left operand of a nullish coalescing operator

Disallow non-null assertions after an optional chain expression

Disallow non-null assertions using the ! postfix operator

Disallow variable redeclaration

Disallow members of unions and intersections that do nothing or override type information

Disallow invocation of require()

Disallow specified modules when loaded by import

Disallow certain types

Disallow variable declarations from shadowing variables declared in the outer scope

Disallow aliasing this

Disallow type aliases

Disallow unnecessary equality comparisons against boolean literals

Disallow conditionals where the type is always truthy or always falsy

Disallow unnecessary assignment of constructor property parameter

Disallow unnecessary namespace qualifiers

Disallow unnecessary template expressions

Disallow type arguments that are equal to the default

Disallow type assertions that do not change the type of an expression

Disallow unnecessary constraints on generic types

Disallow type parameters that aren't used multiple times

Disallow calling a function with a value with type any

Disallow assigning a value with type any to variables and properties

Disallow calling a value with type any

Disallow unsafe declaration merging

Disallow comparing an enum value with a non-enum value

Disallow using the unsafe built-in Function type

Disallow member access on a value with type any

Disallow returning a value with type any from a function

Disallow type assertions that narrow a type

Require unary negation to take a number

Disallow unused expressions

Disallow unused variables

Disallow the use of variables before they are defined

Disallow unnecessary constructors

Disallow empty exports that don't change anything in a module file

Disallow require statements except in import statements

Disallow using confusing built-in primitive class wrappers

Enforce non-null assertions over explicit type assertions

Disallow throwing non-Error values as exceptions

Require or disallow parameter properties in class constructors

Enforce the use of as const over literal type

Require destructuring from arrays and/or objects

Require each enum member value to be explicitly initialized

Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0] when looking for a single result

Enforce the use of for-of loop over the standard for loop where possible

Enforce using function types instead of interfaces with call signatures

Enforce includes method over indexOf method

Require all enum members to be literal values

Require using namespace keyword over module keyword to declare custom TypeScript modules

Enforce using the nullish coalescing operator instead of logical assignments or chaining

Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects

Require using Error objects as Promise rejection reasons

Require private members to be marked as readonly if they're never modified outside of the constructor

Require function parameters to be typed as readonly to prevent accidental mutation of inputs

Enforce using type parameter when calling Array#reduce instead of using a type assertion

Enforce RegExp#exec over String#match if no global flag is provided

Enforce that this is used when only this type is returned

Enforce using String#startsWith and String#endsWith over other equivalent methods of checking substrings

Enforce using @ts-expect-error over @ts-ignore

Require any function or method that returns a Promise to be marked async

Enforce that get() types should be assignable to their equivalent set() type

Require Array#sort and Array#toSorted calls to always provide a compareFunction

Disallow async functions which do not return promises and have no await expression

Require both operands of addition to be the same type and be bigint, number, or string

Enforce template literal expressions to be of string type

Enforce consistent awaiting of returned promises

Enforce constituents of a type union/intersection to be sorted alphabetically

Disallow certain types in boolean expressions

Require switch-case statements to be exhaustive

Disallow certain triple slash directives in favor of ES6-style import declarations

Require type annotations in certain places

Enforce unbound methods are called with their expected scope

Disallow two overloads that could be unified into one with a union or an optional/rest parameter

Enforce typing arguments in Promise rejection callbacks as unknown