Skip to content

Latest commit

 

History

History
79 lines (59 loc) · 1.93 KB

File metadata and controls

79 lines (59 loc) · 1.93 KB

Contributing to DotDrift

Thanks for your interest. Here's everything you need.

Setup

git clone https://github.com/your-username/dotdrift
cd dotdrift
npm install

Development

# Run against a real project
npm run dev -- scan --dir path/to/project

# Watch mode during development
npm run dev -- watch --dir src

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Type check
npm run typecheck

Project Structure

src/
  cli.ts          — CLI entry (citty), command definitions
  scanner.ts      — AST traversal, process.env extraction
  envparser.ts    — .env and .env.example reader
  differ.ts       — Cross-reference scanner output vs env files
  reporter.ts     — Terminal output (picocolors) and JSON format
  watcher.ts      — File watching via chokidar
  config.ts       — Config file loading and merging
  index.ts        — Public API exports

tests/
  scanner.test.ts
  differ.test.ts
  reporter.test.ts
  fixtures/
    simple-project/   — Minimal fixture with known issues
    edge-cases/       — Destructuring, computed keys, etc.

Adding a New Rule

  1. Add the rule name to the RuleId type in src/types.ts
  2. Implement detection in the relevant module (scanner.ts for source-side, differ.ts for comparison-side)
  3. Add it to the default config in src/config.ts
  4. Document it in the Rules Reference table in README.md
  5. Add a test fixture and test case

Pull Request Guidelines

  • One PR per feature or fix
  • Add or update tests for any changed behavior
  • Run npm run typecheck && npm test before submitting
  • Keep the scope small — large PRs are hard to review

Reporting Issues

Open an issue with:

  • DotDrift version (npx dotdrift --version)
  • Node.js version (node --version)
  • A minimal reproduction (ideally a fixture or code snippet)
  • Expected vs actual output

License

By contributing, you agree your contributions will be licensed under MIT.