Use this repo's local plugin as the baseline pattern for custom oxlint rules.
- Plugin:
tools/oxlint/local-plugin.js - Plugin config:
tools/oxlint/oxlint-rules.json - Root config:
.oxlintrc.json
- Create a JS module that default-exports a plugin object.
- Write rules with
createOnce(alternative API) instead ofcreate. - Keep rule metadata/rule names the same:
meta.namedefines the rule namespace.rulesmaps rule names to rule objects.
- Add plugin paths and rule toggles in
tools/oxlint/oxlint-rules.json. - Keep
.oxlintrc.jsonstable by extending that file. - Enable rules using
<plugin-name>/<rule-name>.
This repo standardizes on Oxlint's alternative API (createOnce) for custom
rules. We are not targeting ESLint usage for these local plugins, so we keep
plugins Oxlint-only and do not include ESLint-compat helpers.
.oxlintrc.json should only contain shared/base extends plus a single extend to
tools/oxlint/oxlint-rules.json. Add or change custom JS plugins and local rule
settings in tools/oxlint/oxlint-rules.json so new rules do not require
touching root config.
- Plugin name:
epicflare-custom - Rule id:
no-example-identifier - Config key:
epicflare-custom/no-example-identifier
The example rule reports when it finds the identifier
__oxlint_plugin_example__. This keeps the demo deterministic and avoids
accidentally linting normal production code.
Create a temporary file containing the sentinel identifier and run:
bun run lint -- ./tmp-oxlint-plugin-rule-test.jsYou should see a lint error from epicflare-custom/no-example-identifier.
Delete the temporary file after verification.