IF Commons GitHub

Lint

Quality: 9 tests: 1 passed, 0 failed, 8 skipped, 1 of 10 requirements proved, 0 open issues, 0 open tickets. The tests and issues of the library

IFC TypeScript's lint plugin in the ESLint plugin format (commons lint 0001-lint FR-001), named ifc, which bun lint loads from this file as it is (TypeScript, no build): bun lint --plugin=<path to lint/plugin.ts> --rule '{"ifc/no-vendor-api": ["error", {...}]}' for one run, or in bunfig.toml:

[lint]
plugins = ["./lint/plugin.ts"] # relative to bunfig.toml

[lint.rules]
"ifc/no-vendor-api" = ["error", { allow = [{ files = "src/host/**", reason = "the one module that wraps the vendor's API" }] }]
"ifc/terminal-writers" = ["error", { allow = [{ files = "src/console.ts", reason = "the renderer, the one writer for a person" }] }]

The rules every harness wants, each taking its lists from its options so that a harness keeps its own lists and adds its own rules (as its own plugin, with defineRule of ./rule.ts):

  • no-vendor-api: no member of a vendor's global (Bun.* and the like) outside the files listed with their reasons;
  • no-registry-import: no npm:, jsr: or URL specifier;
  • import-boundary: a relative import that leaves its package (the option roots) is refused;
  • module-doc: every file begins with a JSDoc block that says @module;
  • switch-absurd: a switch on a union's kind ends in default calling absurd;
  • terminal-writers: no write to the terminal outside the files listed with their reasons.

Spec: 0001-lint FR-001

Entry points

Modules

Titles, headings, exports, tables, columns and requirements. Esc closes.