mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
pre-commit: add tsc and eslint hooks
This commit is contained in:
parent
2b6c00fa04
commit
88919a2667
5 changed files with 28 additions and 1 deletions
|
@ -24,3 +24,16 @@ repos:
|
||||||
rev: v0.3.1
|
rev: v0.3.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: prevent-literal-http-methods
|
- id: prevent-literal-http-methods
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: eslint
|
||||||
|
name: eslint
|
||||||
|
entry: .pre-commit-eslint.sh
|
||||||
|
language: system
|
||||||
|
types_or: [ts, tsx]
|
||||||
|
- id: typescript
|
||||||
|
name: typescript
|
||||||
|
entry: .pre-commit-tsc.sh
|
||||||
|
language: system
|
||||||
|
types_or: [ts, tsx]
|
||||||
|
|
6
.pre-commit-eslint.sh
Executable file
6
.pre-commit-eslint.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
cd web > /dev/null
|
||||||
|
if [[ -f "./node_modules/.bin/eslint" ]]; then
|
||||||
|
ARGS=("$@")
|
||||||
|
eslint ${ARGS[@]/#web\// }
|
||||||
|
fi
|
5
.pre-commit-tsc.sh
Executable file
5
.pre-commit-tsc.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
cd web > /dev/null
|
||||||
|
if [[ -f "./node_modules/.bin/tsc" ]]; then
|
||||||
|
tsc --build --noEmit
|
||||||
|
fi
|
|
@ -13,6 +13,9 @@ export default tseslint.config(
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
ecmaVersion: 2023,
|
ecmaVersion: 2023,
|
||||||
globals: globals.browser,
|
globals: globals.browser,
|
||||||
|
parserOptions: {
|
||||||
|
warnOnUnsupportedTypeScriptVersion: false,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
"react-hooks": reactHooks,
|
"react-hooks": reactHooks,
|
||||||
|
|
|
@ -189,7 +189,7 @@ export const sanitizeHtmlParams: sanitizeHtml.IOptions = {
|
||||||
// custom ones first:
|
// custom ones first:
|
||||||
font: ["color", "data-mx-bg-color", "data-mx-color", "style"], // custom to matrix
|
font: ["color", "data-mx-bg-color", "data-mx-color", "style"], // custom to matrix
|
||||||
span: [
|
span: [
|
||||||
"data-mx-maths", "data-mx-bg-color", "data-mx-color", "data-mx-spoiler", "style", "title"
|
"data-mx-maths", "data-mx-bg-color", "data-mx-color", "data-mx-spoiler", "style", "title",
|
||||||
], // custom to matrix
|
], // custom to matrix
|
||||||
div: ["data-mx-maths"],
|
div: ["data-mx-maths"],
|
||||||
// eslint-disable-next-line id-length
|
// eslint-disable-next-line id-length
|
||||||
|
|
Loading…
Add table
Reference in a new issue