-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.lintstagedrc.mjs
32 lines (31 loc) · 924 Bytes
/
.lintstagedrc.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {
readonlyArray,
io,
console,
readonlyNonEmptyArray,
option,
string,
} from "fp-ts/lib/index.js"
import { pipe, flow, constant } from "fp-ts/lib/function.js"
import { default as micromatch } from "micromatch"
export default (allFiles) =>
pipe(
micromatch(allFiles, "*.ts"),
readonlyNonEmptyArray.fromArray,
option.map((tsfiles) =>
pipe(
[
"eslint --cache --fix",
"prettier --write",
"jest --selectProjects --passWithNoTests",
],
readonlyArray.map((string) => string.split(" ")),
readonlyArray.map(readonlyArray.alt(constant(tsfiles))),
readonlyArray.map(readonlyArray.intersperse(" ")),
readonlyArray.map(readonlyArray.foldMap(string.Monoid)((a) => a)),
readonlyArray.append("pnpm run docs"),
readonlyArray.append("git add ."),
),
),
option.getOrElse(readonlyArray.zero),
)