-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc
121 lines (115 loc) · 3.29 KB
/
.eslintrc
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
{
"extends": [
"eslint:recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"eslint-plugin-tsdoc",
"import"
],
"env": {
"node": true,
"es6": true,
"jest": true
},
"globals": {
// global TS types
"MessageEvent": "readonly", // @TODO remove. Configure as a type declaration
"Event": "readonly", // @TODO remove. Configure as a type declaration
"UniversalAnalytics": "readonly" // @TODO remove when moving GA integrations to Browser-SDK
},
"rules": {
"indent": ["error", 2, {"SwitchCase": 1}],
"quotes": ["warn", "single", "avoid-escape"],
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],
"no-underscore-dangle": "off",
"eqeqeq": ["error", "smart"],
"no-unused-expressions": "off",
"new-cap" : "off",
"no-mixed-requires": "off",
"camelcase": ["error", {"properties": "never"}],
"no-use-before-define": ["error", "nofunc"],
"eol-last": ["error", "always"],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"keyword-spacing": "error",
"comma-style": "error",
"no-trailing-spaces": "error",
"space-before-function-paren": ["error", {"named": "never"}]
},
"overrides": [
{
"env": {
// platform-agnostic code must not reference Node or Browser globals
"node": false,
"browser": false,
"es6": true
},
"globals": {
// supported globals on all platforms
"console": "readonly",
"setTimeout": "readonly",
"clearTimeout": "readonly",
"setInterval": "readonly",
"clearInterval": "readonly"
},
"files": ["src/**/*.ts"],
"excludedFiles": ["src/**/__tests__/**"],
"extends": [
"plugin:compat/recommended"
],
"rules": {
"no-restricted-syntax": [
"error",
{
"selector": "ForOfStatement",
"message": "Avoid for-of syntax in favor of a smaller transpiled code"
},
{
"selector": "ForInStatement",
"message": "Don't use for-in syntax in libraries, because it iterates over properties in the prototype chain that can be polluted by other libraries"
},
{
"selector": "TSEnumDeclaration[const=true]",
"message": "Don't declare const enum, because it is not supported by Babel used for building RN SDK"
}
],
"compat/compat": ["error", "defaults, node >=14"],
"no-throw-literal": "error",
"import/no-default-export": "error",
"import/no-self-import": "error"
},
"parserOptions": {
"ecmaVersion": 2015,
"sourceType": "module"
}
},
{
"files": ["types/**"],
"rules": {
"no-use-before-define": "off"
}
},
{
// Enable TSDoc rules for TypeScript files, allowing the use of JSDoc in JS files.
"files": ["**/*.ts"],
"rules": {
"tsdoc/syntax": "warn"
}
},
// @TODO remove when moving InLocalStorage to js-browser
{
"files": ["src/storages/inLocalStorage/**/*.ts"],
"env": {
"browser": true
}
}
],
"settings": {
"polyfills": [
"Promise" // required as a polyfill by the user
]
}
}