Просмотр исходного кода

chore: 更新 lint 配置和忽略文件

- 添加 .eslintignore 文件并配置忽略规则
- 更新 .oxlintrc.json 的 ignorePatterns 配置
- 简化 package.json 中的 lint 命令
- 调整 .vscode/settings.json 的文件关联
feige996 10 месяцев назад
Родитель
Сommit
a79e59cdf3
5 измененных файлов с 14 добавлено и 4 удалено
  1. 4 0
      .eslintignore
  2. 1 1
      .oxlintrc.json
  3. 1 1
      .vscode/settings.json
  4. 2 2
      package.json
  5. 6 0
      src/pages/about/about.vue

+ 4 - 0
.eslintignore

@@ -0,0 +1,4 @@
+vite.config.ts
+uno.config.ts
+pages.config.ts
+manifest.config.ts

+ 1 - 1
.oxlintrc.json

@@ -12,7 +12,7 @@
   "globals": {
   "globals": {
     "foo": "readonly"
     "foo": "readonly"
   },
   },
-  "ignorePatterns": ["src/static/**", "src/uni_modules/**"],
+  "ignorePatterns": ["node_modules", "dist", "src/static/**", "src/uni_modules/**"],
   "settings": {},
   "settings": {},
   "overrides": [
   "overrides": [
     {
     {

+ 1 - 1
.vscode/settings.json

@@ -60,6 +60,6 @@
     "README.md": "index.html,favicon.ico,robots.txt,CHANGELOG.md",
     "README.md": "index.html,favicon.ico,robots.txt,CHANGELOG.md",
     "pages.config.ts": "manifest.config.ts,openapi-ts-request.config.ts",
     "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",
     "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*"
   }
   }
 }
 }

+ 2 - 2
package.json

@@ -71,8 +71,8 @@
     "type-check": "vue-tsc --noEmit",
     "type-check": "vue-tsc --noEmit",
     "openapi-ts-request": "openapi-ts",
     "openapi-ts-request": "openapi-ts",
     "prepare": "git init && husky",
     "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": {
   "lint-staged": {
     "**/*.{html,cjs,json,md,scss,css,txt}": [
     "**/*.{html,cjs,json,md,scss,css,txt}": [

+ 6 - 0
src/pages/about/about.vue

@@ -37,6 +37,12 @@ const toSubPage = () => {
     url: '/pages-sub/demo/index',
     url: '/pages-sub/demo/index',
   })
   })
 }
 }
+
+// 奇怪:同样的代码放在 vue 里面不会校验到错误,放在 .ts 文件里面会校验到错误
+// const testOxlint = (name: string) => {
+//   console.log('oxlint')
+// }
+// testOxlint('oxlint')
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>