forked from libnyanpasu/clash-nyanpasu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.lintstagedrc.js
More file actions
53 lines (53 loc) · 1.73 KB
/
.lintstagedrc.js
File metadata and controls
53 lines (53 loc) · 1.73 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
export default {
'*.{js,cjs,.mjs,jsx}': (filenames) => {
const configFiles = [
'.oxlintrc.json',
'.lintstagedrc.js',
'commitlint.config.js',
]
const filtered = filenames.filter(
(file) => !configFiles.some((config) => file.endsWith(config)),
)
if (filtered.length === 0) return []
return ['prettier --write', 'oxlint --fix']
},
'scripts/**/*.{ts,tsx}': [
'prettier --write',
'oxlint --fix',
() => 'tsc -p scripts/tsconfig.json --noEmit',
],
'frontend/interface/**/*.{ts,tsx}': [
'prettier --write',
'oxlint --fix',
() => 'tsc -p frontend/interface/tsconfig.json --noEmit',
],
'frontend/ui/**/*.{ts,tsx}': [
'prettier --write',
'oxlint --fix',
() => 'tsc -p frontend/ui/tsconfig.json --noEmit',
],
'frontend/nyanpasu/**/*.{ts,tsx}': [
'prettier --write',
'oxlint --fix',
() => 'tsc -p frontend/nyanpasu/tsconfig.json --noEmit',
],
'backend/**/*.{rs,toml}': [
() =>
'cargo clippy --manifest-path=./backend/Cargo.toml --all-targets --all-features',
() => 'cargo fmt --manifest-path ./backend/Cargo.toml --all',
// () => 'cargo test --manifest-path=./backend/Cargo.toml',
// () => "cargo fmt --manifest-path=./backend/Cargo.toml --all",
// do not submit untracked files
// () => 'git add -u',
],
'*.{html,sass,scss,less}': ['prettier --write', 'stylelint --fix'],
'package.json': ['prettier --write'],
'*.{md,json,jsonc,json5,yaml,yml,toml}': (filenames) => {
// exclude frontend/nyanpasu/messages directory
const filtered = filenames.filter(
(file) => !file.includes('frontend/nyanpasu/messages/'),
)
if (filtered.length === 0) return []
return `prettier --write ${filtered.join(' ')}`
},
}