123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- {
- "env": {
- "browser": false,
- "es6": true,
- "node": true
- },
- "parser": "@typescript-eslint/parser",
- "parserOptions": {
- "project": "tsconfig.json",
- "sourceType": "module",
- "ecmaVersion": 2020
- },
- "plugins": ["@typescript-eslint", "prettier", "import"],
- "extends": [
- "prettier",
- "plugin:@typescript-eslint/recommended",
- "plugin:import/recommended",
- "plugin:import/typescript"
- // Uncomment the following lines to enable the recommended rules for type checking.
- // "plugin:@typescript-eslint/recommended-requiring-type-checking",
- ],
- "rules": {
- // The following rule is enabled only to supplement the inline suppression
- // examples, and because it is not a recommended rule, you should either
- // disable it, or understand what it enforces.
- // https://typescript-eslint.io/rules/explicit-function-return-type/
- // see prettier setting in ./.prettierrc
- "prettier/prettier": [
- "error",
- {},
- {
- "usePrettierrc": true
- }
- ],
- "@typescript-eslint/no-inferrable-types": 0,
- "@typescript-eslint/no-unused-vars": 2,
- "@typescript-eslint/no-var-requires": 0,
- "@typescript-eslint/no-explicit-any": 0,
- // disable error for unused vars
- "no-unused-vars": 0,
- // Import 规则:禁止在 import 语句中使用文件扩展名
- "import/extensions": [
- "error",
- "ignorePackages",
- {
- "js": "never",
- "jsx": "never",
- "ts": "never",
- "tsx": "never"
- }
- ],
- // 确保 import 路径存在且正确
- "import/no-unresolved": "error",
- // 禁止重复导入
- "import/no-duplicates": "error",
- // import 语句排序
- "import/order": [
- "error",
- {
- "groups": [
- "builtin",
- "external",
- "internal",
- "parent",
- "sibling",
- "index"
- ],
- "newlines-between": "always",
- "alphabetize": {
- "order": "asc",
- "caseInsensitive": true
- }
- }
- ]
- },
- "settings": {
- "import/resolver": {
- "typescript": {
- "alwaysTryTypes": true,
- "project": "./tsconfig.json"
- },
- "node": {
- "extensions": [".js", ".jsx", ".ts", ".tsx"]
- }
- },
- "import/parsers": {
- "@typescript-eslint/parser": [".ts", ".tsx"]
- }
- }
- }
|