-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
152 lines (149 loc) · 5.52 KB
/
eslint.config.mjs
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import eslint from '@eslint/js';
import pluginReact from 'eslint-plugin-react';
import pluginSecurity from 'eslint-plugin-security';
import tseslint from 'typescript-eslint';
import importRule from './plugins/import/index.mjs';
import reactNativeRule from './plugins/react-native/index.mjs';
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
pluginReact.configs.flat.recommended,
pluginSecurity.configs.recommended,
{
ignores: [
'node_modules',
'plugins',
'.storybook',
'.storybook-web',
'docs',
'babel.config.js',
'metro.config.js',
'webpack.config.js',
'App.js',
],
},
{
settings: {
react: {
version: 'detect',
},
},
},
{
languageOptions: {
globals: {
__DEV__: true,
global: true,
process: true,
},
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: import.meta.dirname,
},
},
},
{
plugins: {
'always-import': importRule,
'react-native': reactNativeRule,
},
},
{
rules: {
// custom rules
// 'always-import/module-require': [
// 'error',
// { moduleName: 'styled-components/native' },
// ],
// 'react-native/use-safe-area-view': 'error',
'react-native/use-touchable-opacity': 'error',
// 'react-native/not-inline-css': 'error',
'react-native/use-state-type': 'error',
// eslint rules
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/no-array-delete': 'error',
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-duplicate-type-constituents': 'error',
'@typescript-eslint/no-dynamic-delete': 'error',
'@typescript-eslint/no-empty-object-type': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
'@typescript-eslint/no-unnecessary-template-expression': 'error',
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
'@typescript-eslint/no-unsafe-function-type': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/no-useless-empty-export': 'error',
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
'@typescript-eslint/prefer-enum-initializers': 'error',
'@typescript-eslint/prefer-find': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-regexp-exec': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/unified-signatures': 'error',
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
'no-array-constructor': 'off',
'@typescript-eslint/no-array-constructor': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'no-throw-literal': 'off',
'@typescript-eslint/only-throw-error': 'error',
'no-empty-function': 'off',
'@typescript-eslint/no-empty-function': [
'error',
{
allow: ['private-constructors'],
},
],
'@typescript-eslint/member-ordering': [
'error',
{
typeLiterals: {
order: 'alphabetically-case-insensitive',
optionalityOrder: 'required-first',
memberTypes: ['field', 'signature', 'constructor', 'method'],
},
interfaces: {
order: 'alphabetically-case-insensitive',
optionalityOrder: 'required-first',
memberTypes: ['field', 'signature', 'constructor', 'method'],
},
classes: [
'private-instance-field',
'private-static-field',
'protected-instance-field',
'protected-static-field',
'public-instance-field',
'public-static-field',
'private-constructor',
'protected-constructor',
'public-constructor',
'private-instance-method',
'private-static-method',
'protected-instance-method',
'protected-static-method',
'public-instance-method',
'public-static-method',
],
classExpressions: ['field', 'constructor', 'method'],
},
],
},
}
);