IF Commons GitHub

plugin

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

Source: commons/lint/src/plugin.ts

0 of 1 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

defaultconstno test imports it
const default: Plugin

The plugin: ifc, the prefix of its rules' ids, and its rules.

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