Location>code7788 >text

Hongmeng high-quality code static detection of 200 articles II

Popularity:897 ℃/2024-11-12 19:11:37
  1. @typescript-eslint/no-unnecessary-type-arguments
  • When the type parameter and the default value are the same, the explicit use of the
  1. @typescript-eslint/no-unnecessary-type-assertion
  • Disable unnecessary type assertions
  1. @typescript-eslint/no-unnecessary-type-constraint
  • Do not allow unnecessary constraints in generalizations
  1. @typescript-eslint/no-unused-expressions
  • Prohibit the inclusion of unused expressions in the code
  1. @typescript-eslint/no-unused-vars
  • Prohibit the definition of unused variables
  1. @typescript-eslint/no-useless-constructor
  • Disable unnecessary constructors
  1. @typescript-eslint/prefer-enum-initializers
  • Recommended to explicitly initialize each enumeration member value
  1. @typescript-eslint/prefer-for-of
  • Force the use of "for-of" loops instead of standard "for" loops.
  1. @typescript-eslint/prefer-function-type
  • Force the use of function types instead of signed object types
  1. @typescript-eslint/prefer-includes
  • Force the use of the "includes" method instead of the "indexOf" method.
  1. @typescript-eslint/prefer-nullish-coalescing
  • Force the use of the null merge operator (???) instead of the logical operator
  1. @typescript-eslint/prefer-optional-chain
  • Force the use of chained optional expressions instead of chained logical with, negative logical or, or null objects
  1. @typescript-eslint/prefer-readonly
  • If a private member is never modified outside of the constructor, it is required to be marked as "read-only".
  1. @typescript-eslint/prefer-readonly-parameter-types
  • Requires function parameters to be resolved to "read-only" types to prevent them from being modified, which can have some side effects.
  1. @typescript-eslint/prefer-reduce-type-parameter
  • When calling "Array#reduce", it is recommended to use a type parameter instead of a forced type conversion.
  1. @typescript-eslint/prefer-regexp-exec
  • If global flags are not provided, it is recommended to use RegExp#exec" instead of "String#match"
  1. @typescript-eslint/prefer-string-starts-ends-with
  • Forces the use of "String#startsWith" and "String#endsWith" instead of other equivalent methods of checking substrings
  1. @typescript-eslint/promise-function-async
  • Require any function or method that returns a Promise to be marked as async
  1. @typescript-eslint/quotes
  • Forcing consistent backquote, double quote, or single quote styles
  1. @typescript-eslint/require-array-sort-compare
  • Require "compareFunction" to always be provided when calling "Array#sort".
  1. @typescript-eslint/require-await
  • Asynchronous functions must contain "await".
  1. @typescript-eslint/restrict-plus-operands
  • Requires that both operands of the addition are of the same type and are either "bigint", "number" or "string".
  1. @typescript-eslint/restrict-template-expressions
  • Require variables in template expressions to be of type "string".
  1. @typescript-eslint/return-await
  • Require asynchronous functions to return "await".
  1. @typescript-eslint/semi
  • Requires or disallows the use of semicolons, e.g. never disallows semicolons, always allows semicolons
"@typescript-eslint/semi": [
  "error",
  "never"
]
  1. @typescript-eslint/space-before-function-paren
  • Forces consistent space style between function names and parentheses
  1. @typescript-eslint/space-infix-ops
  • Requires spaces before and after operators
  1. @typescript-eslint/strict-boolean-expressions
  • Disallowing non-Boolean types in Boolean expressions
  1. @typescript-eslint/switch-exhaustiveness-check
  • Requires switch statements to be exhaustive with respect to values in union types
  1. @typescript-eslint/triple-slash-reference
  • Certain three-slash references are not allowed, ES6-style import declarations are recommended
  1. @typescript-eslint/type-annotation-spacing
  • Type annotations need consistent space styles before and after them
  1. @typescript-eslint/typedef
  • Type annotations are required in some locations
  1. @typescript-eslint/unbound-method
  • Forcing methods in class scopes to be called in the expected scope
  1. @typescript-eslint/unified-signatures
  • If two overloaded functions can be used with joint type parameters (|), optional parameters (?) or residual arguments (...) to reassemble a function, it is not allowed to use the overloaded
  1. prefer-const
  • It is recommended that variables with unmodified values after declaration be declared with the const keyword
  1. eqeqeq
  • Requirement to use =And!
  1. @security/no-commented-code
  • Segments that are not used are recommended to be deleted directly and are not allowed to be retained by way of commenting.
  1. @security/no-cycle
  • Prohibit the use of circular dependencies
  1. @security/no-unsafe-aes
  • This rule prohibits the use of insecure ECB encryption modes in the AES encryption algorithm, and recommends the use of the secure AES interface in the Petal Aegis SDK
  1. @security/no-unsafe-dh
  • This rule prohibits the use of insecure DH key negotiation algorithms
  1. @security/no-unsafe-dh-key
  • This rule prohibits the use of insecure DH keys
  1. @security/no-unsafe-dsa
  • This rule prohibits the use of insecure DSA signature algorithms
  1. @security/no-unsafe-dsa-key
  • This rule prohibits the use of insecure DSA keys
  1. @security/no-unsafe-ecdsa
  • This rule prohibits the use of insecure SHA1 digest algorithms in ECDSA signature algorithms, and recommends the use of the secure ECDSA interface in the Petal Aegis SDK
  1. @security/no-unsafe-hash
  • This rule uses a hash algorithm that prohibits insecure hashing
  1. @security/no-unsafe-mac
  • This rule prohibits the use of insecure hash algorithms in MAC message authentication algorithms
  1. @security/no-unsafe-rsa-encrypt
  • This rule prohibits the use of insecure RSA asymmetric encryption algorithms
  1. @security/no-unsafe-rsa-key
  • This rule prohibits the use of insecure RSA keys
  1. @security/no-unsafe-rsa-sign
  • This rule prohibits insecure RSA signature algorithms
  1. @performance/high-frequency-log-check
  • Hilog is not recommended for use in high-frequency functions