configs-new-rule
Add or change a lint rule in @joinery/configs — one `lib/` file per concern composed by `node.ts`/`vue.ts`, an in-house `joinery/*` rule with its RuleTester spec when it needs code or AST selectors, a
SKILL.md.claude/skills/configs-new-rule/SKILL.md
GitHubAdding a lint rule
lib/README.md says what earns a file and
maps every file to its concern. This file covers what that map can't enforce.
requireRouteMeta.ts, its spec
and lib/routeMeta.ts are the smallest
complete in-house rule.
Before removing or relaxing a rule, check the developer portal's Telemetry page: how often it fired and how often it is disabled inline. Those hits come from agent edits only, never the user's, so a rule that never fired there may still be catching the user's mistakes. Treat it as a question to ask them, not a reason to remove the rule.
Pick the place
- A plugin preset taken as shipped is a const in
lib/index.ts, no file of its own. - A rule entry with a glob or options gets its own
lib/<concern>.ts, added tosharedinlib/index.ts. A config that names**/*.vuegoes invueOnlyinstead, as anxVueexport besidex, because a.vueglob in the node factory makes ESLint parse.vuefiles without the Vue parser. - A rule for one flavour goes inline in that factory, not in
lib/. - Code or an AST selector makes it an in-house rule:
- Write
rules/<camelName>.tsand register it as<kebab-name>inrules/index.ts. - Switch it on from its
lib/file asjoinery/<kebab-name>, withplugins: { joinery }imported from../rules/index.ts. - A list of selectors uses
selectorRule(), onemessageIdper selector.
- Write
- Only some projects want it makes it an opt-in export, like
routeMetaortailwind, which a project appends after its factory. Ask the user first: it splits how projects lint.
The three things that go wrong
- A second plugin object.
plugins: { joinery: { rules: { … } } }anywhere butrules/index.tscrashes ESLint on any file both objects reach. - A second config setting a core rule with options.
no-restricted-importsandno-restricted-syntaxreplace each other's options on a file both configs reach instead of merging. Keep the globs disjoint and pin it inindex.spec.ts, or make it ajoinery/*rule. - A message that describes instead of instructing. Write the code to type instead: "Move this
call into a
computed", "Name a lookup table in UPPER_SNAKE_CASE". An agent acts on the message text and on nothing else.
Test it
- An in-house rule gets
<name>.spec.tsbeside it, using ESLint'sRuleTester. Assign Vitest'sdescribe,itandit.onlytoRuleTester.describe,RuleTester.itandRuleTester.itOnly, as every spec there does, because globals are off. Cover eachmessageId, at least one valid case per exemption, and passvue-eslint-parserfor.vueinput. - A scoping change gets a case in
index.spec.ts. It resolves the config for a path withcalculateConfigForFileand never parses, so the type-checked flavours work there too.
Finish
- Add a row to
lib/README.md, saying what the rule enforces and why, not the selector. An opt-in export also gets a row in the package README's opt-in table. - Run
pnpm checkwith a long timeout and fix what the rule finds across the workspace. A configs change makes every project affected.