Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ Rules:
alt="Sponsored by Evil Martians" width="236" height="54">
</a>

## Pre-Commit Hook

This project is also available as a [pre-commit hook](https://pre-commit.com/). Please add the following to your pre-commit configuration.

```yaml
repos:
- repo: https://github.com/browserslist/lint
id: browserslist-lint
```

## JS API

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