feat: add code style (#242)

This commit is contained in:
Joel 2023-05-29 17:49:01 +08:00 committed by GitHub
parent 408fb502a1
commit 091beffae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 8 deletions

1
.gitignore vendored
View File

@ -130,7 +130,6 @@ dmypy.json
.idea/' .idea/'
.DS_Store .DS_Store
.vscode
# Intellij IDEA Files # Intellij IDEA Files
.idea/ .idea/

7
web/.eslintignore Normal file
View File

@ -0,0 +1,7 @@
/**/node_modules/*
node_modules/
dist/
build/
out/
.next/

View File

@ -23,6 +23,6 @@
] ]
} }
], ],
"react-hooks/exhaustive-deps": "warning" "react-hooks/exhaustive-deps": "warn"
} }
} }

4
web/.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
cd ./web && npx lint-staged

23
web/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,23 @@
{
"prettier.enable": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.format.enable": true,
"[python]": {
"editor.formatOnType": true
},
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[javascriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
}
}

View File

@ -7,7 +7,9 @@
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
"fix": "next lint --fix" "fix": "next lint --fix",
"eslint-fix": "eslint --fix",
"prepare": "cd ../ && husky install ./web/.husky"
}, },
"dependencies": { "dependencies": {
"@emoji-mart/data": "^1.1.2", "@emoji-mart/data": "^1.1.2",
@ -78,8 +80,18 @@
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"autoprefixer": "^10.4.14", "autoprefixer": "^10.4.14",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.2",
"miragejs": "^0.1.47", "miragejs": "^0.1.47",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"tailwindcss": "^3.2.7" "tailwindcss": "^3.2.7"
},
"lint-staged": {
"**/*.js?(x)": [
"eslint --fix"
],
"**/*.ts?(x)": [
"eslint --fix"
]
} }
} }