Skip to main content

12 docs tagged with "code style"

View all tags

No Assign Then Return

Disallow assigning to a const variable and immediately returning it when the expression can be returned directly.

No Bracket Assignment

Disallow bracket notation assignment and encourage Reflect.set for dynamic property writes on objects.

No Catch Unknown Annotation

Disallow redundant unknown type annotations on catch clause variables because TypeScript defaults them to unknown.

No Destructuring

Disallow destructuring patterns in callbacks, for-of loops, function parameters, variable declarations, and assignment expressions.

No Implicit Boolean

Require explicit boolean comparisons instead of relying on truthy/falsy coercion in conditions.

No Inline Type Annotation

Disallow inline type annotations in code files and require named type aliases from definition files instead.

No Regex Literal Flags

Disallow flags on regex literals so shared patterns stay reusable and callers add flags at the call site via new RegExp.

No Regex Literals

Disallow inline regex literal expressions so patterns are centralized in a shared patterns file and reusable across the codebase.

No Shared Type Import

Disallow importing shared type files in code files to enforce type layering where shared types flow through domain type files.

No Ternary in Template Literal

Disallow ternary expressions inside template literals to keep template strings readable and encourage extracting logic into variables.

Require Padding Lines

Require blank lines between specific statement patterns for improved readability such as exit code before return and before loops.

Switch Case Blocks

Require every non-empty switch case to wrap its body in a block so declarations stay scoped and branches stay independent.