| name | oxlint-rules |
| description | Portable guidance for oxlint rules. Use when work involves oxlint rules. |
The API (ESLint-compatible)
export const myRule = {
meta: {
type: 'problem',
docs: { description: '…' },
fixable: 'code',
messages: { id: 'Text with {{x}}.' },
schema: [],
},
create(context) {
return {
JSXOpeningElement(node) {
context.report({ node, messageId: 'id', data: { x: 'y' }, fix: fixer => fixer.replaceText(node, '…') })
},
}
},
}
Verified working in oxlint 1.63 (don't re-test these):
context.report({ node, messageId, data, fix }); context.options[0]; context.filename; context.sourceCode.getText(node).
- Fixers:
replaceText(node, str), insertTextBefore/After, remove, removeRange, replaceTextRange.
- AST is ESTree + TS + JSX:
TSAsExpression/TSEnumDeclaration/TSAnyKeyword, JSXOpeningElement/JSXAttribute/JSXIdentifier/JSXMemberExpression, ImportDeclaration (.source.value, .specifiers).
:exit selectors ('FunctionDeclaration:exit') and node.parent both work — use a frame stack for nesting rules.
Severity policy
| Use | When |
|---|
error | deterministic, rare, must-never-ship (e.g. no-only-tests) |
warn | new/broad rules — don't break the existing build; promote to error once clean |
off (shipped) | fuzzy/heuristic rules, documented for opt-in (e.g. verb-function-names) |
Autofix only when the rewrite is always safe (no-only-tests strips .only; tailwind-class-order stable-sorts). If removing/changing the code could mask a real error (e.g. no-as-any), report without a fix.