Thank you for your interest in contributing! This guide will help you get started.
-
Clone the repository:
git clone https://github.com/tempoxyz/lints.git cd lints -
Install dependencies:
pnpm install
-
Verify everything works:
pnpm test pnpm typecheck pnpm lint
-
Create a new branch:
git checkout -b your-feature-name
-
Make your changes:
- Add or modify lint rules in
src/rust/rules/orsrc/typescript/rules/ - Add tests in
src/*/tests/ - Update documentation if needed
- Add or modify lint rules in
-
Test your changes:
# Run all tests pnpm test # Run specific language tests pnpm test:rust pnpm test:typescript # Type check pnpm typecheck # Lint pnpm lint
-
Create a changeset:
Before committing, create a changeset to document your changes:
pnpm changeset
This will prompt you to:
- Select the type of change (patch/minor/major)
- Write a summary of your change
The changeset file will be committed along with your changes.
Change types:
- Patch (
0.0.x): Bug fixes, documentation updates, minor improvements - Minor (
0.x.0): New features, new rules, backward-compatible changes - Major (
x.0.0): Breaking changes (rarely needed)
-
Commit your changes:
git add . git commit -m "feat: add new rule for xyz"
-
Push and create a pull request:
git push origin your-feature-name
Then create a PR on GitHub.
Releases are automated using Changesets:
- When PRs with changesets are merged to
main, a "Version Packages" PR is automatically created - The Version Packages PR:
- Bumps the version in
package.json - Updates
CHANGELOG.mdwith all changeset summaries - Deletes the consumed changeset files
- Bumps the version in
- When maintainers merge the Version Packages PR:
- A GitHub Release is created
- Git tags are created and pushed
- Major version tags (e.g.,
v0,v1) are updated to point to the latest release
To add a new lint rule:
-
Create the rule file:
src/rust/rules/your-rule-name.yml # or src/typescript/rules/your-rule-name.yml -
Add test cases:
src/rust/tests/your-rule-name-test.yml # or src/typescript/tests/your-rule-name-test.yml -
Run tests to generate snapshots:
pnpm test -
Document the rule:
- Add description and rationale to the rule YAML file
- Update README.md if the rule is noteworthy
- We use Biome for linting and formatting
- Run
pnpm checkto format code automatically - Run
pnpm lintto check for issues
If you have questions or need help:
- Open an issue on GitHub
- Check existing issues for similar questions
- Review the ast-grep documentation
Thank you for contributing! 🎉