-
Notifications
You must be signed in to change notification settings - Fork 12
/
lint-staged.config.js
49 lines (42 loc) · 1.59 KB
/
lint-staged.config.js
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
// lint-staged.config.js
module.exports = {
'**/*.{js,jsx,ts,tsx}': (filenames) => [
// Format files with Prettier
`prettier --write ${filenames.join(' ')}`,
// Lint the projects affected by the staged files
`nx affected --target=lint --files=${filenames.join(',')}`,
],
'**/*.{css,scss}': (filenames) => [
// Format files with Prettier
`prettier --write ${filenames.join(' ')}`,
// Lint files with Stylelint
`stylelint --allow-empty-input ${filenames.join(' ')}`,
],
'**/*.{json,md,yaml,yml,html}': (filenames) => [
// Format files with Prettier
`prettier --write ${filenames.join(' ')}`,
],
'**/*.py': (filenames) => [
// Format files with Black
`poetry run black ${filenames.join(' ')}`,
// Lint the projects affected by the staged files
`nx affected --target=lint --files=${filenames.join(',')}`,
// Type check the projects affected by the staged files
`nx affected --target=type-check --files=${filenames.join(',')}`,
],
'**/Dockerfile.*': (filenames) => [
// Lint Dockerfiles with Hadolint
`hadolint ${filenames.join(' ')}`,
],
'**/*.sql': (filenames) => [
// Format files with Prettier
`prettier --write ${filenames.join(' ')}`,
// Lint files with SQLFluff (conflicts with SQL formatter)
// `poetry run sqlfluff lint ${filenames.join(' ')}`,
],
'**/*': (filenames) => [
// Test the projects affected by the staged files. This task assumes that formatting files and
// testing affected projects can be safely run in parallel.
`nx affected --target=test --files=${filenames.join(',')}`,
],
};