Skip to content

Latest commit

 

History

History
46 lines (40 loc) · 2.71 KB

File metadata and controls

46 lines (40 loc) · 2.71 KB

Repository Guidelines

Project Structure & Module Organization

  • src/: TypeScript sources. extension.ts wires activation, diagnostics, and settings; linter.ts wraps the write-good engine.
  • out/: Compiled JavaScript. Generated by tsc; do not edit.
  • Config: package.json (VS Code contributions, scripts), tsconfig.json, eslint.config.mjs.
  • CI: .github/workflows/node.js.yml runs install, compile, and lint on pushes/PRs.
  • Workspace: .vscode/ contains local launch/debug config for Extension Development Host.

Build, Test, and Development Commands

  • npm ci: Clean install dependencies (used in CI).
  • npm run compile: Build TypeScript to out/.
  • npm run watch: Incremental rebuild during development.
  • npm run lint: Lint src/**/*.ts via ESLint.
  • Run locally: Open in VS Code and press F5 to launch the Extension Development Host; open a Markdown file to see diagnostics.
  • Publish (maintainers): vsce publish after npm run compile and npm run lint.

Coding Style & Naming Conventions

  • Language: TypeScript. Indent 4 spaces; end statements with semicolons.
  • Names: camelCase for variables/functions, PascalCase for types/interfaces, short lowercase filenames (e.g., extension.ts).
  • Linting: ESLint with @typescript-eslint. Enforced rules include semi: always; some strict TS rules are relaxed. Run npm run lint and fix warnings.

Testing Guidelines

  • End-to-end tests: @vscode/test-electron + Mocha/Chai.
  • Structure: test/runTest.ts (boot), test/suite/*.test.ts (specs), fixtures under test/fixtures/ws/.
  • Commands: npm test (headless by default), npm run test:gui (shows Dev Host), npm run test:ci (forces headless; used in CI).
  • Scenarios: diagnostics for Markdown, language filtering, "only lint on save", and debounce behavior.
  • 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.

Commit & Pull Request Guidelines

  • Commits: Imperative, concise subject (≤72 chars). Example: lint: fix debounce handling in onDidChange.
  • Reference issues/PRs when relevant (e.g., Fixes #123).
  • 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).

Configuration Tips

  • Key settings forwarded to write-good:
    • Example settings.json snippet:
      {
        "write-good.languages": ["markdown", "plaintext"],
        "write-good.only-lint-on-save": false,
        "write-good.debounce-time-in-ms": 200,
        "write-good.write-good-config": { "eprime": true }
      }
  • Avoid editing out/; make changes in src/ and rebuild.