Lint plugins

Lint plugins

warpkit's own conventions that a pattern in the code can show are Biome plugins, written in GritQL, in biome-plugins/. They run inside make lint and show in the editor, and unlike a grep they match the code's structure: a call split over lines, a comment, or a string that happens to contain the pattern do not fool them.

PluginFilesRule
error-codesallerr() takes an ERROR_CODES.* constant, never a raw string
barrel-pagessrc/features/*/index.tsa feature barrel does not export a page component
prefetch-baresrc/routes/**prefetchQuery / ensureQueryData take a queryOptions() factory
no-test-sleep*.test.ts(x)a test does not wait on real time
no-unreasoned-effectsrc/**every useEffect says what outside React it keeps in step

The files each plugin runs on are set in biome.jsonc (plugins, includes).

Writing one

  • The message is read by whoever broke the rule, often an agent: say what to do instead, not only what is wrong.
  • Add a case to biome-plugins/plugins.test.ts: one fixture that must be flagged and one that must not. The test lints the fixtures at their real paths, so the includes in biome.jsonc are tested too.
  • Add the .grit file to template-sync.json, so the other apps get it with make template.update.

A rule that reads across files, a comment, or the built app stays a make check-* script: GritQL sees one file's syntax and not its comments.

Keeping one exception

// biome-ignore lint/plugin/no-test-sleep: the timer is what this test is about

The name after lint/plugin/ is the plugin's file name. Always say why.