|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `src/`: TypeScript sources. `extension.ts` wires activation, diagnostics, and settings; `linter.ts` wraps the `write-good` engine. |
| 5 | +- `out/`: Compiled JavaScript. Generated by `tsc`; do not edit. |
| 6 | +- Config: `package.json` (VS Code contributions, scripts), `tsconfig.json`, `eslint.config.mjs`. |
| 7 | +- CI: `.github/workflows/node.js.yml` runs install, compile, and lint on pushes/PRs. |
| 8 | +- Workspace: `.vscode/` contains local launch/debug config for Extension Development Host. |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +- `npm ci`: Clean install dependencies (used in CI). |
| 12 | +- `npm run compile`: Build TypeScript to `out/`. |
| 13 | +- `npm run watch`: Incremental rebuild during development. |
| 14 | +- `npm run lint`: Lint `src/**/*.ts` via ESLint. |
| 15 | +- Run locally: Open in VS Code and press F5 to launch the Extension Development Host; open a Markdown file to see diagnostics. |
| 16 | +- Publish (maintainers): `vsce publish` after `npm run compile` and `npm run lint`. |
| 17 | + |
| 18 | +## Coding Style & Naming Conventions |
| 19 | +- Language: TypeScript. Indent 4 spaces; end statements with semicolons. |
| 20 | +- Names: `camelCase` for variables/functions, `PascalCase` for types/interfaces, short lowercase filenames (e.g., `extension.ts`). |
| 21 | +- Linting: ESLint with `@typescript-eslint`. Enforced rules include `semi: always`; some strict TS rules are relaxed. Run `npm run lint` and fix warnings. |
| 22 | + |
| 23 | +## Testing Guidelines |
| 24 | +- End-to-end tests: `@vscode/test-electron` + Mocha/Chai. |
| 25 | +- Structure: `test/runTest.ts` (boot), `test/suite/*.test.ts` (specs), fixtures under `test/fixtures/ws/`. |
| 26 | +- Commands: `npm test` (headless by default), `npm run test:gui` (shows Dev Host), `npm run test:ci` (forces headless; used in CI). |
| 27 | +- Scenarios: diagnostics for Markdown, language filtering, "only lint on save", and debounce behavior. |
| 28 | +- Tips: set `write-good.debounce-time-in-ms` to `0` for deterministic checks unless testing debounce; create temp files in tests to avoid cross-test state. |
| 29 | + |
| 30 | +## Commit & Pull Request Guidelines |
| 31 | +- Commits: Imperative, concise subject (≤72 chars). Example: `lint: fix debounce handling in onDidChange`. |
| 32 | +- Reference issues/PRs when relevant (e.g., `Fixes #123`). |
| 33 | +- PRs must: describe intent and approach, list user-facing changes (settings/diagnostics), include before/after screenshots or GIFs when behavior changes, and pass CI (install, compile, lint). |
| 34 | + |
| 35 | +## Configuration Tips |
| 36 | +- Key settings forwarded to `write-good`: |
| 37 | + - Example `settings.json` snippet: |
| 38 | + ```json |
| 39 | + { |
| 40 | + "write-good.languages": ["markdown", "plaintext"], |
| 41 | + "write-good.only-lint-on-save": false, |
| 42 | + "write-good.debounce-time-in-ms": 200, |
| 43 | + "write-good.write-good-config": { "eprime": true } |
| 44 | + } |
| 45 | + ``` |
| 46 | +- Avoid editing `out/`; make changes in `src/` and rebuild. |
0 commit comments