refactor: 重构数据库配置为SQLite开发环境并移除冗余文档
This commit is contained in:
131
mini_program/.eslintrc.js
Normal file
131
mini_program/.eslintrc.js
Normal file
@@ -0,0 +1,131 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
node: true,
|
||||
'vue/setup-compiler-macros': true
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'@vue/eslint-config-typescript/recommended',
|
||||
'plugin:vue/vue3-recommended',
|
||||
'plugin:prettier/recommended'
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2021,
|
||||
parser: '@typescript-eslint/parser',
|
||||
sourceType: 'module'
|
||||
},
|
||||
plugins: [
|
||||
'vue',
|
||||
'@typescript-eslint'
|
||||
],
|
||||
rules: {
|
||||
// Vue 相关规则
|
||||
'vue/multi-word-component-names': 'off',
|
||||
'vue/no-v-html': 'off',
|
||||
'vue/require-default-prop': 'off',
|
||||
'vue/require-explicit-emits': 'off',
|
||||
'vue/html-self-closing': ['error', {
|
||||
'html': {
|
||||
'void': 'always',
|
||||
'normal': 'always',
|
||||
'component': 'always'
|
||||
},
|
||||
'svg': 'always',
|
||||
'math': 'always'
|
||||
}],
|
||||
|
||||
// TypeScript 相关规则
|
||||
'@typescript-eslint/no-unused-vars': ['error', {
|
||||
'argsIgnorePattern': '^_',
|
||||
'varsIgnorePattern': '^_'
|
||||
}],
|
||||
'@typescript-eslint/no-explicit-any': 'warn',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
|
||||
// JavaScript 相关规则
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-unused-vars': 'off', // 使用 TypeScript 规则替代
|
||||
'prefer-const': 'error',
|
||||
'no-var': 'error',
|
||||
'object-shorthand': 'error',
|
||||
'prefer-template': 'error',
|
||||
|
||||
// 代码风格
|
||||
'indent': ['error', 2, { 'SwitchCase': 1 }],
|
||||
'quotes': ['error', 'single'],
|
||||
'semi': ['error', 'never'],
|
||||
'comma-dangle': ['error', 'never'],
|
||||
'eol-last': ['error', 'always'],
|
||||
'no-trailing-spaces': 'error',
|
||||
'space-before-function-paren': ['error', {
|
||||
'anonymous': 'always',
|
||||
'named': 'never',
|
||||
'asyncArrow': 'always'
|
||||
}],
|
||||
|
||||
// 最佳实践
|
||||
'eqeqeq': ['error', 'always'],
|
||||
'curly': ['error', 'all'],
|
||||
'no-eval': 'error',
|
||||
'no-implied-eval': 'error',
|
||||
'no-new-func': 'error',
|
||||
'no-script-url': 'error',
|
||||
'no-self-compare': 'error',
|
||||
'no-sequences': 'error',
|
||||
'no-throw-literal': 'error',
|
||||
'no-unused-expressions': 'error',
|
||||
'no-useless-call': 'error',
|
||||
'no-useless-concat': 'error',
|
||||
'no-void': 'error',
|
||||
'radix': 'error',
|
||||
'wrap-iife': ['error', 'inside']
|
||||
},
|
||||
globals: {
|
||||
// uni-app 全局变量
|
||||
'uni': 'readonly',
|
||||
'wx': 'readonly',
|
||||
'getCurrentPages': 'readonly',
|
||||
'getApp': 'readonly',
|
||||
'App': 'readonly',
|
||||
'Page': 'readonly',
|
||||
'Component': 'readonly',
|
||||
'Behavior': 'readonly',
|
||||
'plus': 'readonly',
|
||||
|
||||
// 小程序全局变量
|
||||
'my': 'readonly',
|
||||
'swan': 'readonly',
|
||||
'tt': 'readonly',
|
||||
'qq': 'readonly',
|
||||
'jd': 'readonly',
|
||||
'ks': 'readonly',
|
||||
|
||||
// 构建工具变量
|
||||
'process': 'readonly',
|
||||
'__dirname': 'readonly',
|
||||
'__filename': 'readonly',
|
||||
'module': 'readonly',
|
||||
'require': 'readonly',
|
||||
'exports': 'readonly'
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.vue'],
|
||||
rules: {
|
||||
'indent': 'off'
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ['*.js'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-var-requires': 'off'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user