-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
247 lines (218 loc) · 8.11 KB
/
.pre-commit-config.yaml
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
---
minimum_pre_commit_version: "1.15"
default_stages: [commit]
ci:
skip: []
repos:
# ----------------------------------------------
# Meta hooks
# ----------------------------------------------
- repo: meta
hooks:
- id: identity
stages: [manual]
- id: check-hooks-apply
stages: [manual]
- id: check-useless-excludes
stages: [manual]
# ----------------------------------------------
# File hooks
# ----------------------------------------------
# file checking out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 8fe62d14e0b4d7d845a7022c5c2c3ae41bdd3f26 # frozen: v4.1.0
hooks:
- id: check-case-conflict
- id: check-shebang-scripts-are-executable
exclude: '^.*\.rs$'
- id: check-symlinks
- id: destroyed-symlinks
- id: forbid-new-submodules
# ####################################################################################
#
# FORMATTING
#
# ####################################################################################
# ----------------------------------------------
# General (code unspecific)
# ----------------------------------------------
# ----------------------------------------------
# Rust
# ----------------------------------------------
# Run rust toolchain
- repo: local
hooks:
# rustfmt - rust formater
# Config file: rustfmt.toml
- id: cargo-fmt
name: rustfmt
description: Format rust source with rustfmt.
entry: cargo fmt
args: ["--"]
language: system
types: [rust]
# ----------------------------------------------
# JS / TS / HTML / CSS / MD / YAML
# ----------------------------------------------
# prettier - JS formater
- repo: https://github.com/pre-commit/mirrors-prettier
# https://github.com/prettier/prettier
# Config file: .prettierrc (JSON, YAML)
# Ignore file: .prettierignore (file ignore pattern)
rev: ea782651a7e32f40a3d13b76c79d5a2474ee8723 # frozen: v2.5.1
hooks:
- id: prettier
additional_dependencies:
- "prettier@^2.5.1"
- "@trivago/prettier-plugin-sort-imports@^3.2.0"
# code unspecific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 8fe62d14e0b4d7d845a7022c5c2c3ae41bdd3f26 # frozen: v4.1.0
hooks:
- id: end-of-file-fixer
stages: [commit]
- id: trailing-whitespace
stages: [commit]
exclude: ".*\\.test\\.tsx\\.snap$"
# ####################################################################################
#
# LINTING
#
# ####################################################################################
# ----------------------------------------------
# General (code unspecific)
# ----------------------------------------------
- repo: local
hooks:
# Find TODO:|FIXME:|BUG: comments in all files
# Inline skip: `#i#` directly after the colon after the tag-word
- id: find-todos
name: "Find TODO:|FIXME:|BUG: comments"
description: "Check for TODO:|FIXME:|BUG: comments in all files"
language: pygrep
entry: '(^|//!?|#|<!--|;|/\*(\*|!)?|\.\.)\s*(TODO:|FIXME:|BUG:)(?!#i#)'
exclude: TODO
# code unspecific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 8fe62d14e0b4d7d845a7022c5c2c3ae41bdd3f26 # frozen: v4.1.0
hooks:
- id: check-merge-conflict
- id: detect-private-key
# ----------------------------------------------
# Rust
# ----------------------------------------------
# Run rust toolchain
- repo: local
hooks:
# clippy - rust linter
- id: cargo-clippy
name: clippy
description: Lint rust source with clippy.
entry: cargo clippy
language: system
types: [rust]
pass_filenames: false
# check - rust package checker
- id: cargo-check
name: cargo check
description: Check rust package for errors.
entry: cargo check
args: ["--all-targets"]
language: system
types: [rust]
pass_filenames: false
# ----------------------------------------------
# JavaScript
# ----------------------------------------------
# eslint - JS linter
- repo: https://github.com/pre-commit/mirrors-eslint
# https://github.com/eslint/eslint
# Config file: .eslintrc.json
# Ignore file: .eslintignore (file ignore pattern)
rev: 1e8a56ba809208a3d18f9ae88fd1459b5ed5c4b5 # frozen: v8.9.0
hooks:
- id: eslint
files: \.[jt]sx?$ # *.js, *.jsx, *.ts, *.tsx
types: [file]
additional_dependencies:
- eslint@7.32.0
- eslint-config-airbnb@18.2.1
- eslint-config-prettier@8.3.0
- eslint-import-resolver-typescript@2.4.0
- eslint-plugin-import@2.23.4
- eslint-plugin-jsx-a11y@6.4.1
- eslint-plugin-prettier@3.4.0
- eslint-plugin-react@7.24.0
- eslint-plugin-react-hooks@4.2.0
# ----------------------------------------------
# HTML
# ----------------------------------------------
# htmlhint - HTML linter
- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
rev: b234899b5db911d0e5482deffcf4e6364ad349d0 # frozen: v1.1.1
hooks:
# https://htmlhint.com/
# Config file: .htmlhintrc (JSON|YAML|JS containing config obj) [--config/-c]
# Ignore file: .htmlhintignore (file ignore pattern) [--ignore/-i]
# Inline config e.g.: `<!-- htmlhint tag-pair,id-class-value:underline -->`
- id: htmlhint
# https://github.com/htmllint/htmllint/wiki/Options
# Config file: .htmllintrc (json) [--rc]
# Inline config: `<!-- htmllint [key]="[value]" -->`
- id: htmllint
# ----------------------------------------------
# CSS
# ----------------------------------------------
- repo: https://github.com/cielquan/mirrors-stylelint
# Config file: .stylelintrc.json
rev: 765d365d9e49e2c4af3c7c94fc55176af32daaf4 # frozen: v14.3.0
hooks:
- id: stylelint
additional_dependencies:
- "stylelint"
- "stylelint-config-standard"
- "stylelint-config-prettier"
- "stylelint-config-tailwindcss"
# ----------------------------------------------
# Markdown
# ----------------------------------------------
# markdownlint - md file checker
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: 79c5e552066e7ad28aca449e7f2eed692a603abf # frozen: v0.4.0
# Config files:
# - .markdownlint-cli2.jsonc
# - .markdownlint-cli2.yaml
# - .markdownlint-cli2.cjs
# - .markdownlint.jsonc or .markdownlint.json
# - .markdownlint.yaml or .markdownlint.yml
# - .markdownlint.cjs
# Inline config:
# Disable all rules: <!-- markdownlint-disable -->
# Enable all rules: <!-- markdownlint-enable -->
# Disable all rules for the next line only: <!-- markdownlint-disable-next-line -->
# Disable rules by name: <!-- markdownlint-disable MD001 MD005 -->
# Enable rules by name: <!-- markdownlint-enable MD001 MD005 -->
# Disable rules by name for next line only: <!-- markdownlint-disable-next-line MD001 MD005 -->
# Capture the current rule configuration: <!-- markdownlint-capture -->
# Restore the captured rule configuration: <!-- markdownlint-restore -->
hooks:
- id: markdownlint-cli2
# ----------------------------------------------
# JSON / TOML / YAML
# ----------------------------------------------
# JSON specific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 8fe62d14e0b4d7d845a7022c5c2c3ae41bdd3f26 # frozen: v4.1.0
hooks:
- id: check-json
- id: check-toml
- id: check-yaml
# yamllint - yaml linter
- repo: https://github.com/adrienverge/yamllint
rev: 058fef75598d1a9d9250487d91549abf379878e0 # frozen: v1.26.3
hooks:
# Config file: .yamllint (yaml) [--config-file]
# Inline skip: `# yamllint disable-line[ rule:<RULE>]`
# Block skip: `# yamllint disable[ rule:<RULE>]`
# Block skip end: `# yamllint enable`
- id: yamllint