65 lines
1.7 KiB
JavaScript
65 lines
1.7 KiB
JavaScript
|
|
module.exports = {
|
||
|
|
root: true,
|
||
|
|
env: {
|
||
|
|
browser: true,
|
||
|
|
es2021: true,
|
||
|
|
node: true,
|
||
|
|
},
|
||
|
|
extends: [
|
||
|
|
"eslint:recommended",
|
||
|
|
"plugin:react/recommended",
|
||
|
|
"plugin:react-hooks/recommended",
|
||
|
|
"plugin:@typescript-eslint/recommended",
|
||
|
|
"plugin:prettier/recommended", // 这个配置会自动处理大部分冲突
|
||
|
|
],
|
||
|
|
parser: "@typescript-eslint/parser",
|
||
|
|
parserOptions: {
|
||
|
|
ecmaFeatures: {
|
||
|
|
jsx: true,
|
||
|
|
},
|
||
|
|
ecmaVersion: 12,
|
||
|
|
sourceType: "module",
|
||
|
|
},
|
||
|
|
plugins: ["react", "react-hooks", "@typescript-eslint", "prettier"],
|
||
|
|
rules: {
|
||
|
|
"prettier/prettier": "error",
|
||
|
|
"react/react-in-jsx-scope": "off",
|
||
|
|
"@typescript-eslint/no-unused-vars": "warn",
|
||
|
|
"@typescript-eslint/no-explicit-any": "off",
|
||
|
|
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
|
||
|
|
"react/prop-types": "off",
|
||
|
|
"linebreak-style": "off",
|
||
|
|
"eol-last": "off",
|
||
|
|
"no-empty": "warn",
|
||
|
|
"prefer-const": "warn",
|
||
|
|
// 确保与 Prettier 完全兼容
|
||
|
|
"comma-dangle": "off",
|
||
|
|
"comma-spacing": "off",
|
||
|
|
"comma-style": "off",
|
||
|
|
"object-curly-spacing": "off",
|
||
|
|
"array-bracket-spacing": "off",
|
||
|
|
indent: "off",
|
||
|
|
quotes: "off",
|
||
|
|
semi: "off",
|
||
|
|
"arrow-parens": "off",
|
||
|
|
"no-multiple-empty-lines": "off",
|
||
|
|
"max-len": "off",
|
||
|
|
"space-before-function-paren": "off",
|
||
|
|
"space-before-blocks": "off",
|
||
|
|
"keyword-spacing": "off",
|
||
|
|
"space-infix-ops": "off",
|
||
|
|
"space-in-parens": "off",
|
||
|
|
"space-in-brackets": "off",
|
||
|
|
"object-property-newline": "off",
|
||
|
|
"array-element-newline": "off",
|
||
|
|
"function-paren-newline": "off",
|
||
|
|
"object-curly-newline": "off",
|
||
|
|
"array-bracket-newline": "off",
|
||
|
|
},
|
||
|
|
settings: {
|
||
|
|
react: {
|
||
|
|
version: "detect",
|
||
|
|
},
|
||
|
|
},
|
||
|
|
};
|