|
1 | 1 | module.exports = { |
2 | 2 | root: true, |
| 3 | + settings: { |
| 4 | + react: { |
| 5 | + version: "detect", |
| 6 | + }, |
| 7 | + }, |
3 | 8 | env: { |
4 | 9 | node: true, |
5 | 10 | browser: true, |
6 | 11 | es2021: true, |
7 | 12 | "react-native/react-native": true, |
8 | | - "jest/globals": true |
9 | 13 | }, |
10 | 14 | extends: [ |
11 | 15 | "plugin:react/recommended", |
12 | 16 | "prettier", |
13 | 17 | "eslint:recommended", |
14 | | - "plugin:jest/recommended", |
15 | | - "plugin:@typescript-eslint/recommended" // Add TypeScript ESLint plugin |
| 18 | + "plugin:@typescript-eslint/recommended", // Add TypeScript ESLint plugin |
16 | 19 | ], |
17 | 20 | parser: "@typescript-eslint/parser", // Specify the TypeScript parser |
18 | 21 |
|
19 | 22 | parserOptions: { |
20 | 23 | ecmaFeatures: { |
21 | | - jsx: true |
| 24 | + jsx: true, |
22 | 25 | }, |
23 | 26 | ecmaVersion: "latest", |
24 | | - sourceType: "module" |
| 27 | + sourceType: "module", |
25 | 28 | }, |
26 | 29 |
|
27 | | - plugins: ["react", "react-native", "detox", "@typescript-eslint"], |
| 30 | + plugins: [ |
| 31 | + "react", |
| 32 | + "react-native", |
| 33 | + "@typescript-eslint", |
| 34 | + "simple-import-sort", |
| 35 | + ], |
28 | 36 | ignorePatterns: ["!.*", "dist", "node_modules"], |
29 | 37 | rules: { |
30 | 38 | indent: [ |
31 | 39 | "error", |
32 | 40 | "tab", |
33 | 41 | { |
34 | 42 | SwitchCase: 1, |
35 | | - ignoredNodes: ["ConditionalExpression"] |
36 | | - } |
| 43 | + }, |
| 44 | + ], // handles proper indentation for switch cases |
| 45 | + "linebreak-style": ["error", "unix"], // to ensure all line breaks are consistent |
| 46 | + quotes: ["error", "double"], // to ensure all strings are consistently wrapped with double quotes |
| 47 | + semi: ["error", "always"], // to make sure that all statements are terminated with a semicolon |
| 48 | + "no-console": ["error"], // to reduce the number of console.log statements in the code |
| 49 | + "comma-dangle": [ |
| 50 | + // ensuring that all arrays, objects, imports, and exports are consistent |
| 51 | + "error", |
| 52 | + { |
| 53 | + arrays: "always-multiline", |
| 54 | + objects: "always-multiline", |
| 55 | + imports: "always-multiline", |
| 56 | + exports: "always-multiline", |
| 57 | + functions: "never", |
| 58 | + }, |
| 59 | + ], |
| 60 | + "simple-import-sort/imports": "error", // to ensure that all imports are sorted alphabetically and grouped |
| 61 | + "@typescript-eslint/no-unused-vars": [ |
| 62 | + "error", |
| 63 | + { |
| 64 | + vars: "all", |
| 65 | + args: "after-used", |
| 66 | + ignoreRestSiblings: true, |
| 67 | + }, |
37 | 68 | ], |
38 | | - "linebreak-style": ["error", "unix"], |
39 | | - quotes: ["error", "double"], |
40 | | - semi: ["error", "always"], |
41 | | - "no-console": ["error"], |
42 | | - "no-unused-vars": "off", // Disable the default rule for unused variables |
43 | | - "@typescript-eslint/no-unused-vars": ["error", { vars: "all" }] // Enable TypeScript-specific rule for unused variables |
44 | | - |
45 | 69 | }, |
46 | | - |
47 | | - settings: { |
48 | | - react: { |
49 | | - version: "detect" |
50 | | - } |
51 | | - } |
| 70 | + overrides: [ |
| 71 | + { |
| 72 | + files: ["*.js", "*.jsx", "*.ts", "*.tsx"], |
| 73 | + rules: { |
| 74 | + "simple-import-sort/imports": [ |
| 75 | + "error", |
| 76 | + { |
| 77 | + groups: [ |
| 78 | + // Packages `react` related packages come first. |
| 79 | + ["^react"], |
| 80 | + // Packages `@` related packages come second. |
| 81 | + ["^@?\\w"], |
| 82 | + // Internal packages. |
| 83 | + [ |
| 84 | + "^(@|@api|@assets|@components|@hooks|@navigation|@redux|@screens|@utils)(/.*|$)", |
| 85 | + ], |
| 86 | + // Other relative imports. Put same-folder imports and `.` last. |
| 87 | + [ |
| 88 | + "^\\.\\.(?!/?$)", |
| 89 | + "^\\.\\./?$", |
| 90 | + "^\\./(?=.*/)(?!/?$)", |
| 91 | + "^\\.(?!/?$)", |
| 92 | + "^\\./?$", |
| 93 | + ], |
| 94 | + ], |
| 95 | + }, |
| 96 | + ], |
| 97 | + }, |
| 98 | + }, |
| 99 | + ], |
52 | 100 | }; |
0 commit comments