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 cito install dependencies for a clean, reproducible build based on thepackage-lock.jsonfile.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
c8for coverage.npm run coverA 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 --writeon staged.js,.css,.json, and.mdfiles. - Run
eslint --fixon staged.jsfiles.
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
masterbranch of theuncss/uncssrepository.
Thank you for contributing!