Linting and Code Formatting in open-seo: A Complete Tooling Guide
The open-seo repository uses oxlint for fast, type-aware linting and Prettier for code formatting, orchestrated through npm scripts defined in package.json.
Maintaining consistent code quality in a JavaScript/TypeScript codebase requires automated tooling. The open-seo project (available at every-app/open-seo) implements a strict linting and code formatting pipeline that catches errors early and enforces uniform style across all contributions.
Linting with oxlint
The project employs oxlint as its primary linter. This Rust-based tool performs static analysis on JavaScript and TypeScript files with minimal configuration overhead.
Configuration
All linting rules are centralized in [.oxlintrc.json](https://github.com/every-app/open-seo/blob/main/.oxlintrc.json) at the repository root. The configuration enables several plugins:
- TypeScript support for type-aware rules
- Import plugin to validate ES Module imports
- React specific linting rules
- Unicorn plugin for additional code quality rules
- OXC internal plugin optimizations
The configuration treats "correctness" and "suspicious" categories as hard errors, preventing commits that contain obvious bugs or anti-patterns.
Running the Linter
Execute the following commands from the repository root:
# Check for lint errors (exits with error code if issues found)
npm run lint
# Automatically fix fixable issues where possible
npm run lint:fix
Under the hood, npm run lint invokes oxlint . --type-aware, while npm run lint:fix appends the --fix flag to auto-correct violations.
Code Formatting with Prettier
For code formatting, open-seo relies on Prettier with its opinionated defaults. Unlike many projects that override formatting preferences, this repository does not commit a dedicated .prettierrc file, allowing Prettier to use its standard settings.
Format Commands
The package.json defines two distinct formatting scripts:
# Verify formatting without making changes (used in CI)
npm run format:check
# Apply formatting fixes to the entire codebase
npm run format:write
These map to prettier --check . and prettier . --write respectively, targeting all supported files in the repository.
CI Integration and Quality Gates
The repository enforces code quality through a unified CI script. The ci:check command defined in package.json runs the complete validation suite:
{
"scripts": {
"ci:check": "prettier --check . && knip && tsc --noEmit && oxlint . --type-aware"
}
}
This pipeline executes four sequential checks:
- Prettier validation to ensure consistent formatting
- Knip for dead-code and unused dependency detection
- TypeScript compiler (
tsc --noEmit) for static type checking - oxlint with type-aware analysis for final lint verification
Any failure in this chain blocks the commit from passing continuous integration.
How to Run the Tools Locally
Before submitting changes, verify your code against the quality standards:
# Full validation (mirrors CI)
npm run ci:check
# Run individual tools as needed
npm run lint # Check for lint errors only
npm run lint:fix # Fix auto-resolvable lint issues
npm run format:write # Format all files
For incremental checks during development, you can run oxlint directly on specific directories:
npx oxlint ./src --type-aware
Summary
- Linting Tool: oxlint provides fast, type-aware analysis configured via
.oxlintrc.jsonwith plugins for TypeScript, React, and Unicorn rules. - Formatting Tool: Prettier enforces consistent style using default settings without a custom configuration file.
- Scripts:
npm run lintandnpm run lint:fixhandle linting;npm run format:checkandnpm run format:writehandle formatting. - CI Pipeline: The
ci:checkscript combines Prettier, Knip, TypeScript, and oxlint to gate every commit.
Frequently Asked Questions
What linter does open-seo use?
The project uses oxlint, a Rust-based linter designed for high performance on JavaScript and TypeScript codebases. It is configured to be type-aware and includes plugins for React, import validation, and additional correctness checks via the Unicorn plugin set.
How do I automatically fix linting errors in open-seo?
Run npm run lint:fix from the project root. This executes oxlint . --type-aware --fix, which attempts to automatically resolve fixable issues such as missing imports or stylistic violations that do not require manual intervention.
Does open-seo have a custom Prettier configuration file?
No, the repository does not include a .prettierrc file. Prettier runs with its default opinionated settings. If the maintainers later decide to customize formatting rules, they can add a .prettierrc to the repository root, and the existing npm run format commands will automatically pick it up.
What checks run during continuous integration?
The ci:check script runs four distinct validations: Prettier formatting verification, Knip dead-code analysis, TypeScript compilation with tsc --noEmit (type checking only), and oxlint type-aware linting. All four must pass for a build to succeed.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →