|
| 1 | +const { FlatCompat } = require('@eslint/eslintrc'); |
| 2 | +const path = require('path'); |
| 3 | + |
| 4 | +const compat = new FlatCompat({ baseDirectory: path.resolve(process.cwd()) }); |
| 5 | + |
| 6 | +const babelParser = require('@babel/eslint-parser'); |
| 7 | + |
| 8 | +module.exports = [ |
| 9 | + // load recommended configs via compat |
| 10 | + ...compat.extends( |
| 11 | + 'plugin:react/recommended', |
| 12 | + 'plugin:react-native/all', |
| 13 | + 'plugin:import/recommended', |
| 14 | + 'plugin:prettier/recommended', |
| 15 | + 'prettier' |
| 16 | + ), |
| 17 | + |
| 18 | + // ignore files (replaces .eslintignore) |
| 19 | + { ignores: ['node_modules/**', 'build/**', 'docs/**', 'examples/**'] }, |
| 20 | + |
| 21 | + // custom rules from previous .eslintrc |
| 22 | + { |
| 23 | + languageOptions: { |
| 24 | + parser: babelParser, |
| 25 | + parserOptions: { |
| 26 | + requireConfigFile: false, |
| 27 | + ecmaVersion: 2020, |
| 28 | + sourceType: 'module', |
| 29 | + ecmaFeatures: { jsx: true }, |
| 30 | + }, |
| 31 | + }, |
| 32 | + rules: { |
| 33 | + 'class-methods-use-this': 'off', |
| 34 | + 'import/namespace': 'off', |
| 35 | + 'import/no-namespace': 'off', |
| 36 | + 'react-native/no-color-literals': 'off', |
| 37 | + 'react/prop-types': 'off', |
| 38 | + }, |
| 39 | + }, |
| 40 | + // react settings |
| 41 | + { |
| 42 | + settings: { |
| 43 | + react: { version: 'detect' }, |
| 44 | + }, |
| 45 | + }, |
| 46 | +]; |
0 commit comments