Skip to content

Commit 7dc11f5

Browse files
committed
Add lint-staged to only lint staged files
Currently, linting runs on every pre-commit for the whole project. This can be slow for medium to large sized projects. With lint-staged, linting runs only on git staged files.
1 parent 9a544e1 commit 7dc11f5

File tree

3 files changed

+234
-5
lines changed

3 files changed

+234
-5
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ This is how a `package.json` could look like when making use of these scripts:
3131
"uphold-scripts": "^0.4.0"
3232
},
3333
"pre-commit": [
34-
"lint"
35-
]
34+
"lint-staged -q"
35+
],
36+
"lint-staged": {
37+
"*.{js,mjs,ts}": ["uphold-scripts lint"]
38+
}
3639
}
3740
```
3841

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"eslint": "^7.32.0",
2020
"eslint-config-uphold": "^2.0.0",
2121
"jest": "^27.3.1",
22+
"lint-staged": "^12.3.4",
2223
"pre-commit": "^1.2.2",
2324
"prettier": "^2.4.1"
2425
}

0 commit comments

Comments
 (0)