mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 09:28:53 +08:00
- 清理:删除 4 个未使用依赖、约 2700 行死代码(shop/ossManage 等)、tree-table 死组件、37 处未使用 import - ESLint 9 flat config 升级(.eslintrc.js -> eslint.config.js),修复迁移遗留的 34 处真实 bug - axios 重构:拦截器不再吞错、refreshToken 单例共享 Promise、超时收敛、form 序列化抽公共函数、vue-router 4 失效 API 修正 - 安全:4 处 v-html 增加 xss 过滤;logout 改为精确删除 localStorage 键 - API 重复定义收敛(delSpec/insertOrUpdateSpec、getDictData、ws) - 首屏瘦身:tinymce 懒加载(约省 7.4MB)、core-js 按需 polyfill、vendor chunk 合并、dplayer/@antv/g2 动态 import、3 张大图压缩 - 页面修复:发布商品表单布局(iview 遗留 margin 移除)、beforeVideoUpload 补定义、el-tag type 空值、lili-dialog emits 声明、消息中心布局塌陷修复与样式重构、department-choose 空值、affix-time 不再发多余店铺请求、goods/distributionGoods 去掉品牌筛选
66 lines
2.1 KiB
JavaScript
66 lines
2.1 KiB
JavaScript
const globals = require('globals')
|
||
const js = require('@eslint/js')
|
||
const pluginVue = require('eslint-plugin-vue')
|
||
|
||
module.exports = [
|
||
{
|
||
ignores: [
|
||
'dist/**',
|
||
'node_modules/**',
|
||
'public/**',
|
||
// tree-table 是 JSX 写的旧组件,全项目无引用,待删除,暂不纳入检查
|
||
'src/views/my-components/tree-table/**',
|
||
],
|
||
},
|
||
js.configs.recommended,
|
||
...pluginVue.configs['flat/essential'],
|
||
{
|
||
files: ['src/**/*.{js,vue}'],
|
||
languageOptions: {
|
||
ecmaVersion: 'latest',
|
||
sourceType: 'module',
|
||
globals: {
|
||
...globals.browser,
|
||
// webpack 构建环境注入
|
||
require: 'readonly',
|
||
module: 'writable',
|
||
process: 'readonly',
|
||
// public/config.js 通过 <script> 注入,见 public/index.html
|
||
BASE: 'readonly',
|
||
// 高德地图 loader 动态注入
|
||
AMapUI: 'readonly',
|
||
},
|
||
},
|
||
rules: {
|
||
'no-unused-vars': ['warn', { args: 'none', caughtErrors: 'none', ignoreRestSiblings: true }],
|
||
'no-empty': ['warn', { allowEmptyCatch: true }],
|
||
'no-constant-condition': ['error', { checkLoops: false }],
|
||
'no-console': 'off',
|
||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
|
||
'no-undef': 'error',
|
||
// 存量代码大量使用 ==,先告警,逐步治理
|
||
eqeqeq: ['warn', 'always', { null: 'ignore' }],
|
||
// 项目依赖 v-html 渲染服务端内容,由 xss 过滤兜底,不在此处拦截
|
||
'vue/no-v-html': 'off',
|
||
// 页面组件多为单词命名且被路由引用,改名成本高
|
||
'vue/multi-word-component-names': 'off',
|
||
'vue/no-reserved-component-names': 'off',
|
||
// 存量 49 处直接改 prop,先告警,逐步治理
|
||
'vue/no-mutating-props': 'warn',
|
||
},
|
||
},
|
||
{
|
||
// 根目录构建配置 + scripts 工具:CommonJS + Node
|
||
files: ['*.config.js', 'scripts/**/*.js'],
|
||
languageOptions: {
|
||
sourceType: 'commonjs',
|
||
globals: { ...globals.node },
|
||
},
|
||
rules: {
|
||
// scripts 下是一次性迁移脚本,已执行完毕,不做变量层面的约束
|
||
'no-unused-vars': 'off',
|
||
},
|
||
},
|
||
]
|
||
|