|
@@ -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',
|
|
|
|
|
+ },
|
|
|
|
|
+}
|