浏览代码

基础项目初始化完成

yuanmingze 8 月之前
父节点
当前提交
7681d5d9e0
共有 8 个文件被更改,包括 718 次插入16 次删除
  1. 8 0
      .editorconfig
  2. 17 0
      .eslintignore
  3. 67 0
      .eslintrc.cjs
  4. 1 0
      .gitattributes
  5. 8 0
      .prettierrc.json
  6. 22 0
      .vscode/settings.json
  7. 9 1
      package.json
  8. 586 15
      pnpm-lock.yaml

+ 8 - 0
.editorconfig

@@ -0,0 +1,8 @@
+[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
+charset = utf-8
+indent_size = 2
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+end_of_line = lf
+max_line_length = 100

+ 17 - 0
.eslintignore

@@ -0,0 +1,17 @@
+
+*.sh
+node_modules
+*.md
+*.woff
+*.ttf
+.vscode
+.idea
+dist
+/public
+/docs
+.husky
+.local
+/bin
+Dockerfile
+.npmrc
+vite.config.ts

+ 67 - 0
.eslintrc.cjs

@@ -0,0 +1,67 @@
+// .eslintrc.cjs
+module.exports = {
+  root: true,
+  env: {
+    node: true,
+    es2021: true,
+  },
+  globals: {
+    uni: 'readonly',
+    wx: 'readonly',
+    my: 'readonly',
+    plus: 'readonly', // App Plus
+    getApp: 'readonly',
+    getCurrentPages: 'readonly',
+  },
+
+  parser: 'vue-eslint-parser',
+
+  parserOptions: {
+    parser: '@typescript-eslint/parser',
+    ecmaVersion: 'latest',
+    sourceType: 'module',
+    extraFileExtensions: ['.vue'],
+  },
+
+  plugins: ['vue', '@typescript-eslint', 'simple-import-sort'],
+
+  extends: [
+    'eslint:recommended',
+    'plugin:vue/vue3-essential',
+    'plugin:@typescript-eslint/recommended',
+    'prettier',
+  ],
+
+  ignorePatterns: ['dist/', 'dist-ssr/', 'coverage/', 'node_modules/'],
+
+  rules: {
+    /* ========= Vue ========= */
+    'vue/multi-word-component-names': 'off',
+
+    /* ========= TypeScript ========= */
+    '@typescript-eslint/no-explicit-any': 'off',
+    '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
+
+    /* ========= Import Sort ========= */
+    'simple-import-sort/imports': [
+      'error',
+      {
+        groups: [
+          // 1. Vue 核心
+          ['^vue$', '^vue-router'],
+          // 2. 第三方库
+          ['^@?\\w'],
+          // 3. 项目内部 - services
+          ['^@/services/.*/index$', '^@/services(?!/.*/type)', '^@/services/.*/type'],
+          // 4. 项目内部 - 其他模块
+          ['^@/(hooks|utils|stores|router|config|constants|types|icons|layout)'],
+          // 5. 相对路径
+          ['^\\.'],
+          // 6. 样式
+          ['^.+\\.s?css$'],
+        ],
+      },
+    ],
+    'simple-import-sort/exports': 'error',
+  },
+}

+ 1 - 0
.gitattributes

@@ -0,0 +1 @@
+* text=auto eol=lf

+ 8 - 0
.prettierrc.json

@@ -0,0 +1,8 @@
+{
+  "$schema": "https://json.schemastore.org/prettierrc",
+  "semi": false,
+  "singleQuote": true,
+  "printWidth": 100,
+  "trailingComma": "es5",
+  "tabWidth": 2
+}

+ 22 - 0
.vscode/settings.json

@@ -0,0 +1,22 @@
+{
+  /* ========== TypeScript ========= */
+  "typescript.tsdk": "node_modules/typescript/lib",
+  "typescript.enablePromptUseWorkspaceTsdk": true,
+
+  /* ========== 保存行为 ========= */
+  "editor.formatOnSave": true,
+
+  /* ========== 默认格式化器 ========= */
+  "editor.defaultFormatter": "esbenp.prettier-vscode",
+
+  /* ========== ESLint 参与格式化 ========= */
+  "editor.codeActionsOnSave": {
+    "source.fixAll.eslint": true
+  },
+
+  /* ========== ESLint 生效文件 ========= */
+  "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue"],
+
+  /* ========== Prettier 配合 ESLint ========= */
+  "prettier.requireConfig": true
+}

+ 9 - 1
package.json

@@ -62,8 +62,16 @@
     "@dcloudio/uni-cli-shared": "3.0.0-4080420251103001",
     "@dcloudio/uni-cli-shared": "3.0.0-4080420251103001",
     "@dcloudio/uni-stacktracey": "3.0.0-4080420251103001",
     "@dcloudio/uni-stacktracey": "3.0.0-4080420251103001",
     "@dcloudio/vite-plugin-uni": "3.0.0-4080420251103001",
     "@dcloudio/vite-plugin-uni": "3.0.0-4080420251103001",
-    "@vue/tsconfig": "^0.1.3",
+    "@typescript-eslint/eslint-plugin": "^8.52.0",
+    "@typescript-eslint/parser": "^8.52.0",
     "@vue/runtime-core": "^3.4.21",
     "@vue/runtime-core": "^3.4.21",
+    "@vue/tsconfig": "^0.1.3",
+    "eslint": "^8.57.1",
+    "eslint-config-prettier": "^10.1.8",
+    "eslint-plugin-simple-import-sort": "^12.1.1",
+    "eslint-plugin-vue": "^10.6.2",
+    "prettier": "^3.7.4",
+    "sass": "^1.97.2",
     "typescript": "^4.9.4",
     "typescript": "^4.9.4",
     "vite": "5.2.8",
     "vite": "5.2.8",
     "vue-tsc": "^1.0.24"
     "vue-tsc": "^1.0.24"

文件差异内容过多而无法显示
+ 586 - 15
pnpm-lock.yaml


部分文件因为文件数量过多而无法显示