/* eslint-env node */ module.exports = { root: true, env: { browser: true, es2021: true, node: true, }, parser: '@typescript-eslint/parser', extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react/recommended', 'plugin:jsx-a11y/recommended', 'plugin:react-hooks/recommended', 'plugin:prettier/recommended', 'eslint-config-prettier', ], parserOptions: { ecmaFeatures: { jsx: true, }, ecmaVersion: 'latest', sourceType: 'module', parser: '@typescript-eslint/parser', }, plugins: [ 'react-refresh', 'react', 'jsx-a11y', 'react-hooks', 'unused-imports', '@typescript-eslint', 'prettier', ], rules: { 'unused-imports/no-unused-imports': 'error', 'react/prop-types': 'off', // 可选的,如果您不使用PropTypes,可以禁用此规则 'react/react-in-jsx-scope': 'off', // 在React 17+中不需要引入React 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', 'jsx-a11y/anchor-is-valid': [ 'error', { components: ['Link'], specialLink: ['hrefLeft', 'hrefRight'], aspects: ['invalidHref', 'preferButton'], }, ], }, };