npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ttsc/lint

v0.13.1

Published

Reference ttsc plugin: ESLint-style lint rules hosted in the same Program/Checker as the type-check pass.

Readme

@ttsc/lint

banner of @ttsc/lint

GitHub license NPM Version NPM Downloads Build Status Guide Documents Discord Badge

A linter and formatter. Co-protagonist of the ttsc toolchain — paired with ttsc, it replaces eslint and prettier.

140+ rules. Lint violations surface as error TSxxxxx from a single compile pass; the formatter applies via ttsc format.

Demonstration

Given this file:

// src/index.ts
var x: number = 3;
let y: number = 4;
const z: string = 5;

console.log(x + y + z);

Run ttsc with @ttsc/lint enabled (see Setup):

$ pnpm ttsc
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;
  ~~~~~~~~~~~~~~~~~~

Found 3 errors in the same file, starting at: src/index.ts:3

Type errors (TS2322) and lint violations (TS17397, TS11966) come out together. No second tool, no second CI step.

Setup

npm install -D ttsc @ttsc/lint @typescript/native-preview

Drop a lint.config.ts next to your tsconfig.json:

// lint.config.ts
import type { ITtscLintConfig } from "@ttsc/lint";

export default {
  format: {
    printWidth: 100,
    singleQuote: true,
    trailingComma: "all",
  },
  rules: {
    "no-var": "error",
    "prefer-const": "error",
    "no-explicit-any": "warning",
    "no-console": "off",
  },
} satisfies ITtscLintConfig;

Run your normal ttsc or ttsx:

npx ttsc
npx ttsx src/index.ts

Errors fail the command; warnings print without affecting the exit code. Under ttsx, errors stop the program before your entrypoint runs.

Fix and format

ttsc fix applies every autofix the enabled rules offer — lint and format together — writes results back to disk, then re-runs type-check + lint. ttsc format runs the format/* subset through the same dataflow.

npx ttsc fix
npx ttsc format

ttsc fix is a one-shot project pass and rejects --watch, single-file mode, and --emit. Fixes are written to disk before the recheck runs, so source stays modified even when the command exits non-zero on remaining errors. Recommended flow: run ttsc fix locally, commit, then have CI run ttsc --noEmit to gate on zero remaining errors.

Configurations

Two top-level keys in lint.config.ts:

  • format is a Prettier-style block that drives the format/* autofixes. Format diagnostics are warnings and do not define compile failure policy.
  • rules sets severity per lint rule. "error" fails the build; "warning" prints without affecting the exit code; "off" disables the rule.

Format

The format block in lint.config.ts configures the formatter. Keys mirror .prettierrc:

// lint.config.ts
export default {
  format: {
    printWidth: 100,
    singleQuote: true,
    trailingComma: "all",
    importOrder: ["<THIRD_PARTY_MODULES>", "@api(.*)$", "^[./]"],
    jsdoc: true,
  },
  rules: { "no-var": "error" },
} satisfies ITtscLintConfig;

Presence of the block (even empty format: {}) configures the always-on format rules at Prettier defaults for ttsc format. It does not make ttsc check fail on formatting by default; set format.severity only if you intentionally want check-time format diagnostics.

Each format key drives one rule:

| Rule | Driven by | Effect | | --- | --- | --- | | all format rules | severity (default "off") | Optional check-time diagnostic severity. ttsc format still applies configured format rules when this is off. | | format/semi | semi | Insert trailing semicolons on ASI-terminated statements. | | format/quotes | singleQuote | Convert quoted strings to the preferred quote style. | | format/trailing-comma | trailingComma | Add trailing commas to multi-line lists. | | format/print-width | printWidth, tabWidth, useTabs, endOfLine | Column-aware line reflow. Object/array literals, call/new arguments, and named import/export clauses break across lines when their flat form overflows the budget. | | format/sort-imports | importOrder (opt-in) | Group external/relative imports and alphabetize each group + its specifiers. | | format/jsdoc | jsdoc (opt-in) | Normalize JSDoc blocks toward prettier-plugin-jsdoc. |

format/sort-imports and format/jsdoc are opt-in: they only run when you set their format keys. Every other format rule is available to ttsc format as soon as a format block is present.

To disable or override one specific format rule, drop a sibling rules entry — rules wins on conflict:

export default {
  format: { severity: "warning", semi: true },
  rules: { "format/semi": "off" },
} satisfies ITtscLintConfig;

Rules

Rules are off until you enable them:

// lint.config.ts
export default {
  rules: {
    "no-var": "error",
    "eqeqeq": "error",
    "prefer-template": "warning",
    "no-non-null-assertion": "off",
  },
} satisfies ITtscLintConfig;

The rule corpus is tested in tests/test-lint/src/cases/*.ts, which is the best place to check the exact patterns currently covered. Each rule below links to its tested fixture:

Third-party rule plugins

Other npm packages can ship lint rules that compile into the same @ttsc/lint binary and report through the same diagnostic stream as built-ins. Declare them in lint.config.ts:

// lint.config.ts
import demoPlugin from "ttsc-lint-plugin-demo";
import type { ITtscLintConfig } from "@ttsc/lint";

export default {
  plugins: { demo: demoPlugin },
  rules: { "demo/no-todo-comment": "error" },
} satisfies ITtscLintConfig;

ttsc copies each declared contributor's Go source into a sub-package of @ttsc/lint's module at build time, so the resulting binary has both built-in and contributor rules registered before main. Authoring instructions and the public Go API live in the @ttsc/lint walkthrough → How a contributor package ships.

Contributor rules emit autofixes the same way built-ins do — call ctx.ReportFix(node, message, edits...) or ctx.ReportRangeFix(pos, end, message, edits...). The rule/astutil package re-exports the byte-range helpers built-ins use (NodeText, KeywordStart, FindKeyword, TokenRange). See the contributor autofix path section for the full contract and an example.

Sponsors

Sponsors

Thanks for your support.

Your donation encourages ttsc development.