Skip to content

Commit ecce1f8

Browse files
AliSajidai
andauthored
feat: add a pre-commit hook (#8)
* feat: add a pre-commit hook Signed-off-by: Ali Sajid Imami <395482+AliSajid@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Andrey Sitnik <andrey@sitnik.ru> * docs: add consistent spacing and link Signed-off-by: Ali Sajid Imami <395482+AliSajid@users.noreply.github.com> --------- Signed-off-by: Ali Sajid Imami <395482+AliSajid@users.noreply.github.com> Co-authored-by: Andrey Sitnik <andrey@sitnik.ru>
1 parent df78e95 commit ecce1f8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ Rules:
2525
alt="Sponsored by Evil Martians" width="236" height="54">
2626
</a>
2727

28+
## Pre-Commit Hook
29+
30+
This project is also available as a [pre-commit hook](https://pre-commit.com/). Please add the following to your pre-commit configuration.
31+
32+
```yaml
33+
repos:
34+
- repo: https://github.com/browserslist/lint
35+
id: browserslist-lint
36+
```
2837
2938
## JS API
3039

pre-commit-hooks.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Define the hooks available in this repository
2+
- id: browserslist-lint
3+
name: Validate Browserslist Configuration
4+
# Command to execute the linter using npx for local installation
5+
entry: npx browserslist-lint
6+
# Specify the language for the hook; 'node' is used for npm-based tools
7+
language: node
8+
# Regular expression to match files that should trigger the hook
9+
# The hook will run if `.browserslistrc` or `package.json` is modified
10+
files: (\.browserslistrc|package\.json)$
11+
# Disable passing filenames as arguments since the linter inspects its own targets
12+
pass_filenames: false
13+
# Run the hook only when relevant files are modified, not always
14+
always_run: false
15+
# Description of the hook to inform users about its purpose
16+
description: Validate Browserslist configuration using browserslist-lint.

0 commit comments

Comments
 (0)