|
1 | | -const typescriptEslintRecommended = require('@typescript-eslint/eslint-plugin/dist/configs/recommended.json'); |
2 | | -const typescriptEslintPrettier = require('eslint-config-prettier/@typescript-eslint'); |
| 1 | +'use strict'; |
3 | 2 |
|
4 | 3 | module.exports = { |
5 | | - extends: ['@react-native-community'], |
6 | | - overrides: [ |
7 | | - { |
8 | | - files: ['./mock.js'], |
9 | | - env: {jest: true}, |
10 | | - }, |
11 | | - { |
12 | | - files: ['*.ts', '*.tsx'], |
13 | | - // Apply the recommended Typescript defaults and the prettier overrides to all Typescript files |
14 | | - rules: Object.assign( |
15 | | - typescriptEslintRecommended.rules, |
16 | | - typescriptEslintPrettier.rules, |
17 | | - { |
18 | | - '@typescript-eslint/explicit-member-accessibility': 'off', |
19 | | - '@typescript-eslint/no-empty-function': 'off', |
20 | | - }, |
21 | | - ), |
22 | | - }, |
23 | | - { |
24 | | - files: ['example/**/*.ts', 'example/**/*.tsx'], |
25 | | - rules: { |
26 | | - // Turn off rules which are useless and annoying for the example files files |
27 | | - '@typescript-eslint/explicit-function-return-type': 'off', |
28 | | - 'react-native/no-inline-styles': 'off', |
29 | | - }, |
30 | | - }, |
31 | | - ], |
| 4 | + root: true, |
| 5 | + |
| 6 | + parser: '@typescript-eslint/parser', |
| 7 | + plugins: ['@typescript-eslint', 'react', 'react-hooks'], |
| 8 | + |
| 9 | + env: { |
| 10 | + es6: true, |
| 11 | + }, |
| 12 | + |
| 13 | + parserOptions: { |
| 14 | + project: './tsconfig.json', |
| 15 | + ecmaFeatures: {jsx: true}, |
| 16 | + ecmaVersion: 2018, |
| 17 | + sourceType: 'module', |
| 18 | + }, |
| 19 | + |
| 20 | + settings: { |
| 21 | + react: {version: 'detect'}, |
| 22 | + }, |
| 23 | + |
| 24 | + globals: { |
| 25 | + __DEV__: true, |
| 26 | + __dirname: false, |
| 27 | + __fbBatchedBridgeConfig: false, |
| 28 | + alert: false, |
| 29 | + cancelAnimationFrame: false, |
| 30 | + cancelIdleCallback: false, |
| 31 | + clearImmediate: true, |
| 32 | + clearInterval: false, |
| 33 | + clearTimeout: false, |
| 34 | + console: false, |
| 35 | + document: false, |
| 36 | + ErrorUtils: false, |
| 37 | + escape: false, |
| 38 | + Event: false, |
| 39 | + EventTarget: false, |
| 40 | + exports: false, |
| 41 | + fetch: false, |
| 42 | + FormData: false, |
| 43 | + global: false, |
| 44 | + Headers: false, |
| 45 | + Intl: false, |
| 46 | + Map: true, |
| 47 | + module: false, |
| 48 | + navigator: false, |
| 49 | + process: false, |
| 50 | + Promise: true, |
| 51 | + requestAnimationFrame: true, |
| 52 | + requestIdleCallback: true, |
| 53 | + require: false, |
| 54 | + Set: true, |
| 55 | + setImmediate: true, |
| 56 | + setInterval: false, |
| 57 | + setTimeout: false, |
| 58 | + URL: false, |
| 59 | + URLSearchParams: false, |
| 60 | + WebSocket: true, |
| 61 | + window: false, |
| 62 | + XMLHttpRequest: false, |
| 63 | + }, |
| 64 | + |
| 65 | + rules: { |
| 66 | + // https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin |
| 67 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 68 | + '@typescript-eslint/ban-ts-ignore': 'off', |
| 69 | + '@typescript-eslint/ban-types': 'off', |
| 70 | + '@typescript-eslint/camelcase': 'off', |
| 71 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 72 | + '@typescript-eslint/no-empty-function': 'off', |
| 73 | + '@typescript-eslint/no-explicit-any': 'off', |
| 74 | + '@typescript-eslint/no-use-before-define': 'off', |
| 75 | + '@typescript-eslint/no-var-requires': 'off', |
| 76 | + |
| 77 | + '@typescript-eslint/no-unused-vars': [ |
| 78 | + 'error', |
| 79 | + {argsIgnorePattern: '^_', ignoreRestSiblings: true}, |
| 80 | + ], |
| 81 | + |
| 82 | + // https://github.com/yannickcr/eslint-plugin-react |
| 83 | + 'react/display-name': 'off', |
| 84 | + 'react/prop-types': 'off', |
| 85 | + |
| 86 | + // https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks |
| 87 | + 'react-hooks/rules-of-hooks': 'error', |
| 88 | + 'react-hooks/exhaustive-deps': 'error', |
| 89 | + }, |
32 | 90 | }; |
0 commit comments