Skip to Content

Rules

ttsc is the standalone TypeScript-Go compiler โ€” see Setup if you havenโ€™t installed it yet.

The full catalog by category. Each rule maps to an ESLint name where one exists. Severity in lint.config.ts is one of "error" (fails the build), "warning" (prints, exit code 0), "off" (skipped).

If youโ€™re skimming: the error-severity defaults at the bottom of this page are what most projects end up with.

Authoritative source: the canonical rule-name union lives at packages/lint/src/structures/TtscLintRule.ts. This page documents what each rule does and when to keep it on.

Variable declarations

RuleEffect
no-varReject var. Use let or const. Autofixable.
prefer-constWhen a let is never reassigned, demand const. Autofixable for single declarations.

Equality and comparison

RuleEffect
eqeqeqReject == and !=. Autofixable when both operands are typed.
no-self-compareReject x === x and friends.
no-self-assignReject x = x, including destructured forms.

Suggestions

RuleEffect
no-explicit-anyReject any annotations. Typically "warning" during migrations.
prefer-as-constReject as Literal when as const would do. Autofixable.
object-shorthandReject { foo: foo }. Autofixable.
no-useless-renameReject { x: x } in destructuring. Autofixable.
no-extra-non-null-assertionReject x!!. Autofixable.
no-unnecessary-type-constraintReject <T extends unknown> and similar. Autofixable.
prefer-namespace-keywordUse namespace not module. Autofixable.

Strings and literals

RuleEffect
no-useless-escapeReject \. and friends when not required. Autofixable.
no-octalReject octal literals.
no-octal-escapeReject \08-style escapes.
no-template-curly-in-stringReject ${} inside non-template strings (probably a bug).

Wrapper objects and prototypes

RuleEffect
no-wrapper-object-typesReject String / Number / Boolean / Symbol / BigInt. Autofixable. Object stays detection-only.
no-protoReject obj.__proto__.
no-prototype-builtinsReject obj.hasOwnProperty(...); use Object.prototype.hasOwnProperty.call.

Loops

RuleEffect
no-constant-conditionReject while (true) and other constant test expressions.
for-directionfor (i = 0; i < 10; i--) โ†’ fail.
prefer-for-ofPrefer for..of when the index is unused.

Imports and exports

RuleEffect
no-import-type-side-effectsHoist inline type modifiers into a single import type {}. Autofixable.
consistent-type-importsPrefer import type {} when imports are types-only.
no-require-importsReject require(...) outside CommonJS modules.

Promises and async

RuleEffect
await-thenableReject await on non-thenable operands. Type-aware โ€” uses the Checker. Autofixable (drops the await).
no-async-promise-executorReject new Promise(async (...) => ...).
no-promise-executor-returnReject return inside a Promise executor.

Throw and control flow

RuleEffect
no-throw-literalthrow "boom" โ†’ fail. Use throw new Error(...).
no-fallthroughReject switch case fall-through without an explicit comment.
no-unsafe-finallyReject return / throw inside a finally.

Parameters

RuleEffect
default-param-last(req, opt = 1, req2) โ†’ fail.
no-dupe-argsFunction declared with two parameters of the same name.

Duplicates

RuleEffect
no-dupe-keys{ a: 1, a: 2 }.
no-duplicate-caseSame case label twice in a switch.
no-dupe-else-ifif (a) ... else if (a) ....

Miscellaneous

RuleEffect
no-debuggerReject debugger.
no-emptyReject if (x) {}, while (x) {}, etc.
no-empty-functionReject function f() {}.
no-withReject with (...).
no-multi-assignReject a = b = 0 chains.

Format

The format rules (format/*) cover Prettierโ€™s territory. They live on their own page โ€” Format rules.

A common starter set

Most projects start here. Add and remove as you go.

// lint.config.ts import type { TtscLintConfig } from "@ttsc/lint"; export default { rules: { // Variables "no-var": "error", "prefer-const": "error", // Comparison "eqeqeq": "error", "no-self-compare": "error", // Suggestions "no-explicit-any": "warning", "prefer-as-const": "error", "object-shorthand": "error", "no-useless-rename": "error", // Imports "no-import-type-side-effects": "error", "consistent-type-imports": "error", // Misc safety "no-debugger": "error", "no-throw-literal": "error", "await-thenable": "error", // Format (see /docs/lint/format) "format/semi": "error", "format/quotes": ["error", { prefer: "double" }], "format/trailing-comma": "error", "format/print-width": ["error", { printWidth: 80 }], }, } satisfies TtscLintConfig;

Autofix coverage at a glance

ttsc fix autofixes a subset. Native fixers cover:

  • no-var, single-declaration prefer-const, ESLint-safe eqeqeq
  • no-wrapper-object-types (primitives only; Object is detection-only)
  • prefer-as-const, no-useless-rename, object-shorthand, no-extra-non-null-assertion
  • no-unnecessary-type-constraint, prefer-namespace-keyword, no-useless-escape
  • no-import-type-side-effects (hoists inline type modifiers)
  • await-thenable (type-aware โ€” drops await on non-thenable operands)
  • Every format rule

With an eslint.config.* file and ESLint installed, ttsc fix delegates non-native fixers to ESLint, then reloads the program.

See also

Last updated on