This documentation outlines the step-by-step process for implementing Oxlint in a JavaScript/TypeScript monorepo project, based on the implementation in the dictyBase frontendx repository.
-
Create the package directory structure:
packages/oxlint-config/ ├── package.json ├── README.md └── src/ └── index.ts -
Set up package.json:
{ "name": "@dictybase/oxlint-config", "version": "0.0.0", "description": "Oxlint configuration", "main": "./src/index.ts", "author": "Kevin Tun", "license": "BSD-2-Clause", "devDependencies": { "oxlint": "^1.6.0" } }
- Create
.oxlintrc.jsonin the config package:{ "$schema": "../../node_modules/oxlint/configuration_schema.json", "plugins": [ "typescript", "unicorn", "react", "react-perf", "next-js", "oxc", "import", "js-doc", "jsx-a11y", "promise", "vitest", "jest" ], "categories": { "correctness": "error", "perf": "error", "suspicious": "error" }, "rules": { "react-in-jsx-scope": "off" } }
-
Add the configuration package as a dependency:
{ "dependencies": { "@dictybase/oxlint-config": "*" } } -
Add oxlint script to package.json:
{ "scripts": { "oxlint": "oxlint src/" } }
Objective: Ensure all packages and applications in the monorepo have access to the shared oxlint configuration.
- Add dependency to all apps and packages:
Add
@dictybase/oxlint-configas a devDependency to every package.json file in the monorepo:{ "devDependencies": { "@dictybase/oxlint-config": "*" } }
Objective: Provide consistent oxlint commands across all packages and applications.
-
Add standard oxlint scripts: For each package.json file, add these scripts to the "scripts" section:
{ "scripts": { "oxlint": "oxlint src/", "oxlint:out": "oxlint src/ --format=github" } }The
oxlint:outscript provides GitHub-formatted output for CI/CD integration
Objective: Ensure all projects can properly extend the shared configuration.
- Update .oxlintrc.json extends path:
For applications, update the extends path to correctly reference the shared config:
{ "extends": ["../../packages/oxlint-config/.oxlintrc.json"] }
# Run oxlint on a specific project
yarn workspace @dictybase/ui-common oxlintRun oxlint across all projects:
# Using Yarn workspaces (example - adjust based on your package manager)
yarn workspaces foreach run oxlintproject-root/
├── packages/
│ ├── oxlint-config/
│ │ ├── .oxlintrc.json # Base configuration
│ │ ├── package.json # Config package definition
│ │ └── README.md # Documentation
│ ├── ui-common/
│ │ ├── .oxlintrc.json # (Optional) Package-specific config
│ │ └── package.json # Includes oxlint scripts + dependency
│ └── auth/
│ ├── .oxlintrc.json # (Optional) Package-specific config
│ └── package.json # Includes oxlint scripts + dependency
├── apps/
│ ├── dicty-frontpage/
│ │ ├── .oxlintrc.json # Extends base config
│ │ └── package.json # Includes oxlint scripts + dependency
│ └── stock-center/
│ ├── .oxlintrc.json # Extends base config
│ └── package.json # Includes oxlint scripts + dependency
└── OXLINT_IMPLEMENTATION.md # This documentation
After completing all steps, verify the integration by:
-
Test oxlint runs successfully:
cd apps/dicty-frontpage npm run oxlint -
Check configuration inheritance: Ensure applications properly extend the shared configuration
-
Verify GitHub formatting:
npm run oxlint:out
-
Run across multiple projects: Test that oxlint works consistently across different apps and packages
This comprehensive integration ensures that oxlint is available and consistently configured across the entire monorepo, providing fast linting capabilities alongside the existing ESLint infrastructure.