-
Notifications
You must be signed in to change notification settings - Fork 9k
Expand file tree
/
Copy pathlefthook.yml
More file actions
211 lines (204 loc) · 6.45 KB
/
Copy pathlefthook.yml
File metadata and controls
211 lines (204 loc) · 6.45 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
output:
- summary
- empty_summary
- failure
- execution
- execution_out
- execution_info
- skips
glob_matcher: doublestar
pre-commit:
parallel: true
skip:
- merge
- rebase
commands:
rubocop:
exclude: &ruby_exclude
- "bin/notify_file_change"
- "bin/docker/**/*"
glob: &ruby_glob
- "**/*.{rb,rake,thor}"
- "bin/**/*"
- "Gemfile"
run: bundle exec rubocop --force-exclusion {staged_files}
syntax_tree:
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec stree check Gemfile {staged_files}
prettier:
glob: &prettier_glob
- "app/assets/stylesheets/**/*.{css,scss}"
- "frontend/**/*.{js,gjs,ts,gts,mts,cts,scss,css,cjs,mjs}"
- "plugins/**/*.{js,gjs,ts,gts,mts,cts,scss,css,cjs,mjs}"
- "themes/**/*.{js,gjs,ts,gts,mts,cts,scss,css,cjs,mjs}"
run: pnpm pprettier --list-different {staged_files}
# docs/developer-guides is its own pnpm workspace package with its own
# prettier config. It needs `root` so prettier runs with that directory as
# its cwd: the repo-root .prettierignore ignores **/*.md, so a run from the
# root silently checks nothing and exits 0.
developer-docs-prettier:
root: &developer_docs_root "docs/developer-guides/"
glob: &developer_docs_glob "docs/developer-guides/**/*.{md,json,mjs,yml}"
run: pnpm prettier --list-different {staged_files}
eslint:
glob: &eslint_glob
- "frontend/**/*.{js,gjs,ts,gts,mts,cts,cjs,mjs}"
- "plugins/**/*.{js,gjs,ts,gts,mts,cts,cjs,mjs}"
- "themes/**/*.{js,gjs,ts,gts,mts,cts,cjs,mjs}"
run: pnpm eslint --max-warnings 0 --no-warn-ignored {staged_files}
yaml-syntax:
glob: &yaml_glob "**/*.{yaml,yml}"
# database.yml is an erb file not a yaml file
exclude: &yaml_exclude "config/database.yml"
run: bundle exec yaml-lint {staged_files}
i18n-lint:
glob: &i18n_glob "**/{client,server}.en.yml"
run: bundle exec ruby script/i18n_lint.rb {staged_files}
stylelint:
glob: &stylelint_glob
- "app/assets/stylesheets/**/*.scss"
- "plugins/**/assets/stylesheets/**/*.scss"
- "themes/**/*.scss"
run: pnpm stylelint {staged_files}
fix-staged:
parallel: false
commands:
prettier:
glob: *prettier_glob
run: pnpm pprettier --write {staged_files}
developer-docs-prettier:
root: *developer_docs_root
glob: *developer_docs_glob
run: pnpm prettier --write {staged_files}
eslint:
glob: *eslint_glob
run: pnpm eslint --fix --no-warn-ignored {staged_files}
stylelint:
glob: *stylelint_glob
run: pnpm stylelint --fix {staged_files}
rubocop:
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec rubocop --force-exclusion -A {staged_files}
syntax_tree:
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec stree write Gemfile {staged_files}
# Working-tree counterparts of pre-commit/fix-staged. Deliberately NOT named
# pre-commit/pre-push so lefthook does not hide unstaged changes: the linters
# read the files exactly as they are on disk, not their staged blobs. bin/lint
# routes explicit-path, --recent, --unstaged and --wip runs here. The {files}
# template is overridden by the --file flag bin/lint passes; the files command
# is only the fallback when no --file is given and lists tracked plus untracked
# (but not ignored) paths.
lint-files:
parallel: true
commands:
rubocop:
files: &working_tree_files git ls-files --cached --others --exclude-standard
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec rubocop --force-exclusion {files}
syntax_tree:
files: *working_tree_files
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec stree check Gemfile {files}
prettier:
files: *working_tree_files
glob: *prettier_glob
run: pnpm pprettier --list-different {files}
developer-docs-prettier:
files: *working_tree_files
root: *developer_docs_root
glob: *developer_docs_glob
run: pnpm prettier --list-different {files}
eslint:
files: *working_tree_files
glob: *eslint_glob
run: pnpm eslint --max-warnings 0 --no-warn-ignored {files}
yaml-syntax:
files: *working_tree_files
glob: *yaml_glob
exclude: *yaml_exclude
run: bundle exec yaml-lint {files}
i18n-lint:
files: *working_tree_files
glob: *i18n_glob
run: bundle exec ruby script/i18n_lint.rb {files}
stylelint:
files: *working_tree_files
glob: *stylelint_glob
run: pnpm stylelint {files}
fix-files:
parallel: false
commands:
prettier:
files: *working_tree_files
glob: *prettier_glob
run: pnpm pprettier --write {files}
developer-docs-prettier:
files: *working_tree_files
root: *developer_docs_root
glob: *developer_docs_glob
run: pnpm prettier --write {files}
eslint:
files: *working_tree_files
glob: *eslint_glob
run: pnpm eslint --fix {files}
stylelint:
files: *working_tree_files
glob: *stylelint_glob
run: pnpm stylelint --fix {files}
rubocop:
files: *working_tree_files
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec rubocop --force-exclusion -A {files}
syntax_tree:
files: *working_tree_files
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec stree write Gemfile {files}
fix-all:
parallel: false
commands:
prettier:
run: pnpm lint:prettier:fix
eslint:
run: pnpm lint:js:fix
stylelint:
run: pnpm lint:css:fix
rubocop:
run: bundle exec rubocop --force-exclusion -A
syntax_tree:
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec stree write Gemfile {all_files}
lints:
parallel: true
commands:
rubocop:
glob: *ruby_glob
run: bundle exec rubocop
syntax_tree:
exclude: *ruby_exclude
glob: *ruby_glob
run: bundle exec stree check Gemfile {all_files}
prettier:
run: pnpm lint:prettier
eslint:
run: pnpm lint:js
stylelint:
run: pnpm lint:css
yaml-syntax:
glob: *yaml_glob
# database.yml is an erb file not a yaml file
exclude: *yaml_exclude
run: bundle exec yaml-lint {all_files}
i18n-lint:
glob: *i18n_glob
run: bundle exec ruby script/i18n_lint.rb {all_files}
glint:
run: pnpm lint:types