Lint Setup
Two steps. Five minutes.
1. Install
npm install -D ttsc @ttsc/lint typescript@rc2. Write lint.config.ts
Drop a lint.config.ts next to tsconfig.json:
// lint.config.ts
import type { ITtscLintConfig } from "@ttsc/lint";
export default {
rules: {
"no-var": "error",
"prefer-const": "error",
"eqeqeq": "error",
"typescript/no-explicit-any": "warning",
},
format: {
printWidth: 100,
singleQuote: true,
trailingComma: "all",
},
} satisfies ITtscLintConfig;"error" fails the build. "warning" prints. "off" disables the rule.
The format block configures the formatter, keys mirror .prettierrc. Presence of the block (even empty format: {}) enables ttsc format at Prettier defaults. It does not make ttsc check fail on formatting unless you set format.severity.
A lint.config.{ts,js,mjs} file is evaluated once and the result is cached, keyed by the fileβs contents, so a monorepo build that runs ttsc once per package does not re-evaluate the config each time. Editing the config invalidates the cache automatically. The one case it does not cover is a config that imports a separate file: change that imported file without touching the config itself, and set TTSC_LINT_DISABLE_CONFIG_CACHE=1 to force a fresh evaluation.
By default @ttsc/lint discovers lint.config.{ts,cts,mts,js,cjs,mjs,json} by walking upward from the tsconfig directory. To override that discovery with an explicit path, pass configFile on the plugin entry in tsconfig.json:
// tsconfig.json
{
"compilerOptions": {
"plugins": [
{ "name": "@ttsc/lint", "configFile": "./tools/lint.config.ts" }
]
}
}configFile is the only host-owned key beyond name, enabled, stage, and transform, every other configuration lives inside the resolved lint.config.*.
See it
// src/index.ts
var x: number = 3;
let y: number = 4;
const z: string = 5;
console.log(x + y + z);$ npx ttsc --noEmit
src/index.ts:3:7 - error TS2322: Type 'number' is not assignable to type 'string'.
3 const z: string = 5;
~
src/index.ts:2:5 - error TS17397: [prefer-const] Use const instead of let.
2 let y: number = 4;
~~~~~~~~~~~~~
src/index.ts:1:1 - error TS11966: [no-var] Unexpected var, use let or const instead.
1 var x: number = 3;
~~~~~~~~~~~~~~~~~~Type errors (TS2322) and lint violations (TS17397, TS11966) come out in the same stream. Your CI step that already runs ttsc now gates lint too.
Next
β Format, the format block keys and the rules they drive. β Rules, the lint rule catalog.