// eslint.config.mjs import eslint from '@eslint/js'; import tseslint from 'typescript-eslint'; import prettier from 'eslint-plugin-prettier'; import prettierConfig from 'eslint-config-prettier'; import globals from "globals"; export default tseslint.config( // 基础 ESLint 推荐规则 eslint.configs.recommended, // TypeScript 推荐规则 ...tseslint.configs.recommended, // TypeScript 风格规则(可选) ...tseslint.configs.stylistic, // Prettier 配置 prettierConfig, { ignores: ['babel.config.js', 'node_modules/', 'postcss.config.js', 'tailwind.config.js','**/app.config.ts'], }, { files: ['**/*.ts', '**/*.tsx'], plugins: { prettier, '@typescript-eslint': tseslint.plugin, // 使用 tseslint.plugin }, languageOptions: { parser: tseslint.parser, // 使用 TypeScript 解析器 parserOptions: { ecmaVersion: 2021, sourceType: 'module', project: ['./tsconfig.json'], // 指向 tsconfig.json(如果需要类型感知) tsconfigRootDir: import.meta.dirname, }, globals: { ...globals.browser, ...globals.node, "React": "readonly", "module": "readonly", "definePageConfig": "readonly", } }, rules: { 'prettier/prettier': 'error', 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': ['error'], '@typescript-eslint/explicit-function-return-type': 'warn', } } );