Contributing
November 22, 2023 ยท View on GitHub
First of all, thanks for taking the time to contribute! :+1:
How Can I Contribute?
Report bugs and suggest improvements. If something doesn't work well for you or can be done better, please let us know! When you are creating a new issue, fill out the issue template, the information it asks for helps us resolve issues faster.
Create New Rule
- Create a new file for the rule implementation in
src/rules. File name should be lowercased, words must be separated by dashes (-). - Create a test file
<rule name>.test.tsintest/rules. - Add the rule to
src/index.ts. - In folder
docs/rulescreate a rule documentation file<rule name>.md - In
README.mdadd a reference to this documentation file. - Run Ruling test.
Testing
To run unit tests:
npm run test
To run unit tests in watch mode:
npm run test -- --watch
And finally to run unit tests with coverage:
npm run test -- --coverage
Ruling
The ruling test is a special integration test which launches the analysis of a large code base, and then compares those results to the set of expected issues (stored as snapshot files). To have this code base locally:
git submodule update --init --recursive
To run the ruling test:
npm run ruling
npm run ruling -- --rule <rule-file-name> # to run ruling for a single rule
npm run ruling -- --update # to update the snapshots
npm run ruling -- --rule <rule-file-name> --update # it is possible to combine both options
Code Style
We're using Prettier to format the code, the options are in package.json.