|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +This document summarizes how to work on rslint effectively and consistently. |
| 4 | + |
| 5 | +## Project Structure & Module Organization |
| 6 | + |
| 7 | +- `cmd/rslint/`: CLI entry (default), IPC API (`--api`), LSP (`--lsp`). |
| 8 | +- `internal/config/`: Config types/loader, rule registry and registration. |
| 9 | +- `internal/linter/`: Linter engine, traversal, and fix application. |
| 10 | +- `internal/rule/`: Rule framework, diagnostics, disable manager, listeners. |
| 11 | +- `internal/plugins/typescript/`: `@typescript-eslint` rules under `rules/<rule>/`. |
| 12 | +- `internal/plugins/import/`: `eslint-plugin-import` registration. |
| 13 | +- `internal/utils/`: JSONC, overlay VFS, TS program creation, helpers. |
| 14 | +- `internal/lsp/`: Language Server integration. Also see `website/` and `packages/` for UI/tooling. |
| 15 | + |
| 16 | +## Build, Test, and Development Commands |
| 17 | + |
| 18 | +- Build JS/TS: `pnpm build` |
| 19 | +- Run Go tests: `pnpm run test:go` |
| 20 | +- Run JS tests: `pnpm run test` |
| 21 | +- Run Check Spell: `pnpm run check-spell` |
| 22 | +- Lint Go: `pnpm run lint:go` | Format JS/TS/MD: `pnpm run format` |
| 23 | +- CLI: `go run ./cmd/rslint --help` |
| 24 | + - Examples: `go run ./cmd/rslint --config rslint.jsonc`, `--fix`, `--format default|jsonline|github`, `--quiet`, `--max-warnings 0` |
| 25 | +- LSP: `go run ./cmd/rslint --lsp` | IPC API: `go run ./cmd/rslint --api` |
| 26 | + |
| 27 | +## Coding Style & Naming Conventions |
| 28 | + |
| 29 | +- Go uses gofmt/goimports; keep functions focused and small. |
| 30 | +- TS/JS/MD/CSS use Prettier via `pnpm run format`. |
| 31 | +- Rules: `internal/plugins/typescript/rules/<rule>/`; tests: `<rule>_test.go`. |
| 32 | +- Prefer table-driven tests and existing helpers in `internal/utils`. |
| 33 | + |
| 34 | +## Testing Guidelines |
| 35 | + |
| 36 | +- Co-locate Go tests with implementation; name files `*_test.go` and functions `TestXxx`. |
| 37 | +- Keep tests minimal and behavior-focused; avoid unrelated scenarios. |
| 38 | +- Run `pnpm run test:go` (Go) and `pnpm run test` (JS) before submitting. |
| 39 | + |
| 40 | +## Commit & Pull Request Guidelines |
| 41 | + |
| 42 | +- Use Conventional Commits: `feat:`, `fix:`, `chore:`, `docs:`, `ci:`, etc. |
| 43 | +- PRs should be small, with clear description, repro steps, and linked issues. |
| 44 | +- Include examples (commands or code) and update docs when behavior changes. |
| 45 | +- Preserve existing CLI behavior unless a change is explicitly requested. |
| 46 | + |
| 47 | +## Architecture & Configuration Tips |
| 48 | + |
| 49 | +- rslint loads `rslint.json`/`rslint.jsonc`; rules accept ESLint-style levels/options. |
| 50 | +- The linter walks each file once and dispatches to registered listeners; `--singleThreaded` disables parallelism. |
| 51 | +- Use `--format github` in CI to emit GitHub workflow annotations. |
0 commit comments