da350cb1cb
- 添加前端还原技能、截图比较工具和可复现测试 - 添加技能副本同步脚本及回归测试 - 补充提交前 SSH 配置与远程连通性检查 - 删除旧 CLI 指南并清理失效的 ESLint 配置 - 忽略 Python 缓存、虚拟环境和本地工具配置
71 lines
2.6 KiB
JavaScript
71 lines
2.6 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
env: { browser: true, es2021: true, node: true },
|
|
parserOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
ecmaFeatures: { jsx: true },
|
|
},
|
|
settings: {
|
|
react: { version: 'detect' },
|
|
},
|
|
plugins: ['header', 'react-hooks', 'react', 'unused-imports'],
|
|
ignorePatterns: ['dist/**', 'node_modules/**'],
|
|
overrides: [
|
|
{
|
|
files: ['**/*.{js,jsx}'],
|
|
rules: {
|
|
'header/header': [
|
|
2,
|
|
'block',
|
|
[
|
|
'',
|
|
'Copyright (C) 2025 QuantumNous',
|
|
'',
|
|
'This program is free software: you can redistribute it and/or modify',
|
|
'it under the terms of the GNU Affero General Public License as',
|
|
'published by the Free Software Foundation, either version 3 of the',
|
|
'License, or (at your option) any later version.',
|
|
'',
|
|
'This program is distributed in the hope that it will be useful,',
|
|
'but WITHOUT ANY WARRANTY; without even the implied warranty of',
|
|
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the',
|
|
'GNU Affero General Public License for more details.',
|
|
'',
|
|
'You should have received a copy of the GNU Affero General Public License',
|
|
'along with this program. If not, see <https://www.gnu.org/licenses/>.',
|
|
'',
|
|
'For commercial licensing, please contact support@quantumnous.com',
|
|
'',
|
|
],
|
|
],
|
|
'no-multiple-empty-lines': ['error', { max: 1 }],
|
|
|
|
// ===== 防线:杜绝“用了未定义/未导入标识符”导致的运行时崩溃(本次线上事故根因)=====
|
|
// 让规则识别 JSX 中使用到的组件/React,避免误报。
|
|
'react/jsx-uses-vars': 'error',
|
|
'react/jsx-uses-react': 'error',
|
|
// 未定义标识符 = 直接报错(构建/CI 即拦截)。
|
|
'no-undef': 'error',
|
|
// 未使用的 import = error 且可 --fix 自动移除(含 JSX/副作用识别);
|
|
// 未使用的变量 = warn(不阻断,下划线前缀豁免)。
|
|
'no-unused-vars': 'off',
|
|
'unused-imports/no-unused-imports': 'error',
|
|
'unused-imports/no-unused-vars': [
|
|
'warn',
|
|
{
|
|
vars: 'all',
|
|
varsIgnorePattern: '^_',
|
|
args: 'none',
|
|
argsIgnorePattern: '^_',
|
|
ignoreRestSiblings: true,
|
|
},
|
|
],
|
|
// React Hooks 规则。
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
},
|
|
},
|
|
],
|
|
};
|