forked from mapbox/mapbox-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
217 lines (214 loc) · 6.37 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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
{
"extends": [
"mourner",
"plugin:flowtype/recommended",
"plugin:import/recommended"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"sourceType": "module",
"requireConfigFile": false,
"ecmaVersion": 2016,
"babelOptions": {
"parserOpts": {
"plugins": ["flow"]
}
}
},
"plugins": [
"flowtype",
"import",
"jsdoc",
"eslint-plugin-jsdoc"
],
"rules": {
// no-duplicate-imports doesn't play well with Flow
// https://github.com/babel/eslint-plugin-babel/issues/59
"no-duplicate-imports": "off",
"import/no-duplicates": "error",
// ensure compatibility with Node's native ESM
"import/extensions": ["error", {
"js": "always",
"json": "always"
}],
// temporarily disabled for easier upgrading of dependencies
"no-use-before-define": "off",
"implicit-arrow-linebreak": "off",
"arrow-parens": "off",
"arrow-body-style": "off",
"no-confusing-arrow": "off",
"no-control-regex": "off",
"no-invalid-this": "off",
"no-prototype-builtins": "off",
"accessor-pairs": "off",
"require-atomic-updates": "off",
"array-bracket-spacing": "off",
"consistent-return": "off",
"flowtype/define-flow-type": 1,
"flowtype/require-valid-file-annotation": [
2,
"always", {
"annotationStyle": "line"
}
],
"global-require": "off",
"import/no-commonjs": "error",
"key-spacing": "off",
"no-eq-null": "off",
"no-lonely-if": "off",
"no-new": "off",
"no-unused-vars": ["error", {"argsIgnorePattern": "^_$"}],
"no-warning-comments": "error",
"no-mixed-operators": ["error", {"groups": [["&", "|", "^", "~", "<<", ">>", ">>>"], ["&&", "||"]]}],
"object-curly-spacing": ["error", "never"],
"prefer-arrow-callback": "error",
"prefer-const": ["error", {"destructuring": "all"}],
"prefer-template": "error",
"quotes": "off",
"space-before-function-paren": "off",
"template-curly-spacing": "error",
"no-useless-escape": "off",
"indent": ["error", 4, {
"flatTernaryExpressions": true,
"CallExpression": {
"arguments": "off"
},
"FunctionDeclaration": {
"parameters": "off"
},
"FunctionExpression": {
"parameters": "off"
}
}],
"no-multiple-empty-lines": [ "error", {
"max": 1
}],
},
"settings": {
"jsdoc":{
"ignorePrivate": true,
"preferredTypes": {
"object": "Object"
}
}
},
"overrides": [
{
"files": ["src/fake_filename_for_jsdoc_examples"],
"rules": {
"flowtype/require-valid-file-annotation": "off"
},
"globals": {
"map": true
}
},
{
"files": ["debug/**", "bench/**", "test/**", "src/style-spec/**"],
"rules": {
"flowtype/require-valid-file-annotation": "off",
"jsdoc/check-param-names": "off",
"jsdoc/require-param": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-param-name": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-returns-description": "off",
"jsdoc/require-property": "off",
"jsdoc/require-description-complete-sentence": "off",
"jsdoc/check-access": "off",
"jsdoc/check-examples": "off",
"jsdoc/check-line-alignment": "off",
"jsdoc/check-property-names": "off",
"jsdoc/check-types": "off",
"jsdoc/tag-lines": "off",
"jsdoc/require-description": "off",
"jsdoc/require-example": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-property-description": "off",
"jsdoc/require-property-name": "off",
"jsdoc/require-property-type": "off",
"jsdoc/require-returns-type": "off",
}
},
{
"files": [
"src/index.js",
"src/ui/map.js",
"src/ui/camera.js",
"src/ui/marker.js",
"src/ui/popup.js",
"src/ui/events.js",
"src/ui/control/**",
"src/ui/handler/**",
"src/geo/lng_lat.js",
"src/geo/lng_lat_bounds.js",
"src/geo/mercator_coordinate.js",
"src/source/**",
],
"rules": {
"jsdoc/check-param-names": "error",
"jsdoc/require-param": "error",
"jsdoc/require-param-description": "error",
"jsdoc/require-param-name": "error",
"jsdoc/require-returns": "error",
"jsdoc/require-returns-description": "error",
"jsdoc/require-property": "error",
"jsdoc/require-description-complete-sentence": "error",
"jsdoc/check-access": "error",
"jsdoc/check-examples": ["error", {
"matchingFileName": "src/fake_filename_for_jsdoc_examples",
"rejectExampleCodeRegex": "<script>"
}],
"jsdoc/check-line-alignment": ["error", "any", {"wrapIndent": " "}],
"jsdoc/check-property-names": "error",
"jsdoc/check-types": "error",
"jsdoc/tag-lines": ["error", "any", {"startLines": 1}],
"jsdoc/require-description": "error",
"jsdoc/require-example": "error",
"jsdoc/require-param-type": "error",
"jsdoc/require-property-description": "error",
"jsdoc/require-property-name": "error",
"jsdoc/require-property-type": "error",
"jsdoc/require-returns-type": "error",
}
},
{
"files": [
"src/**/*",
"3d-style/**/*"
],
"rules": {
"no-restricted-syntax": [
"error",
{
"selector": "AwaitExpression",
"message": "Async/await syntax is not allowed."
},
{
"selector": "FunctionDeclaration[async=true]",
"message": "Async function declarations are not allowed."
},
{
"selector": "FunctionExpression[async=true]",
"message": "Async function expressions are not allowed."
},
{
"selector": "ArrowFunctionExpression[async=true]",
"message": "Async arrow functions are not allowed."
},
// prevent issues with esbuild/vite https://github.com/mapbox/mapbox-gl-js/issues/12656
{
"selector": "ClassProperty[value]",
"message": "ClassProperty values are not allowed."
}
]
}
}
],
"globals": {
"performance": true
},
"env": {
"es6": true,
"browser": false
}
}