forked from owncast/owncast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
80 lines (74 loc) · 2.27 KB
/
lefthook.yml
File metadata and controls
80 lines (74 loc) · 2.27 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# This is the configuration file for pre-push and pre-commit hooks that can
# be optionally run to assist in Owncast development.
# This file should be placed in the root of the Owncast repository.
# It will perform code linting, formatting, run tests, and other checks.
#
# To enable, run:
# make install-hooks
#
# To learn more: https://lefthook.dev/usage/commands.html#lefthook-install
#
# To test the install run: ./bin/lefthook run test
# And you should see the Go and JS tests run.
pre-push:
parallel: true
commands:
web-build:
root: web/
run: npm run build
pre-commit:
parallel: true
commands:
js-linter:
glob: '*.{js,ts,jsx,tsx}'
root: web/
run: npx --yes eslint --fix --ext {staged_files}
stage_fixed: true
prettier:
glob: '*.{js,ts,jsx,tsx,css,scss}'
run: npx --yes prettier --write {staged_files}
staged_fixed: true
css-linter:
glob: '*.{css,scss}'
root: web/
run: npx --yes stylelint --fix {staged_files}
stage_fixed: true
js-unused:
glob: '*.{js,ts,jsx,tsx}'
root: web/
run: npx --yes knip --include dependencies,files,exports
go-fmt:
glob: '*.go'
run: GOBIN=$(pwd)/bin go install -C tools mvdan.cc/gofumpt && ./bin/gofumpt -l -w {staged_files}
stage_fixed: true
golangci-lint:
glob: '*.go'
run: GOBIN=$(pwd)/bin go install -C tools github.com/golangci/golangci-lint/v2/cmd/golangci-lint && ./bin/golangci-lint run ./...
go-test:
glob: '*.go'
run: go test ./... > /dev/null
js-test:
glob: '*.{js,ts,jsx}'
root: web/
run: npm test
test:
parallel: true
commands:
web:
root: web/
run: npm test
go:
run: go test ./... > /dev/null
lint:
parallel: true
commands:
golangci-lint:
glob: '*.go'
run: GOBIN=$(pwd)/bin go install -C tools github.com/golangci/golangci-lint/v2/cmd/golangci-lint && ./bin/golangci-lint run ./...
# Validate commit messages per https://www.conventionalcommits.org/en/v1.0.0/
# Install commitlint into your global npm path if you want to use it.
# npm install -g @commitlint/{config-conventional,cli}
commit-msg:
commands:
'lint commit message':
run: if command -v commitlint >/dev/null 2>&1; then commitlint --edit {1}; fi