-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheslint.config.js
104 lines (102 loc) · 2.7 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* eslint-disable @typescript-eslint/no-require-imports */
const { FlatCompat } = require('@eslint/eslintrc');
const typeScriptEsLintPlugin = require('@typescript-eslint/eslint-plugin');
const { fixupPluginRules } = require('@eslint/compat');
const reactEslint = require('eslint-plugin-react');
const rnEslint = require('eslint-plugin-react-native');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: typeScriptEsLintPlugin.configs['recommended'],
});
module.exports = [
...compat.config({
env: { node: true },
extends: [
// "airbnb",
// "airbnb/hooks",
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
modules: true,
},
},
plugins: ['@typescript-eslint'],
}),
{
rules: {
'require-jsdoc': 'off',
'no-invalid-this': 'off',
'react/prop-types': 'off',
'react/display-name': 'off',
// "import/no-unresolved": 0,
'react/function-component-definition': [
1,
{
namedComponents: [
'function-declaration',
'function-expression',
'arrow-function',
],
unnamedComponents: ['function-expression', 'arrow-function'],
},
],
'react/jsx-filename-extension': [
'error',
{
extensions: ['.ts', '.tsx'],
},
],
'react/require-default-props': 0,
'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'all',
arrowParens: 'avoid',
endOfLine: 'auto',
},
],
'max-len': [
2,
{
code: 140,
ignoreStrings: true,
ignoreUrls: true,
},
],
'no-shadow': 'off',
'global-require': 0,
'no-console': 1,
'react/jsx-props-no-spreading': 0,
'react/state-in-constructor': 0,
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'react-hooks/exhaustive-deps': 'off',
// "import/no-extraneous-dependencies": [
// "error",
// {
// "devDependencies": true,
// "optionalDependencies": true,
// "peerDependencies": true
// }
// ],
'react/no-unstable-nested-components': 'off',
'react/destructuring-assignment': 'off',
},
},
{
plugins: {
react: reactEslint,
'react-native': fixupPluginRules(rnEslint),
},
rules: {
'react-native/no-inline-styles': 0,
},
},
];