lint-staged.sh 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  > Run linters against Git staged files
4
4
 
5
- `lint-staged.sh` is a shell script to evaluate a command with the list of [Git](https://git-scm.com) staged files as its arguments, filtered by globs.
5
+ `lint-staged.sh` is a shell script to evaluate a command with the list of [Git](https://git-scm.com) staged files as its arguments, filtered by globs. There are no additional features.
6
6
 
7
- There are no additional features. If you are familiar with [lint-staged](https://github.com/lint-staged/lint-staged) but only use it to check if staged files are valid — _but not automatically fix them_ — you might be interested in this simpler shell script.
7
+ > [!TIP]
8
+ > If you use [lint-staged](https://github.com/lint-staged/lint-staged) to check if staged files are valid — _but not automatically fix them_ — you might be interested in this simpler shell script.
8
9
 
9
10
  ## Example
10
11
 
@@ -22,7 +23,7 @@ prettier --check index.js README.md
22
23
 
23
24
  ## Installation
24
25
 
25
- Copy the `lint-staged.sh` file from this repo somewhere and run it. It should work in the [Bourne shell (`sh`)](https://en.wikipedia.org/wiki/Bourne_shell).
26
+ Copy the [`lint-staged.sh`](./lint-staged.sh) file from this repo somewhere and run it. It should work in the [Bourne shell (`sh`)](https://en.wikipedia.org/wiki/Bourne_shell).
26
27
 
27
28
  You probably want to run `lint-staged.sh` in a Git `pre-commit` hook so that you can abort the commit if one of your commands fails.
28
29
 
@@ -32,3 +33,13 @@ For example, create the file `.git/hooks/pre-commit` (and make it executable):
32
33
  #!/bin/sh
33
34
  lint-staged.sh "prettier --check" "*.js" "*.json" "*.md"
34
35
  ```
36
+
37
+ If you are using [`npm`](https://www.npmjs.com), you can install `lint-staged.sh` and [Husky](https://github.com/typicode/husky) from there:
38
+
39
+ ```shell
40
+ npm install --save-dev lint-staged.sh husky
41
+ npx husky init
42
+
43
+ # Adjust this file according to your needs
44
+ edit .husky/pre-commit
45
+ ```
package/lint-staged.sh CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
+ set -e
4
+
3
5
  DIM='\033[1;30m'
4
6
  NC='\033[0m'
5
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lint-staged.sh",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Run linters against Git staged files",
5
5
  "author": "Iiro Jäppinen <iiro@jappinen.fi> (https://iiro.fi)",
6
6
  "license": "MIT",