| name | ts-npm-oxlint-setup |
| description | Set up Oxlint in a TypeScript project. |
TS + npm Oxlint Setup
Use this when a project uses TypeScript + npm and you want a fast lint baseline.
Expected Outcome
oxlint exists in devDependencies
scripts contains lint, lint:strict, check:file
.oxlintrc.json exists with baseline categories/rules/ignore patterns
Setup
npm add -D oxlint
package.json scripts
{
"scripts": {
"lint": "oxlint --silent",
"lint:strict": "oxlint --deny-warnings",
"check:file": "oxlint"
}
}
- If
scripts.lint already exists, replace it with oxlint --silent.
- Keep non-lint scripts (for example
test, dev, build) unchanged.
- Add missing
lint:strict and check:file without deleting other scripts.
.oxlintrc.json
{
"plugins": ["promise", "import", "node"],
"categories": {
"correctness": "error",
"suspicious": "warn"
},
"rules": {
"no-console": "warn",
"typescript/no-explicit-any": "error"
},
"ignorePatterns": ["node_modules", "dist", "build", "coverage", "*.min.js"]
}
- If
.oxlintrc.json does not exist, create it from the baseline above.
- If it already exists, merge with this rule:
- Keep existing project values on conflicts.
- Add only missing keys/items from the baseline.
- For arrays (
plugins, ignorePatterns), keep existing order and append only missing baseline items (no duplicates).
- Never delete existing project-specific rules.
Verification
Run required check:
npm run lint
npm run lint should pass (exit code 0) before considering setup complete.
- Optional strict check (recommended):
npm run lint:strict
npm run lint:strict may fail if warnings exist (--deny-warnings behavior). That is expected and does not mean setup failed.
check:file must be exactly oxlint.
npm run check:file runs a full-project lint.
npm run check:file -- src/example.ts runs lint for the provided path only.