Files
gongxue-base/openspec/specs/oxlint-oxfmt-toolchain/spec.md

50 lines
2.3 KiB
Markdown

# oxlint-oxfmt-toolchain Specification
## Purpose
TBD - created by archiving change migrate-to-turborepo. Update Purpose after archive.
## Requirements
### Requirement: oxfmt replaces Prettier
The project SHALL use oxfmt for all code formatting, with a root `.oxfmtrc.json` configuration that replicates the existing Prettier conventions.
#### Scenario: Format check passes
- **WHEN** `npm run format` is executed at root
- **THEN** all TypeScript/JavaScript/JSON source files are formatted according to `.oxfmtrc.json` rules
#### Scenario: CI format gate
- **WHEN** `npm run format -- --check` is executed in CI
- **THEN** it exits with non-zero code if any file is not formatted correctly
### Requirement: Frontend oxlint replaces ESLint
The admin application (`apps/admin/`) SHALL use oxlint for linting, with a configuration that covers TypeScript and React rules equivalent to the existing ESLint setup.
#### Scenario: Admin lint passes
- **WHEN** `npm run lint` is executed at root
- **THEN** admin source files are linted with oxlint and pass without errors
#### Scenario: Rules-of-hooks violations detected
- **WHEN** a React hook is called conditionally in admin source
- **THEN** oxlint reports a rules-of-hooks violation
### Requirement: Backend retains ESLint
The server application (`apps/server/`) SHALL retain its existing ESLint configuration due to NestJS-specific rules that oxlint does not support.
#### Scenario: Server lint passes
- **WHEN** `npm run lint` is executed at root
- **THEN** server source files are linted with ESLint and pass without errors
#### Scenario: NestJS decorator checks work
- **WHEN** ESLint runs on server source
- **THEN** `@typescript-eslint/no-unsafe-*` rules and NestJS-specific patterns are enforced
### Requirement: Pre-existing Prettier/ESLint cleanup
All Prettier configuration files (`.prettierrc`, `eslint-plugin-prettier` references) SHALL be removed, and ESLint configurations SHALL be updated to remove Prettier integration.
#### Scenario: No Prettier remnants
- **WHEN** the migration is complete
- **THEN** `grep -r "prettier"` across config files returns no results (excluding oxfmt config which is separate)
#### Scenario: No Prettier dependencies
- **WHEN** `npm ls prettier eslint-plugin-prettier eslint-config-prettier` is run
- **THEN** no Prettier-related packages are installed in any workspace