Skip to content

Commit af0e419

Browse files
authored
Add pre-commit hook (#411)
1 parent 2fcb083 commit af0e419

File tree

4 files changed

+90
-31
lines changed

4 files changed

+90
-31
lines changed

cspell.config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
"Formstyling",
7878
"otelgrpc",
7979
"tibdex",
80-
"nilness"
80+
"nilness",
81+
"lefthook",
82+
"gofmt"
8183
]
8284
}

lefthook.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
pre-commit:
2+
parallel: true
3+
commands:
4+
frontend-lint:
5+
glob: '*.{js,ts,tsx}'
6+
run: |
7+
eslint --cache --ignore-path ./.gitignore --fix {staged_files}
8+
yarn prettier --write {staged_files}
9+
stage_fixed: true
10+
backend-format:
11+
glob: '*pkg/**/*.go'
12+
run: gofmt -w -s {staged_files}
13+
stage_fixed: true
14+
spellcheck:
15+
run: yarn spellcheck {staged_files}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"author": "Grafana Labs",
2323
"license": "Apache-2.0",
2424
"dependencies": {
25+
"@emotion/css": "11.13.0",
2526
"@grafana/async-query-data": "0.2.0",
2627
"@grafana/data": "^11.2.0",
2728
"@grafana/experimental": "2.1.0",
@@ -30,8 +31,7 @@
3031
"@grafana/ui": "^11.2.0",
3132
"react": "18.3.1",
3233
"react-dom": "18.3.1",
33-
"tslib": "2.7.0",
34-
"@emotion/css": "11.13.0"
34+
"tslib": "2.7.0"
3535
},
3636
"devDependencies": {
3737
"@babel/core": "^7.25.2",
@@ -64,6 +64,7 @@
6464
"identity-obj-proxy": "3.0.0",
6565
"jest": "^29.5.0",
6666
"jest-environment-jsdom": "^29.5.0",
67+
"lefthook": "^1.7.15",
6768
"prettier": "^3.3.3",
6869
"react-select-event": "^5.3.0",
6970
"replace-in-file-webpack-plugin": "^1.0.6",

yarn.lock

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7877,6 +7877,72 @@ lazy-ass@^1.6.0:
78777877
resolved "https://registry.yarnpkg.com/lazy-ass/-/lazy-ass-1.6.0.tgz#7999655e8646c17f089fdd187d150d3324d54513"
78787878
integrity sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==
78797879

7880+
lefthook-darwin-arm64@1.7.15:
7881+
version "1.7.15"
7882+
resolved "https://registry.yarnpkg.com/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.7.15.tgz#8592cc67fa291d77e803ca27217ed22ee96ae451"
7883+
integrity sha512-o8JgCnLM7UgF9g0MwarHJFoj6aVSSkUInHpsQZegV1c7CVQY/LIXgSeAWRb9XBvuUjByJ/HiHFMp9/hAALTwxQ==
7884+
7885+
lefthook-darwin-x64@1.7.15:
7886+
version "1.7.15"
7887+
resolved "https://registry.yarnpkg.com/lefthook-darwin-x64/-/lefthook-darwin-x64-1.7.15.tgz#97581cff055e6e71045128bf8122f1b58e23c017"
7888+
integrity sha512-nrdoex0icmXYl7AAvG7WtfEzjQtX/kWvM88jPu/gijH6VhAjp110Y8VScB7rWOcApb5kNNeqd1nKMAFgZ8KhAg==
7889+
7890+
lefthook-freebsd-arm64@1.7.15:
7891+
version "1.7.15"
7892+
resolved "https://registry.yarnpkg.com/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.7.15.tgz#b3782811cf3f07acdabf2d9f78556c932c2d3296"
7893+
integrity sha512-zl1TPynklJZZ/YsWb2H0gfErQbey318i2W85wIKGEk8kC2UzOgYTuPffnfi7kANei9ntZnhvGgilc6tqYOPuGQ==
7894+
7895+
lefthook-freebsd-x64@1.7.15:
7896+
version "1.7.15"
7897+
resolved "https://registry.yarnpkg.com/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.7.15.tgz#080cbf8c6177ad34ecf7dd20bc4b27cb8fca4f09"
7898+
integrity sha512-/gKPwhWhZ3Q/efGs73/qw6nyR4WCT74oSTgn8wabAJO5+T/2FXTKzo7IiKkQmScmY5OcnD/0teJbJZ17VWSSOg==
7899+
7900+
lefthook-linux-arm64@1.7.15:
7901+
version "1.7.15"
7902+
resolved "https://registry.yarnpkg.com/lefthook-linux-arm64/-/lefthook-linux-arm64-1.7.15.tgz#705f4cb92a8a2b0edecf87ec5b165182a6befe68"
7903+
integrity sha512-re2f8WmYw19n8ojit0rnKbERAzD1/iCpU/Y8anXOjD/ROw/cpSfO88uKQrUCNY9Rp4XLtkkp9oDJs3Eg7JS7vA==
7904+
7905+
lefthook-linux-x64@1.7.15:
7906+
version "1.7.15"
7907+
resolved "https://registry.yarnpkg.com/lefthook-linux-x64/-/lefthook-linux-x64-1.7.15.tgz#210d929b94c7b6032420fd14c8e4896d44f64e69"
7908+
integrity sha512-Kj6ieTlhFGlbPDyVFeOb296MS9x/Jj5y/xTPLBM+EKbdsTJSvUYu5FdtEWfhpLyWmPfkZtULHcTQE1hoo9Q4Cg==
7909+
7910+
lefthook-openbsd-arm64@1.7.15:
7911+
version "1.7.15"
7912+
resolved "https://registry.yarnpkg.com/lefthook-openbsd-arm64/-/lefthook-openbsd-arm64-1.7.15.tgz#b0c10633e913e4b20de57e8089d7b0488f1cf453"
7913+
integrity sha512-85amE23mJ4BC9OThLkt+QCeVwue2Cr0ezN9LSwP0h8+royyj7YRcSu0VM/Et3B9LO50T2bpdI9norOqTcPZ9yA==
7914+
7915+
lefthook-openbsd-x64@1.7.15:
7916+
version "1.7.15"
7917+
resolved "https://registry.yarnpkg.com/lefthook-openbsd-x64/-/lefthook-openbsd-x64-1.7.15.tgz#9a8e9f4b5dfbd63fcdd7110c7e4fb47d7a33ec5b"
7918+
integrity sha512-vXx/PpcalFgdvqkoHLI4KTGZp0ti+VCCL7RqDTA6n+GZpxPTWEXSOz3GuwNALX93Dn6MOYQYktKtXADwy24fcA==
7919+
7920+
lefthook-windows-arm64@1.7.15:
7921+
version "1.7.15"
7922+
resolved "https://registry.yarnpkg.com/lefthook-windows-arm64/-/lefthook-windows-arm64-1.7.15.tgz#ed41bdf80f5e8737c81758b78b177f34898b31a2"
7923+
integrity sha512-jPKdQOLWQLRPO3VfI3ptpmdQBBsXTwaCLKXMo/gcSyU0xE/ltPD4QqvHzTAFJo00VcKRHjv9QeH69qhENjJtjw==
7924+
7925+
lefthook-windows-x64@1.7.15:
7926+
version "1.7.15"
7927+
resolved "https://registry.yarnpkg.com/lefthook-windows-x64/-/lefthook-windows-x64-1.7.15.tgz#2460a3d5c455af56075e8cfc42ab76c04c84e037"
7928+
integrity sha512-tlkSU669+b64AsqytGy1W3au7h8kFjt5ejLhTkErJpylTqThZIHm/GI0wUmpX+ud8kekM+9j407dweAHYOQ1XA==
7929+
7930+
lefthook@^1.7.15:
7931+
version "1.7.15"
7932+
resolved "https://registry.yarnpkg.com/lefthook/-/lefthook-1.7.15.tgz#58c9f5513211a1c75768ee640a6267a32e354ba0"
7933+
integrity sha512-HW2mYkhg0a3RH2t57+ZJwacJiSIuDEhsXQAaCw6iGeN7zowdUV7g5QtnRdFdPkaK2eaNFpG6Rp0GsTrl/v0gNg==
7934+
optionalDependencies:
7935+
lefthook-darwin-arm64 "1.7.15"
7936+
lefthook-darwin-x64 "1.7.15"
7937+
lefthook-freebsd-arm64 "1.7.15"
7938+
lefthook-freebsd-x64 "1.7.15"
7939+
lefthook-linux-arm64 "1.7.15"
7940+
lefthook-linux-x64 "1.7.15"
7941+
lefthook-openbsd-arm64 "1.7.15"
7942+
lefthook-openbsd-x64 "1.7.15"
7943+
lefthook-windows-arm64 "1.7.15"
7944+
lefthook-windows-x64 "1.7.15"
7945+
78807946
lerc@^3.0.0:
78817947
version "3.0.0"
78827948
resolved "https://registry.yarnpkg.com/lerc/-/lerc-3.0.0.tgz#36f36fbd4ba46f0abf4833799fff2e7d6865f5cb"
@@ -10239,16 +10305,7 @@ string-template@~0.2.1:
1023910305
resolved "https://registry.yarnpkg.com/string-template/-/string-template-0.2.1.tgz#42932e598a352d01fc22ec3367d9d84eec6c9add"
1024010306
integrity sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw==
1024110307

10242-
"string-width-cjs@npm:string-width@^4.2.0":
10243-
version "4.2.3"
10244-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
10245-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
10246-
dependencies:
10247-
emoji-regex "^8.0.0"
10248-
is-fullwidth-code-point "^3.0.0"
10249-
strip-ansi "^6.0.1"
10250-
10251-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
10308+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
1025210309
version "4.2.3"
1025310310
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
1025410311
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -10332,14 +10389,7 @@ string_decoder@~1.1.1:
1033210389
dependencies:
1033310390
safe-buffer "~5.1.0"
1033410391

10335-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
10336-
version "6.0.1"
10337-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
10338-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
10339-
dependencies:
10340-
ansi-regex "^5.0.1"
10341-
10342-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
10392+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
1034310393
version "6.0.1"
1034410394
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
1034510395
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -11192,7 +11242,7 @@ workerpool@6.2.1:
1119211242
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
1119311243
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
1119411244

11195-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
11245+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
1119611246
version "7.0.0"
1119711247
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
1119811248
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -11210,15 +11260,6 @@ wrap-ansi@^6.2.0:
1121011260
string-width "^4.1.0"
1121111261
strip-ansi "^6.0.0"
1121211262

11213-
wrap-ansi@^7.0.0:
11214-
version "7.0.0"
11215-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
11216-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
11217-
dependencies:
11218-
ansi-styles "^4.0.0"
11219-
string-width "^4.1.0"
11220-
strip-ansi "^6.0.0"
11221-
1122211263
wrap-ansi@^8.1.0:
1122311264
version "8.1.0"
1122411265
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)