|
| 1 | +const path = require('path'); |
| 2 | + |
| 3 | +module.exports = { |
| 4 | + extends: ['expo', 'plugin:tailwindcss/recommended', 'prettier'], |
| 5 | + plugins: [ |
| 6 | + 'unicorn', |
| 7 | + '@typescript-eslint', |
| 8 | + 'unused-imports', |
| 9 | + 'tailwindcss', |
| 10 | + 'simple-import-sort', |
| 11 | + ], |
| 12 | + parserOptions: { |
| 13 | + project: './tsconfig.json', |
| 14 | + }, |
| 15 | + rules: { |
| 16 | + 'unicorn/filename-case': [ |
| 17 | + 'error', |
| 18 | + { |
| 19 | + case: 'kebabCase', |
| 20 | + ignore: ['/android', '/ios'], |
| 21 | + }, |
| 22 | + ], |
| 23 | + 'max-params': ['error', 3], // Limit the number of parameters in a function to use object instead |
| 24 | + 'max-lines-per-function': ['error', 70], |
| 25 | + 'react/display-name': 'off', |
| 26 | + 'react/no-inline-styles': 'off', |
| 27 | + 'react/destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring, it's a pain to add a new variable |
| 28 | + 'react/require-default-props': 'off', // Allow non-defined react props as undefined |
| 29 | + '@typescript-eslint/comma-dangle': 'off', // Avoid conflict rule between Eslint and Prettier |
| 30 | + '@typescript-eslint/consistent-type-imports': [ |
| 31 | + 'warn', |
| 32 | + { |
| 33 | + prefer: 'type-imports', |
| 34 | + fixStyle: 'inline-type-imports', |
| 35 | + disallowTypeAnnotations: true, |
| 36 | + }, |
| 37 | + ], // Ensure `import type` is used when it's necessary |
| 38 | + 'import/prefer-default-export': 'off', // Named export is easier to refactor automatically |
| 39 | + 'import/no-cycle': ['error', { maxDepth: '∞' }], |
| 40 | + 'tailwindcss/classnames-order': [ |
| 41 | + 'warn', |
| 42 | + { |
| 43 | + officialSorting: true, |
| 44 | + }, |
| 45 | + ], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss` |
| 46 | + 'simple-import-sort/imports': 'error', // Import configuration for `eslint-plugin-simple-import-sort` |
| 47 | + 'simple-import-sort/exports': 'error', // Export configuration for `eslint-plugin-simple-import-sort` |
| 48 | + '@typescript-eslint/no-unused-vars': 'off', |
| 49 | + 'tailwindcss/no-custom-classname': 'off', |
| 50 | + 'unused-imports/no-unused-imports': 'error', |
| 51 | + 'unused-imports/no-unused-vars': [ |
| 52 | + 'error', |
| 53 | + { |
| 54 | + argsIgnorePattern: '^_', |
| 55 | + varsIgnorePattern: '^_', |
| 56 | + caughtErrorsIgnorePattern: '^_', |
| 57 | + }, |
| 58 | + ], |
| 59 | + }, |
| 60 | + overrides: [ |
| 61 | + // Configuration for translations files (i18next) |
| 62 | + { |
| 63 | + files: ['src/translations/*.json'], |
| 64 | + extends: ['plugin:i18n-json/recommended'], |
| 65 | + rules: { |
| 66 | + 'i18n-json/valid-message-syntax': [ |
| 67 | + 2, |
| 68 | + { |
| 69 | + syntax: path.resolve('./scripts/i18next-syntax-validation.js'), |
| 70 | + }, |
| 71 | + ], |
| 72 | + 'i18n-json/valid-json': 2, |
| 73 | + 'i18n-json/sorted-keys': [ |
| 74 | + 2, |
| 75 | + { |
| 76 | + order: 'asc', |
| 77 | + indentSpaces: 2, |
| 78 | + }, |
| 79 | + ], |
| 80 | + 'i18n-json/identical-keys': [ |
| 81 | + 2, |
| 82 | + { |
| 83 | + filePath: path.resolve('./src/translations/en.json'), |
| 84 | + }, |
| 85 | + ], |
| 86 | + 'prettier/prettier': [ |
| 87 | + 0, |
| 88 | + { |
| 89 | + singleQuote: true, |
| 90 | + endOfLine: 'auto', |
| 91 | + }, |
| 92 | + ], |
| 93 | + }, |
| 94 | + }, |
| 95 | + { |
| 96 | + // Configuration for testing files |
| 97 | + files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], |
| 98 | + extends: ['plugin:testing-library/react'], |
| 99 | + }, |
| 100 | + ], |
| 101 | +}; |
0 commit comments