fix(frontend): prettier config

This commit is contained in:
ryan
2026-07-13 15:04:28 +08:00
parent 85d5c8568c
commit 08e8eea932
7 changed files with 51 additions and 3 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
.PHONY: swagger license license-check build-embedded build-test cross-build code-check build-backend build-frontend build-agent build-relay build-flared build-all
.PHONY: swagger license license-check prettier build-embedded build-test cross-build code-check build-backend build-frontend build-agent build-relay build-flared build-all
VERSION ?= dev
BUILD_DATE ?= $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
@@ -13,6 +13,12 @@ license:
license-check:
scripts/update_go_license.sh --check
prettier:
@echo "==> Formatting backend Go source..."
gofmt -w $$(find . -type f -name '*.go' -not -path './.git/*' -not -path './frontend/*')
@echo "==> Formatting frontend source..."
cd frontend && pnpm format
build-embedded:
@echo "==> Building embedded frontend version=$(VERSION) build_date=$(BUILD_DATE)..."
cd frontend && \
+1
View File
@@ -23,6 +23,7 @@ sidebar: false
### 新增
- 新增 `make prettier`,统一使用 `gofmt` 与项目固定版本的 Prettier 自动格式化前后端源码。
- WAF 规则支持可视化 DAG 编排、版本冲突保护和有序路由绑定,发布时编译为 OpenResty 纯内存运行图。
- WAF IP 组支持 checksum 驱动的 Worker 内存热刷新,并补充 City MMDB 地区匹配数据源。
+9 -1
View File
@@ -40,6 +40,14 @@ GOCACHE=/tmp/openflare-go-cache go test ./...
make code-check
```
自动格式化后端 Go 与前端 TypeScript、JavaScript、CSS 等源码:
```bash
make prettier
```
该命令使用 `gofmt` 格式化后端,并使用项目固定版本的 Prettier 格式化 `frontend/` 源码;构建产物、依赖、公开静态资源和锁文件会被忽略。
## Frontend
开发:
@@ -155,4 +163,4 @@ pnpm dev
```bash
cd docs
pnpm build:embed
```
```
+7
View File
@@ -0,0 +1,7 @@
.next/
node_modules/
out/
coverage/
public/
next-env.d.ts
pnpm-lock.yaml
+14
View File
@@ -0,0 +1,14 @@
{
"semi": true,
"singleQuote": true,
"jsxSingleQuote": true,
"trailingComma": "all",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"endOfLine": "lf",
"proseWrap": "preserve"
}
+3 -1
View File
@@ -9,7 +9,8 @@
"build": "next build",
"build:embed": "NEXT_STANDALONE_EXPORT=true next build",
"start": "next start -p 3010",
"lint": "eslint"
"lint": "eslint",
"format": "prettier --write ."
},
"dependencies": {
"@codemirror/lang-sql": "^6.10.0",
@@ -92,6 +93,7 @@
"eslint": "^9",
"eslint-config-next": "15.5.6",
"jsdom": "^29.1.1",
"prettier": "^3.9.5",
"tailwindcss": "^4",
"tw-animate-css": "^1.4.0",
"typescript": "^5.9.3",
+10
View File
@@ -243,6 +243,9 @@ importers:
jsdom:
specifier: ^29.1.1
version: 29.1.1
prettier:
specifier: ^3.9.5
version: 3.9.5
tailwindcss:
specifier: ^4
version: 4.1.16
@@ -3807,6 +3810,11 @@ packages:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
prettier@3.9.5:
resolution: {integrity: sha512-/FVl766LpUfB5vXgCYOYa0MeV/441Ia99AeICQIQFTY/Nw0roZwULcXpku5i1/m5kt/baz+s4Zogspd839HSMg==}
engines: {node: '>=14'}
hasBin: true
pretty-format@27.5.1:
resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==}
engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0}
@@ -8404,6 +8412,8 @@ snapshots:
prelude-ls@1.2.1: {}
prettier@3.9.5: {}
pretty-format@27.5.1:
dependencies:
ansi-regex: 5.0.1