Skip to content

Commit afb77d2

Browse files
authored
chore: coding style setup (#530)
1 parent ce2e1b9 commit afb77d2

File tree

13 files changed

+273
-116
lines changed

13 files changed

+273
-116
lines changed

.devcontainer/devcontainer.json

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
11
{
2-
"name": "PublicCodeEditor",
3-
"dockerFile": "Dockerfile",
4-
"runArgs": [
5-
"--name",
6-
"PublicCodeEditor_devcontainer"
7-
],
8-
"postCreateCommand": "sh .devcontainer/postCreateCommand.sh",
9-
"customizations": {
10-
"vscode": {
11-
"settings": {
12-
"editor.formatOnSave": true,
13-
"editor.codeActionsOnSave": {
14-
"source.organizeImports": "always"
15-
},
16-
"[typescript]": {
17-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
18-
},
19-
"[go]": {
20-
"editor.insertSpaces": false,
21-
"editor.formatOnSave": true,
22-
"editor.codeActionsOnSave": {
23-
"source.organizeImports": "always"
24-
}
25-
}
26-
},
27-
"extensions": [
28-
"dbaeumer.vscode-eslint",
29-
"github.vscode-pull-request-github",
30-
"github.vscode-github-actions",
31-
"golang.go",
32-
"firsttris.vscode-jest-runner",
33-
"waderyan.gitblame"
34-
]
35-
}
36-
},
37-
"remoteUser": "root"
38-
}
2+
"name": "PublicCodeEditor",
3+
"dockerFile": "Dockerfile",
4+
"runArgs": ["--name", "PublicCodeEditor_devcontainer"],
5+
"postCreateCommand": "sh .devcontainer/postCreateCommand.sh",
6+
"customizations": {
7+
"vscode": {
8+
"settings": {
9+
"editor.formatOnSave": true,
10+
"editor.codeActionsOnSave": {
11+
"source.organizeImports": "always"
12+
},
13+
"editor.defaultFormatter": "esbenp.prettier-vscode",
14+
"[go]": {
15+
"editor.insertSpaces": false,
16+
"editor.formatOnSave": true,
17+
"editor.codeActionsOnSave": {
18+
"source.organizeImports": "always"
19+
}
20+
}
21+
},
22+
"extensions": [
23+
"dbaeumer.vscode-eslint",
24+
"esbenp.prettier-vscode",
25+
"github.vscode-pull-request-github",
26+
"github.vscode-github-actions",
27+
"golang.go",
28+
"firsttris.vscode-jest-runner",
29+
"waderyan.gitblame"
30+
]
31+
}
32+
}
33+
}

.devcontainer/githooks/pre-push

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
echo "Git pre-push hook"
44
echo "Run Build"
55
npm run build
6+
echo "Run Lint"
7+
npm run lint
68
echo "Run Test"
79
npm run test

.eslintrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ extends:
66
- plugin:@typescript-eslint/recommended
77
- plugin:react/recommended
88
- plugin:react/jsx-runtime
9+
- prettier
910
parser: "@typescript-eslint/parser"
1011
parserOptions:
1112
ecmaVersion: latest
1213
sourceType: module
1314
plugins:
1415
- "@typescript-eslint"
1516
- react
17+
- prettier
1618
rules:
1719
react/prop-types: off
1820
settings:

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ jobs:
1313
go-version: '1.23.9'
1414
- run: npm ci
1515
- run: npm run build
16+
- run: npm run lint
1617
- run: npm run test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dist-ssr
1414

1515
# Editor directories and files
1616
.vscode/*
17+
!.vscode/settings.json
1718
!.vscode/extensions.json
1819
.idea
1920
.DS_Store

.vscode/extensions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"github.vscode-pull-request-github",
6+
"github.vscode-github-actions",
7+
"golang.go",
8+
"firsttris.vscode-jest-runner",
9+
"waderyan.gitblame"
10+
]
11+
}

.vscode/settings.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.codeActionsOnSave": {
4+
"source.organizeImports": "always"
5+
},
6+
"editor.defaultFormatter": "esbenp.prettier-vscode",
7+
"[go]": {
8+
"editor.insertSpaces": false,
9+
"editor.formatOnSave": true,
10+
"editor.codeActionsOnSave": {
11+
"source.organizeImports": "always"
12+
}
13+
}
14+
}

package-lock.json

Lines changed: 115 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"build:licenses": "mkdir -p src/generated && tsx scripts/genLicenseList.ts src/generated/licenses.json",
1616
"build:wasm": "cp \"$(go env GOROOT)/misc/wasm/wasm_exec.js\" public && GOOS=js GOARCH=wasm go build -o public/main.wasm src/wasm/main.go",
1717
"serve": "rm -rf dist; npm run build && http-server dist",
18+
"format": "prettier --write 'src/**/*.{ts,tsx,scss,css,json}' ",
1819
"test": "jest --passWithNoTests",
1920
"deploy": "gh-pages -u 'Deploy Bot <[email protected]>' -d dist",
2021
"release": "release-it",
@@ -88,13 +89,16 @@
8889
"@typescript-eslint/parser": "^8.11.0",
8990
"@vitejs/plugin-react": "^4.3.4",
9091
"eslint": "^9.13.0",
92+
"eslint-config-prettier": "^10.1.8",
93+
"eslint-plugin-prettier": "^5.5.4",
9194
"eslint-plugin-react": "^7.37.2",
9295
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
9396
"eslint-plugin-react-refresh": "^0.4.13",
9497
"gh-pages": "^5.0.0",
9598
"globals": "^15.9.0",
9699
"jest": "^26.6.3",
97100
"node-fetch": "^3.3.2",
101+
"prettier": "^3.6.2",
98102
"release-it": "^19.0.4",
99103
"swc-loader": "^0.2.3",
100104
"ts-node": "^10.9.1",
@@ -103,4 +107,4 @@
103107
"typescript-eslint": "^8.11.0",
104108
"vite": "^6.4.1"
105109
}
106-
}
110+
}

0 commit comments

Comments
 (0)