refactor(ui-deps): 统一组件依赖审计与回归规则

This commit is contained in:
zhanjunhao
2026-11-20 14:11:11 +08:00
parent 9145ed5834
commit d90319f43a
12 changed files with 217 additions and 104 deletions
+2 -27
View File
@@ -2,6 +2,7 @@ const globals = require('globals');
const react = require('eslint-plugin-react');
const reactHooks = require('eslint-plugin-react-hooks');
const unusedImports = require('eslint-plugin-unused-imports');
const { uiDependencyConfig } = require('./scripts/ui-dependency-policy.cjs');
module.exports = [
{
@@ -17,6 +18,7 @@ module.exports = [
'src/assets/brand-icons/*.js',
],
},
uiDependencyConfig,
{
files: ['**/*.{js,jsx}'],
linterOptions: { reportUnusedDisableDirectives: 'off' },
@@ -33,33 +35,6 @@ module.exports = [
'unused-imports': unusedImports,
},
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: [
'@radix-ui/*',
'@floating-ui/*',
'@lobehub/ui',
'@lobehub/ui/*',
'@lobehub/icons',
'@lobehub/icons/*',
'@douyinfe/semi-*',
'@headlessui/*',
'@mui/*',
'@chakra-ui/*',
'leva',
'leva/*',
'antd-style',
'react-layout-kit',
],
message:
'Use antd public APIs or the audited local brand SVG assets. Preserve legacy components/ui callback contracts.',
},
],
},
],
'no-multiple-empty-lines': ['error', { max: 1 }],
// ===== 防线:杜绝“用了未定义/未导入标识符”导致的运行时崩溃(本次线上事故根因)=====