-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
112 lines (112 loc) · 2.85 KB
/
.eslintrc.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
105
106
107
108
109
110
111
112
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: [
"./tsconfig.json",
"docsite/tsconfig.json",
"examples/objectdetection/tsconfig.json",
],
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: "module",
},
ignorePatterns: [
"scripts",
"lib",
"docs",
"app.plugin.js",
".eslintrc.js",
".prettierrc.js",
"*.config.js",
"jest.setup.js",
"coverage",
],
plugins: ["@typescript-eslint"],
extends: [
"plugin:@typescript-eslint/recommended",
"@react-native",
"prettier",
],
rules: {
// eslint
semi: "off",
curly: ["error", "all"],
"no-mixed-spaces-and-tabs": ["warn", "smart-tabs"],
"no-async-promise-executor": "warn",
"require-await": "warn",
"no-return-await": "warn",
"no-await-in-loop": "warn",
"comma-dangle": "off", // prettier already detects this
"no-restricted-syntax": [
"error",
{
selector: "TSEnumDeclaration",
message:
"Enums have various disadvantages, use TypeScript's union types instead.",
},
],
// typescript
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
vars: "all",
args: "after-used",
ignoreRestSiblings: false,
varsIgnorePattern: "^_",
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-function-return-type": [
"off",
{
allowExpressions: true,
},
],
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unsafe-assignment": "error",
"prettier/prettier": "off",
// react plugin
"react/no-unescaped-entities": "off",
// react native plugin
"react-native/no-unused-styles": "warn",
"react-native/split-platform-components": "off",
"react-native/no-color-literals": "off",
"react-native/no-raw-text": "off",
"react-native/no-inline-styles": "off",
"react-native/no-single-element-style-arrays": "warn",
"@typescript-eslint/strict-boolean-expressions": [
"error",
{
allowString: false,
allowNullableObject: true,
allowNumber: false,
allowNullableBoolean: true,
},
],
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
// docusaurus does that
"react/react-in-jsx-scope": "off",
"react/jsx-uses-react": "off",
// react hooks
"react-hooks/exhaustive-deps": [
"error",
{
additionalHooks:
"(useDerivedValue|useAnimatedStyle|useAnimatedProps|useWorkletCallback|useFrameProcessor)",
},
],
},
env: {
node: true,
},
globals: {
_log: "readonly",
},
};