|
| 1 | +import globals from 'globals'; |
| 2 | +import pluginJs from '@eslint/js'; |
| 3 | +import tseslint from 'typescript-eslint'; |
| 4 | +import pluginReact from 'eslint-plugin-react'; |
| 5 | +import prettierConfig from 'eslint-config-prettier'; |
| 6 | +import prettierPlugin from 'eslint-plugin-prettier'; |
| 7 | +import jestPlugin from 'eslint-plugin-jest'; |
| 8 | + |
| 9 | +export default [ |
| 10 | + { files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] }, |
| 11 | + { languageOptions: { globals: { ...globals.browser, ...globals.jest } } }, // Add Jest globals here |
| 12 | + pluginJs.configs.recommended, |
| 13 | + ...tseslint.configs.recommended, |
| 14 | + pluginReact.configs.flat.recommended, |
| 15 | + prettierConfig, // Disables conflicting ESLint rules with Prettier |
| 16 | + { |
| 17 | + ignores: ['node_modules/', 'android/', 'ios/', 'build/'], |
| 18 | + plugins: { prettier: prettierPlugin, jest: jestPlugin }, // Register Jest and Prettier plugins |
| 19 | + rules: { |
| 20 | + 'react/react-in-jsx-scope': 'off', |
| 21 | + 'no-unused-vars': 'warn', |
| 22 | + 'react-native/no-inline-styles': 'off', |
| 23 | + 'prettier/prettier': 'error', // Enforce Prettier rules |
| 24 | + // Jest-specific rules (optional) |
| 25 | + 'jest/no-disabled-tests': 'warn', |
| 26 | + 'jest/no-focused-tests': 'error', |
| 27 | + 'jest/no-identical-title': 'error', |
| 28 | + 'jest/prefer-to-have-length': 'warn', |
| 29 | + 'jest/valid-expect': 'error', |
| 30 | + }, |
| 31 | + settings: { |
| 32 | + react: { |
| 33 | + version: 'detect', // Automatically detect React version |
| 34 | + }, |
| 35 | + }, |
| 36 | + }, |
| 37 | +]; |
0 commit comments