Contributing
Contributions to UnCSS are welcome! Whether you're fixing a bug, improving documentation, or proposing a new feature, your help is appreciated.
Setting Up the Development Environment
To get started with development, you'll need to clone the repository and install the dependencies.
-
Fork and Clone the Repository
First, fork the repository on GitHub. Then, clone your fork locally:
git clone https://github.com/YOUR_USERNAME/uncss.git cd uncss
-
Install Dependencies
This project uses
npm
. We recommend usingnpm ci
to install dependencies for a clean, reproducible build based on thepackage-lock.json
file.npm ci
Running Tests
UnCSS has a comprehensive test suite to ensure code quality and prevent regressions. Before submitting any changes, please ensure all tests pass.
-
Run all checks (linting + tests):
npm test
-
Run only the test suite (Mocha):
npm run mocha
-
Generate a test coverage report:
The project uses
c8
for coverage.npm run cover
A detailed HTML report will be generated in the
coverage/
directory.
Code Style and Linting
The project uses ESLint for code analysis and Prettier for code formatting to maintain a consistent style.
-
Run the linter:
npm run lint
Pre-commit Hook
This project uses husky
and lint-staged
to automatically format and lint your code before you commit. When you run git commit
, it will automatically:
- Run
prettier --write
on staged.js
,.css
,.json
, and.md
files. - Run
eslint --fix
on staged.js
files.
This helps ensure that all committed code adheres to the project's style guidelines.
Submitting a Pull Request
-
Create a new branch for your feature or bugfix:
git checkout -b my-awesome-feature
-
Make your changes and commit them with a descriptive message.
-
Ensure all tests and linting checks pass (
npm test
). -
Push your branch to your fork:
git push origin my-awesome-feature
-
Open a pull request from your fork to the
master
branch of theuncss/uncss
repository.
Thank you for contributing!