|
| 1 | +/** @type {import("eslint").Linter.Config} */ |
| 2 | +module.exports = { |
| 3 | + env: { |
| 4 | + node: true, |
| 5 | + }, |
| 6 | + extends: [ |
| 7 | + "eslint:recommended", |
| 8 | + "plugin:@typescript-eslint/recommended", |
| 9 | + "plugin:react/recommended", |
| 10 | + "plugin:react-hooks/recommended", |
| 11 | + "prettier", |
| 12 | + ], |
| 13 | + globals: { |
| 14 | + JSX: true, |
| 15 | + React: true, |
| 16 | + }, |
| 17 | + ignorePatterns: [ |
| 18 | + // Ignore dotfiles |
| 19 | + ".*.js", |
| 20 | + "node_modules/", |
| 21 | + "dist/", |
| 22 | + ], |
| 23 | + overrides: [ |
| 24 | + { |
| 25 | + files: ["*.js?(x)", "*.ts?(x)"], |
| 26 | + }, |
| 27 | + ], |
| 28 | + plugins: [ |
| 29 | + "import", |
| 30 | + "only-warn", |
| 31 | + "sort-destructure-keys", |
| 32 | + "sort-keys-plus", |
| 33 | + "typescript-sort-keys", |
| 34 | + "unused-imports", |
| 35 | + ], |
| 36 | + rules: { |
| 37 | + "@typescript-eslint/explicit-module-boundary-types": "off", |
| 38 | + "@typescript-eslint/no-unused-vars": [ |
| 39 | + "error", |
| 40 | + { |
| 41 | + argsIgnorePattern: "^_", |
| 42 | + caughtErrorsIgnorePattern: "^_", |
| 43 | + ignoreRestSiblings: true, |
| 44 | + varsIgnorePattern: "^_", |
| 45 | + }, |
| 46 | + ], |
| 47 | + curly: "error", |
| 48 | + "import/no-cycle": ["warn"], |
| 49 | + "import/order": [ |
| 50 | + "warn", |
| 51 | + { |
| 52 | + alphabetize: { |
| 53 | + caseInsensitive: false, |
| 54 | + order: "asc", |
| 55 | + }, |
| 56 | + groups: [ |
| 57 | + "builtin", |
| 58 | + "external", |
| 59 | + "type", |
| 60 | + "internal", |
| 61 | + "parent", |
| 62 | + "sibling", |
| 63 | + "index", |
| 64 | + ], |
| 65 | + "newlines-between": "never", |
| 66 | + pathGroups: [ |
| 67 | + { |
| 68 | + group: "external", |
| 69 | + pattern: "react", |
| 70 | + position: "before", |
| 71 | + }, |
| 72 | + { |
| 73 | + group: "internal", |
| 74 | + pattern: "@modernfi/**", |
| 75 | + position: "before", |
| 76 | + }, |
| 77 | + { |
| 78 | + group: "internal", |
| 79 | + pattern: "flagship/**", |
| 80 | + position: "before", |
| 81 | + }, |
| 82 | + ], |
| 83 | + pathGroupsExcludedImportTypes: ["react"], |
| 84 | + warnOnUnassignedImports: true, |
| 85 | + }, |
| 86 | + ], |
| 87 | + "no-case-declarations": "off", |
| 88 | + "no-empty-pattern": "off", |
| 89 | + "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 1 }], |
| 90 | + "no-unused-vars": "off", |
| 91 | + "react/jsx-newline": ["warn", { prevent: true }], |
| 92 | + "react/jsx-sort-props": [ |
| 93 | + "warn", |
| 94 | + { |
| 95 | + callbacksLast: false, |
| 96 | + ignoreCase: false, |
| 97 | + locale: "auto", |
| 98 | + multiline: "ignore", |
| 99 | + noSortAlphabetically: false, |
| 100 | + reservedFirst: false, |
| 101 | + shorthandFirst: false, |
| 102 | + shorthandLast: false, |
| 103 | + }, |
| 104 | + ], |
| 105 | + "react/jsx-uses-react": "off", |
| 106 | + "react/react-in-jsx-scope": "off", |
| 107 | + "react/self-closing-comp": "error", |
| 108 | + "react-hooks/exhaustive-deps": "error", |
| 109 | + "require-await": "error", |
| 110 | + "sort-destructure-keys/sort-destructure-keys": [ |
| 111 | + "warn", |
| 112 | + { caseSensitive: true }, |
| 113 | + ], |
| 114 | + "sort-imports": [ |
| 115 | + "warn", |
| 116 | + { |
| 117 | + // let import/order deal with declarations |
| 118 | + ignoreDeclarationSort: true, |
| 119 | + }, |
| 120 | + ], |
| 121 | + "sort-keys-plus/sort-keys": [ |
| 122 | + "warn", |
| 123 | + "asc", |
| 124 | + { |
| 125 | + allowLineSeparatedGroups: true, |
| 126 | + natural: true, |
| 127 | + }, |
| 128 | + ], |
| 129 | + "typescript-sort-keys/interface": [ |
| 130 | + "warn", |
| 131 | + "asc", |
| 132 | + { |
| 133 | + caseSensitive: true, |
| 134 | + natural: true, |
| 135 | + requiredFirst: false, |
| 136 | + }, |
| 137 | + ], |
| 138 | + "typescript-sort-keys/string-enum": [ |
| 139 | + "warn", |
| 140 | + "asc", |
| 141 | + { |
| 142 | + caseSensitive: true, |
| 143 | + natural: true, |
| 144 | + }, |
| 145 | + ], |
| 146 | + "unused-imports/no-unused-imports": "warn", |
| 147 | + }, |
| 148 | + settings: { |
| 149 | + react: { |
| 150 | + version: "detect", |
| 151 | + }, |
| 152 | + }, |
| 153 | +}; |
0 commit comments