From 305ac6dccdca57e6b096891c3ffdbfb8ddd415c7 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Fri, 13 Jun 2025 17:28:51 +0800 Subject: [PATCH 1/5] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0oxlint=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=B9=B6=E6=9B=B4=E6=96=B0prettier=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加.oxlintrc.json配置文件以启用oxlint检查,并更新.prettierrc.cjs以支持jsonc文件格式。同时在useUpload.ts中恢复accept参数的默认值。 --- .oxlintrc.json | 11 +++++++++++ .prettierrc.cjs | 2 +- src/hooks/useUpload.ts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .oxlintrc.json diff --git a/.oxlintrc.json b/.oxlintrc.json new file mode 100644 index 0000000..fd48a0e --- /dev/null +++ b/.oxlintrc.json @@ -0,0 +1,11 @@ +{ + "extends": ["@oxlint/recommended"], + "rules": { + "no-console": "off", + "no-unused-vars": "off" + }, + "files": ["src/**/*.{js,ts,vue}"], + "vue": { + "enabled": true + } +} diff --git a/.prettierrc.cjs b/.prettierrc.cjs index 3986355..448279e 100644 --- a/.prettierrc.cjs +++ b/.prettierrc.cjs @@ -10,7 +10,7 @@ module.exports = { htmlWhitespaceSensitivity: 'ignore', overrides: [ { - files: '*.json', + files: '*.{json,jsonc}', options: { trailingComma: 'none', }, diff --git a/src/hooks/useUpload.ts b/src/hooks/useUpload.ts index d0936de..a3edb3b 100644 --- a/src/hooks/useUpload.ts +++ b/src/hooks/useUpload.ts @@ -20,7 +20,7 @@ export default function useUpload(options: TOptions = {} const { formData = {}, maxSize = 5 * 1024 * 1024, - // accept = ['*'], + accept = ['*'], fileType = 'image', success, error: onError, From fc7d30c5105da793c1686d75066a7ff4227ff94e Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Fri, 13 Jun 2025 17:52:04 +0800 Subject: [PATCH 2/5] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20oxlint=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=B9=B6=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 扩展 oxlint 配置,添加更多文件类型支持并引入插件 添加 lint:oxlint-fix 命令以支持自动修复 --- .oxlintrc.json | 23 ++++++++++++++++++----- package.json | 5 +++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index fd48a0e..9d5cf99 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -1,11 +1,24 @@ { - "extends": ["@oxlint/recommended"], + "$schema": "./node_modules/oxlint/configuration_schema.json", + "extends": ["config:recommended"], + "plugins": ["import", "typescript", "unicorn"], "rules": { "no-console": "off", "no-unused-vars": "off" }, - "files": ["src/**/*.{js,ts,vue}"], - "vue": { - "enabled": true - } + "env": { + "es6": true + }, + "globals": { + "foo": "readonly" + }, + "settings": {}, + "overrides": [ + { + "files": ["*.test.ts", "*.spec.ts"], + "rules": { + "@typescript-eslint/no-explicit-any": "off" + } + } + ] } diff --git a/package.json b/package.json index 624c305..3fd81cb 100644 --- a/package.json +++ b/package.json @@ -71,13 +71,14 @@ "type-check": "vue-tsc --noEmit", "openapi-ts-request": "openapi-ts", "prepare": "git init && husky", - "lint:oxlint": "oxlint src/**/*.{ts,js,vue}" + "lint:oxlint": "oxlint src/**/*.{ts,js,vue}", + "lint:oxlint-fix": "oxlint --fix src/**/*.{ts,js,vue}" }, "lint-staged": { "**/*.{html,cjs,json,md,scss,css,txt}": [ "prettier --write --cache" ], - "**/*.{js,ts,vue}": [ + "**/*.{js,jsx,ts,tsx,vue,mjs,cjs,mts,cts}": [ "oxlint --fix", "prettier --write --cache" ], From 24622137c84479cc5d660a4a4c935c2dad52e993 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Fri, 13 Jun 2025 17:56:51 +0800 Subject: [PATCH 3/5] =?UTF-8?q?chore(oxlint):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E6=A8=A1=E5=BC=8F=E5=88=B0oxlint=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .oxlintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.oxlintrc.json b/.oxlintrc.json index 9d5cf99..5d34bc4 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -12,6 +12,7 @@ "globals": { "foo": "readonly" }, + "ignorePatterns": ["src/static/**", "src/uni_modules/**"], "settings": {}, "overrides": [ { From a79e59cdf3d7e9ffa988008657552a9f95fab5d9 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Fri, 13 Jun 2025 18:28:58 +0800 Subject: [PATCH 4/5] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=20lint=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=92=8C=E5=BF=BD=E7=95=A5=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 .eslintignore 文件并配置忽略规则 - 更新 .oxlintrc.json 的 ignorePatterns 配置 - 简化 package.json 中的 lint 命令 - 调整 .vscode/settings.json 的文件关联 --- .eslintignore | 4 ++++ .oxlintrc.json | 2 +- .vscode/settings.json | 2 +- package.json | 4 ++-- src/pages/about/about.vue | 6 ++++++ 5 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..9f68e8c --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +vite.config.ts +uno.config.ts +pages.config.ts +manifest.config.ts diff --git a/.oxlintrc.json b/.oxlintrc.json index 5d34bc4..be6932b 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -12,7 +12,7 @@ "globals": { "foo": "readonly" }, - "ignorePatterns": ["src/static/**", "src/uni_modules/**"], + "ignorePatterns": ["node_modules", "dist", "src/static/**", "src/uni_modules/**"], "settings": {}, "overrides": [ { diff --git a/.vscode/settings.json b/.vscode/settings.json index 0c91bbd..c34fadb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -60,6 +60,6 @@ "README.md": "index.html,favicon.ico,robots.txt,CHANGELOG.md", "pages.config.ts": "manifest.config.ts,openapi-ts-request.config.ts", "package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,.npmrc,.browserslistrc", - "tsconfig.json": ".commitlintrc.*,.prettier*,.editorconfig,.commitlint.cjs" + ".oxlintrc.json": "tsconfig.json,.commitlintrc.*,.prettier*,.editorconfig,.commitlint.cjs,.eslint*" } } diff --git a/package.json b/package.json index 3fd81cb..e7f9714 100644 --- a/package.json +++ b/package.json @@ -71,8 +71,8 @@ "type-check": "vue-tsc --noEmit", "openapi-ts-request": "openapi-ts", "prepare": "git init && husky", - "lint:oxlint": "oxlint src/**/*.{ts,js,vue}", - "lint:oxlint-fix": "oxlint --fix src/**/*.{ts,js,vue}" + "lint": "oxlint", + "lint-fix": "oxlint --fix" }, "lint-staged": { "**/*.{html,cjs,json,md,scss,css,txt}": [ diff --git a/src/pages/about/about.vue b/src/pages/about/about.vue index 351623d..30e39e4 100644 --- a/src/pages/about/about.vue +++ b/src/pages/about/about.vue @@ -37,6 +37,12 @@ const toSubPage = () => { url: '/pages-sub/demo/index', }) } + +// 奇怪:同样的代码放在 vue 里面不会校验到错误,放在 .ts 文件里面会校验到错误 +// const testOxlint = (name: string) => { +// console.log('oxlint') +// } +// testOxlint('oxlint')