|
| 1 | +/** |
| 2 | + * Copyright 2025 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +module.exports = { |
| 18 | + root: true, |
| 19 | + parser: '@typescript-eslint/parser', |
| 20 | + parserOptions: { |
| 21 | + ecmaVersion: 'latest', |
| 22 | + sourceType: 'module', |
| 23 | + ecmaFeatures: { |
| 24 | + jsx: true, |
| 25 | + }, |
| 26 | + }, |
| 27 | + env: { |
| 28 | + 'es2021': true, |
| 29 | + 'node': true, |
| 30 | + 'react-native/react-native': true, |
| 31 | + }, |
| 32 | + plugins: [ |
| 33 | + '@typescript-eslint', |
| 34 | + 'react', |
| 35 | + 'react-hooks', |
| 36 | + 'react-native', |
| 37 | + 'import', |
| 38 | + 'prettier', |
| 39 | + ], |
| 40 | + extends: [ |
| 41 | + 'eslint:recommended', |
| 42 | + 'plugin:@typescript-eslint/recommended', |
| 43 | + 'plugin:react/recommended', |
| 44 | + 'plugin:react-hooks/recommended', |
| 45 | + 'plugin:react-native/all', |
| 46 | + 'plugin:import/errors', |
| 47 | + 'plugin:import/warnings', |
| 48 | + 'plugin:import/typescript', |
| 49 | + 'plugin:prettier/recommended', |
| 50 | + ], |
| 51 | + rules: { |
| 52 | + 'prettier/prettier': 'warn', |
| 53 | + 'react/react-in-jsx-scope': 'off', |
| 54 | + 'react-native/no-inline-styles': 'off', |
| 55 | + 'react-native/sort-styles': 'off', |
| 56 | + 'react-native/no-color-literals': 'off', |
| 57 | + 'react-hooks/rules-of-hooks': 'error', |
| 58 | + 'react-hooks/exhaustive-deps': 'warn', |
| 59 | + '@typescript-eslint/explicit-module-boundary-types': 'warn', |
| 60 | + '@typescript-eslint/no-explicit-any': 'error', |
| 61 | + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // Allow unused vars starting with _ |
| 62 | + 'import/default': 'off', // Disable for now due to react-native-select-dropdown issues |
| 63 | + }, |
| 64 | + settings: { |
| 65 | + 'react': { |
| 66 | + version: 'detect', |
| 67 | + }, |
| 68 | + 'import/resolver': { |
| 69 | + typescript: {}, |
| 70 | + }, |
| 71 | + }, |
| 72 | + overrides: [ |
| 73 | + // Configuration files can use require() |
| 74 | + { |
| 75 | + files: ['**/*.config.js', '**/babel.config.js'], |
| 76 | + rules: { |
| 77 | + '@typescript-eslint/no-require-imports': 'off', |
| 78 | + }, |
| 79 | + }, |
| 80 | + // Test files |
| 81 | + { |
| 82 | + files: ['**/*.test.js', '**/*.test.ts', '**/e2e/**/*.js'], |
| 83 | + env: { |
| 84 | + jest: true, |
| 85 | + }, |
| 86 | + rules: { |
| 87 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 88 | + }, |
| 89 | + }, |
| 90 | + // Example directory - less strict for demo code |
| 91 | + { |
| 92 | + files: ['example/**/*'], |
| 93 | + rules: { |
| 94 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 95 | + }, |
| 96 | + }, |
| 97 | + ], |
| 98 | +}; |
0 commit comments