From ae515cd85e11e7daef54288bd06a3e968f20e515 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Sat, 21 Jun 2025 17:18:35 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=B0=86eslint=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E4=B8=BAoxlint=E5=B9=B6=E6=9B=B4=E6=96=B0vscode=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新package.json中的lint脚本,从eslint改为oxlint 调整.vscode/settings.json中的格式化配置,启用prettier并优化保存时的自动修复行为 --- .vscode/settings.json | 76 +++++++++++++++++++++++-------------------- package.json | 4 +-- 2 files changed, 42 insertions(+), 38 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index bbc6269..8413cd6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,14 +1,7 @@ { // 默认格式化工具选择prettier "editor.defaultFormatter": "esbenp.prettier-vscode", - // // 保存的时候自动格式化 - // "editor.formatOnSave": true, - // //开启自动修复 - // "editor.codeActionsOnSave": { - // "source.fixAll": "explicit", - // "source.fixAll.eslint": "explicit", - // "source.fixAll.stylelint": "explicit" - // }, + // 配置stylelint检查的文件类型范围 "stylelint.validate": ["css", "scss", "vue", "html"], // 与package.json的scripts对应 "stylelint.enable": true, @@ -62,15 +55,26 @@ "package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,.npmrc,.browserslistrc", ".oxlintrc.json": "tsconfig.json,.commitlintrc.*,.prettier*,.editorconfig,.commitlint.cjs,.eslint*" }, + + // 保存的时候自动格式化 + "prettier.enable": true, + "editor.formatOnSave": true, + // 开启自动修复 + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.fixAll.eslint": "explicit", + "source.fixAll.stylelint": "explicit" + }, + // Disable the default formatter, use eslint instead - "prettier.enable": false, - "editor.formatOnSave": false, + // "prettier.enable": false, + // "editor.formatOnSave": false, // Auto fix - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit", - "source.organizeImports": "never" - }, + // "editor.codeActionsOnSave": { + // "source.fixAll.eslint": "explicit", + // "source.organizeImports": "never" + // }, // Silent the stylistic rules in you IDE, but still auto fix them "eslint.rules.customizations": [ @@ -88,27 +92,27 @@ // Enable eslint for all supported languages "eslint.validate": [ - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - "vue", - "html", - "markdown", - "json", - "json5", - "jsonc", - "yaml", - "toml", - "xml", - "gql", - "graphql", - "astro", - "svelte", - "css", - "less", - "scss", - "pcss", - "postcss" + // "javascript", + // "javascriptreact", + // "typescript", + // "typescriptreact", + "vue" + // "html", + // "markdown", + // "json", + // "json5", + // "jsonc", + // "yaml", + // "toml", + // "xml", + // "gql", + // "graphql", + // "astro", + // "svelte", + // "css", + // "less", + // "scss", + // "pcss", + // "postcss" ] } diff --git a/package.json b/package.json index 43bcccb..b78ca3d 100644 --- a/package.json +++ b/package.json @@ -72,8 +72,8 @@ "type-check": "vue-tsc --noEmit", "openapi-ts-request": "openapi-ts", "prepare": "git init && husky", - "lint": "eslint", - "lint:fix": "eslint --fix" + "lint": "oxlint", + "lint:fix": "oxlint --fix" }, "dependencies": { "@dcloudio/uni-app": "3.0.0-4060620250520001",