]> git.proxmox.com Git - pve-eslint.git/blob - eslint/tests/fixtures/parsers/type-annotations/function-declaration-type-annotation-no-space.js
first commit
[pve-eslint.git] / eslint / tests / fixtures / parsers / type-annotations / function-declaration-type-annotation-no-space.js
1 /**
2 * Source code:
3 * function foo(a: number=0): Foo { }
4 */
5
6 exports.parse = () => ({
7 "type": "Program",
8 "range": [
9 0,
10 34
11 ],
12 "loc": {
13 "start": {
14 "line": 1,
15 "column": 0
16 },
17 "end": {
18 "line": 1,
19 "column": 34
20 }
21 },
22 "body": [
23 {
24 "type": "FunctionDeclaration",
25 "range": [
26 0,
27 34
28 ],
29 "loc": {
30 "start": {
31 "line": 1,
32 "column": 0
33 },
34 "end": {
35 "line": 1,
36 "column": 34
37 }
38 },
39 "id": {
40 "type": "Identifier",
41 "range": [
42 9,
43 12
44 ],
45 "loc": {
46 "start": {
47 "line": 1,
48 "column": 9
49 },
50 "end": {
51 "line": 1,
52 "column": 12
53 }
54 },
55 "name": "foo"
56 },
57 "generator": false,
58 "expression": false,
59 "async": false,
60 "params": [
61 {
62 "type": "AssignmentPattern",
63 "range": [
64 13,
65 24
66 ],
67 "loc": {
68 "start": {
69 "line": 1,
70 "column": 13
71 },
72 "end": {
73 "line": 1,
74 "column": 24
75 }
76 },
77 "left": {
78 "type": "Identifier",
79 "range": [
80 13,
81 14
82 ],
83 "loc": {
84 "start": {
85 "line": 1,
86 "column": 13
87 },
88 "end": {
89 "line": 1,
90 "column": 14
91 }
92 },
93 "name": "a",
94 "typeAnnotation": {
95 "type": "TypeAnnotation",
96 "loc": {
97 "start": {
98 "line": 1,
99 "column": 16
100 },
101 "end": {
102 "line": 1,
103 "column": 22
104 }
105 },
106 "range": [
107 16,
108 22
109 ],
110 "typeAnnotation": {
111 "type": "NumberKeyword",
112 "range": [
113 16,
114 22
115 ],
116 "loc": {
117 "start": {
118 "line": 1,
119 "column": 16
120 },
121 "end": {
122 "line": 1,
123 "column": 22
124 }
125 }
126 }
127 }
128 },
129 "right": {
130 "type": "Literal",
131 "range": [
132 23,
133 24
134 ],
135 "loc": {
136 "start": {
137 "line": 1,
138 "column": 23
139 },
140 "end": {
141 "line": 1,
142 "column": 24
143 }
144 },
145 "value": 0,
146 "raw": "0"
147 }
148 }
149 ],
150 "body": {
151 "type": "BlockStatement",
152 "range": [
153 31,
154 34
155 ],
156 "loc": {
157 "start": {
158 "line": 1,
159 "column": 31
160 },
161 "end": {
162 "line": 1,
163 "column": 34
164 }
165 },
166 "body": []
167 },
168 "returnType": {
169 "type": "TypeAnnotation",
170 "loc": {
171 "start": {
172 "line": 1,
173 "column": 27
174 },
175 "end": {
176 "line": 1,
177 "column": 30
178 }
179 },
180 "range": [
181 27,
182 30
183 ],
184 "typeAnnotation": {
185 "type": "TypeReference",
186 "range": [
187 27,
188 30
189 ],
190 "loc": {
191 "start": {
192 "line": 1,
193 "column": 27
194 },
195 "end": {
196 "line": 1,
197 "column": 30
198 }
199 },
200 "typeName": {
201 "type": "Identifier",
202 "range": [
203 27,
204 30
205 ],
206 "loc": {
207 "start": {
208 "line": 1,
209 "column": 27
210 },
211 "end": {
212 "line": 1,
213 "column": 30
214 }
215 },
216 "name": "Foo"
217 }
218 }
219 }
220 }
221 ],
222 "sourceType": "script",
223 "tokens": [
224 {
225 "type": "Keyword",
226 "value": "function",
227 "start": 0,
228 "end": 8,
229 "range": [
230 0,
231 8
232 ],
233 "loc": {
234 "start": {
235 "line": 1,
236 "column": 0
237 },
238 "end": {
239 "line": 1,
240 "column": 8
241 }
242 }
243 },
244 {
245 "type": "Identifier",
246 "value": "foo",
247 "start": 9,
248 "end": 12,
249 "range": [
250 9,
251 12
252 ],
253 "loc": {
254 "start": {
255 "line": 1,
256 "column": 9
257 },
258 "end": {
259 "line": 1,
260 "column": 12
261 }
262 }
263 },
264 {
265 "type": "Punctuator",
266 "value": "(",
267 "start": 12,
268 "end": 13,
269 "range": [
270 12,
271 13
272 ],
273 "loc": {
274 "start": {
275 "line": 1,
276 "column": 12
277 },
278 "end": {
279 "line": 1,
280 "column": 13
281 }
282 }
283 },
284 {
285 "type": "Identifier",
286 "value": "a",
287 "start": 13,
288 "end": 14,
289 "range": [
290 13,
291 14
292 ],
293 "loc": {
294 "start": {
295 "line": 1,
296 "column": 13
297 },
298 "end": {
299 "line": 1,
300 "column": 14
301 }
302 }
303 },
304 {
305 "type": "Punctuator",
306 "value": ":",
307 "start": 14,
308 "end": 15,
309 "range": [
310 14,
311 15
312 ],
313 "loc": {
314 "start": {
315 "line": 1,
316 "column": 14
317 },
318 "end": {
319 "line": 1,
320 "column": 15
321 }
322 }
323 },
324 {
325 "type": "Identifier",
326 "value": "number",
327 "start": 16,
328 "end": 22,
329 "range": [
330 16,
331 22
332 ],
333 "loc": {
334 "start": {
335 "line": 1,
336 "column": 16
337 },
338 "end": {
339 "line": 1,
340 "column": 22
341 }
342 }
343 },
344 {
345 "type": "Punctuator",
346 "value": "=",
347 "start": 22,
348 "end": 23,
349 "range": [
350 22,
351 23
352 ],
353 "loc": {
354 "start": {
355 "line": 1,
356 "column": 22
357 },
358 "end": {
359 "line": 1,
360 "column": 23
361 }
362 }
363 },
364 {
365 "type": "Numeric",
366 "value": "0",
367 "start": 23,
368 "end": 24,
369 "range": [
370 23,
371 24
372 ],
373 "loc": {
374 "start": {
375 "line": 1,
376 "column": 23
377 },
378 "end": {
379 "line": 1,
380 "column": 24
381 }
382 }
383 },
384 {
385 "type": "Punctuator",
386 "value": ")",
387 "start": 24,
388 "end": 25,
389 "range": [
390 24,
391 25
392 ],
393 "loc": {
394 "start": {
395 "line": 1,
396 "column": 24
397 },
398 "end": {
399 "line": 1,
400 "column": 25
401 }
402 }
403 },
404 {
405 "type": "Punctuator",
406 "value": ":",
407 "start": 25,
408 "end": 26,
409 "range": [
410 25,
411 26
412 ],
413 "loc": {
414 "start": {
415 "line": 1,
416 "column": 25
417 },
418 "end": {
419 "line": 1,
420 "column": 26
421 }
422 }
423 },
424 {
425 "type": "Identifier",
426 "value": "Foo",
427 "start": 27,
428 "end": 30,
429 "range": [
430 27,
431 30
432 ],
433 "loc": {
434 "start": {
435 "line": 1,
436 "column": 27
437 },
438 "end": {
439 "line": 1,
440 "column": 30
441 }
442 }
443 },
444 {
445 "type": "Punctuator",
446 "value": "{",
447 "start": 31,
448 "end": 32,
449 "range": [
450 31,
451 32
452 ],
453 "loc": {
454 "start": {
455 "line": 1,
456 "column": 31
457 },
458 "end": {
459 "line": 1,
460 "column": 32
461 }
462 }
463 },
464 {
465 "type": "Punctuator",
466 "value": "}",
467 "start": 33,
468 "end": 34,
469 "range": [
470 33,
471 34
472 ],
473 "loc": {
474 "start": {
475 "line": 1,
476 "column": 33
477 },
478 "end": {
479 "line": 1,
480 "column": 34
481 }
482 }
483 }
484 ],
485 "comments": []
486 });