Files
smart-crop-ui/.eslintrc.cjs
peng f6b253e6ef Squashed 'crop-x-new/' changes from 62f9221..5feb24e
5feb24e 子仓库提交

git-subtree-dir: crop-x-new
git-subtree-split: 5feb24e4e221308e6e146bb0fce87f1fb3e152e8
2025-11-10 10:56:39 +08:00

47 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ESLint配置文件 - 需要通过 .dev-tools-config.json 启用
// 运行 `npm run scripts:enable` 来启用ESLint
const fs = require('fs');
const path = require('path');
// 检查开发工具配置
const configPath = path.join(__dirname, '.dev-tools-config.json');
let eslintEnabled = false;
try {
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
eslintEnabled = config.tools?.eslint?.enabled === true;
} catch (error) {
console.warn('⚠️ 无法读取开发工具配置ESLint将被禁用');
}
// 如果ESLint被禁用返回空配置
if (!eslintEnabled) {
console.log(' ESLint已在配置中被禁用如需启用请运行: npm run scripts:enable');
module.exports = {};
return;
}
// ESLint正常配置
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs', 'node_modules'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
},
};