chore(buyer): 落地 ESLint 9 并清理调试代码

- 新增 eslint.config.js(flat config, vue3-essential),移除废弃的 .eslintrc.js/.eslintignore(引用已废弃的 babel-eslint),package.json 增加 lint/lint:fix 脚本
- 清理 17 处调试 console.log;修复 24 处空 catch(15 处补 console.warn 业务提示,9 处加注释说明可安全忽略)
- 修复存量 lint error:9 处 prop 默认值改为函数形式、3 处未使用组件、1 处 v-if/v-for 同级、1 处空 else
- vue.config.js 生产环境 terser 开启 drop_console 兜底
This commit is contained in:
pikachu1995@126.com
2026-10-09 09:45:59 +08:00
parent 3ec3f11d5b
commit 89711af0e6
40 changed files with 630 additions and 98 deletions

34
buyer/eslint.config.js Normal file
View File

@@ -0,0 +1,34 @@
const globals = require('globals')
const pluginVue = require('eslint-plugin-vue')
module.exports = [
{
ignores: [
'dist/**',
'node_modules/**',
'build/**',
'config/**',
'src/scripts/**', // 一次性迁移脚本,不参与 lint
],
},
...pluginVue.configs['flat/essential'],
{
files: ['src/**/*.{js,vue}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
},
},
rules: {
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-empty': ['error', { allowEmptyCatch: false }],
'vue/no-parsing-error': ['error', { 'x-invalid-end-tag': false }],
// 页面组件通过路由按文件路径引用,组件名不参与解析,存量单词组件名不再强制多词
'vue/multi-word-component-names': 'off',
// 存量代码大量使用与 HTML 保留名同名的组件(element-plus 图标 Search/View/Camera/Link 及全局注册的 empty/drawer 等),重命名成本高,暂不启用
'vue/no-reserved-component-names': 'off',
},
},
]