Compare commits
864 Commits
v7.5.4
...
initialize
| Author | SHA1 | Date | |
|---|---|---|---|
| 5916a06ea1 | |||
| bfcf2590eb | |||
| a8619469bf | |||
| 9a80ee7950 | |||
| 9c9f830ac0 | |||
|
|
5dbb90ede3 | ||
|
|
75767d87cb | ||
|
|
1b4cfc21d9 | ||
|
|
2dfc06e83b | ||
|
|
2c40b8c706 | ||
|
|
ca88cf1060 | ||
|
|
74e2c2cd78 | ||
|
|
25169901de | ||
|
|
74fb914fe3 | ||
|
|
683adcbb70 | ||
|
|
cc51f2a1f2 | ||
|
|
83fc3f2623 | ||
|
|
fee4d936a3 | ||
|
|
01d6d6dd3b | ||
|
|
6ba113197f | ||
|
|
a502d88043 | ||
|
|
10213655bc | ||
|
|
cfd26fdbf2 | ||
|
|
faf149226b | ||
|
|
dba5bd3012 | ||
|
|
d18d0b6478 | ||
|
|
db2b601886 | ||
|
|
e9e6918df6 | ||
|
|
53a3dac011 | ||
|
|
401c9bbe83 | ||
|
|
c37361ba2e | ||
|
|
f087cf842f | ||
|
|
bcd181f051 | ||
|
|
5ca8acdb38 | ||
|
|
a6d134804a | ||
|
|
1b75fe3cba | ||
|
|
3846d2a7fa | ||
|
|
6c7f8291d4 | ||
|
|
d56911b88d | ||
|
|
72eca8f0c2 | ||
|
|
5bb4ee73da | ||
|
|
b4c42601d1 | ||
|
|
17dfdab7d2 | ||
|
|
927b89bec8 | ||
|
|
ec18c30ce7 | ||
|
|
f7c3d0717a | ||
|
|
f5e482d3f6 | ||
|
|
31c3de6bfa | ||
|
|
cc78743ac8 | ||
|
|
1bd82dd6c1 | ||
|
|
cc2d738343 | ||
|
|
76ece4576e | ||
|
|
ef29bf53ff | ||
|
|
e146ae748e | ||
|
|
ed1cee365f | ||
|
|
b615efba87 | ||
|
|
69cc2c30c5 | ||
|
|
110191d81e | ||
|
|
c59db52954 | ||
|
|
2be54111c0 | ||
|
|
1f7197ec16 | ||
|
|
6285cb9b64 | ||
|
|
3243af3e07 | ||
|
|
f3e2752df3 | ||
|
|
693fa1aa0d | ||
|
|
7061d966ab | ||
|
|
ebe197f12e | ||
|
|
eccbdab734 | ||
|
|
2358ed1bf9 | ||
|
|
e8c0f529a0 | ||
|
|
7c97b5587a | ||
|
|
d86c6dd449 | ||
|
|
f70f68e44a | ||
|
|
d03a00c1a4 | ||
|
|
b3ce66b1ff | ||
|
|
2ea80c845e | ||
|
|
3e7fe7b25e | ||
|
|
562deb8f09 | ||
|
|
ae68b5bf24 | ||
|
|
5b5d9a5dec | ||
|
|
bc15f0627d | ||
|
|
1037e37418 | ||
|
|
8e49bbbb09 | ||
|
|
550dcfc96a | ||
|
|
2624190887 | ||
|
|
b41b3af879 | ||
|
|
15c5245d55 | ||
|
|
da75b8484f | ||
|
|
dc0109ad3d | ||
|
|
399c182ab5 | ||
|
|
c548da9d36 | ||
|
|
71202609b5 | ||
|
|
4b52a4c707 | ||
|
|
7f94d5f75f | ||
|
|
3855f28ebb | ||
|
|
9c9bff745c | ||
|
|
d38551cc23 | ||
|
|
48010c551b | ||
|
|
5b5f8e32a0 | ||
|
|
c7d8d991a8 | ||
|
|
2b52d67ebc | ||
|
|
831a217d00 | ||
|
|
57b06a504a | ||
|
|
6e4d44f312 | ||
|
|
f6c2d2e0e5 | ||
|
|
1daf7f9865 | ||
|
|
cae8513636 | ||
|
|
8cd329f611 | ||
|
|
148e6be60f | ||
|
|
f57dc5227a | ||
|
|
8487ec8a67 | ||
|
|
ba2b2bc04d | ||
|
|
5363ff85cc | ||
|
|
6ac58744fe | ||
|
|
7fa3aa9116 | ||
|
|
7a2ecd2516 | ||
|
|
d58dc7bd1d | ||
|
|
8bc70e3aac | ||
|
|
b5cdcbe06e | ||
|
|
9eebd7b057 | ||
|
|
885bfe95dc | ||
|
|
1168d60564 | ||
|
|
a2c695275d | ||
|
|
fcdf7ec95d | ||
|
|
dd8f357639 | ||
|
|
9d8a2f14dd | ||
|
|
64291d8d52 | ||
|
|
eb438f0f98 | ||
|
|
cc73bb56b6 | ||
|
|
902ae7e6e7 | ||
|
|
f5f7b50e17 | ||
|
|
fc31183a20 | ||
|
|
3eeaa4aa36 | ||
|
|
89011d92fc | ||
|
|
f0a2fb6b7b | ||
|
|
51d6ba733f | ||
|
|
1bfe4aa02f | ||
|
|
fadd5b55ca | ||
|
|
c2c9933797 | ||
|
|
382c3f2bb9 | ||
|
|
e9e6dee39a | ||
|
|
cc35677cff | ||
|
|
c442efa7c5 | ||
|
|
5b35722d63 | ||
|
|
3396fdd7f7 | ||
|
|
6b3e9e3f1e | ||
|
|
030fddb0b8 | ||
|
|
8635063118 | ||
|
|
6748797681 | ||
|
|
f9836caee5 | ||
|
|
3fcfc90a12 | ||
|
|
025fff7871 | ||
|
|
2d64900b46 | ||
|
|
37cf65c6f8 | ||
|
|
0581ce1559 | ||
|
|
bbce2b3807 | ||
|
|
2b9ee42ded | ||
|
|
47de99e1b8 | ||
|
|
bede064c0b | ||
|
|
c209725ada | ||
|
|
de38cfc510 | ||
|
|
22a1681e11 | ||
|
|
40d9bb3a77 | ||
|
|
e56b342e59 | ||
|
|
9adb82e68a | ||
|
|
742aa412a7 | ||
|
|
22fa8e6f20 | ||
|
|
78a2f603ce | ||
|
|
990ea0f1ae | ||
|
|
dae75e1853 | ||
|
|
b6a7601e4a | ||
|
|
c456fdddd7 | ||
|
|
2a1c76e070 | ||
|
|
57c825eebb | ||
|
|
6ab458b512 | ||
|
|
35c49ddf97 | ||
|
|
098ab73be1 | ||
|
|
e675cd7445 | ||
|
|
a1f9458052 | ||
|
|
a17917810d | ||
|
|
dcf55cb730 | ||
|
|
28c4507866 | ||
|
|
4f9e2a5be6 | ||
|
|
8dae11e6d2 | ||
|
|
9342a5b74c | ||
|
|
92507e598f | ||
|
|
42d0769683 | ||
|
|
6a6c2bad50 | ||
|
|
b537da9b53 | ||
|
|
85d8f70478 | ||
|
|
da43afb5de | ||
|
|
077bea0a45 | ||
|
|
99968db2b1 | ||
|
|
3477626973 | ||
|
|
735abb06b4 | ||
|
|
cadb22334e | ||
|
|
b2bc4fe4f4 | ||
|
|
2f7aea98eb | ||
|
|
b2c065976b | ||
|
|
f75f7a0601 | ||
|
|
1bd58fa018 | ||
|
|
c27c2b6e68 | ||
|
|
c03d5c41a5 | ||
|
|
7057e9fb73 | ||
|
|
fbb7ff6e44 | ||
|
|
6d37c551dd | ||
|
|
23d12acd15 | ||
|
|
b6ce2b649f | ||
|
|
2afde99434 | ||
|
|
97c9442511 | ||
|
|
660180b932 | ||
|
|
d0d84aca9b | ||
|
|
624a425f7d | ||
|
|
3cb154df82 | ||
|
|
a706e85b19 | ||
|
|
e988a88af0 | ||
|
|
5b08714a4d | ||
|
|
d33839a9c3 | ||
|
|
5d6d52f04e | ||
|
|
7ed6bfb925 | ||
|
|
3a36eca1b4 | ||
|
|
b6172b2ed3 | ||
|
|
39cef92885 | ||
|
|
0e2bbc3705 | ||
|
|
090269e5a0 | ||
|
|
f43062ebbb | ||
|
|
38f372b8ea | ||
|
|
c958724bbd | ||
|
|
b0d8baf320 | ||
|
|
5b3caf7b66 | ||
|
|
04cf4246b8 | ||
|
|
b576677e9f | ||
|
|
d61b06b8b5 | ||
|
|
15e2aa0a24 | ||
|
|
bc9b69590b | ||
|
|
cf86d94597 | ||
|
|
35f79cb272 | ||
|
|
522140b43f | ||
|
|
c9b8d2dfd1 | ||
|
|
469e679b6d | ||
|
|
dcb4bffee5 | ||
|
|
9a791d175c | ||
|
|
d40a6dd9b7 | ||
|
|
6aec93c468 | ||
|
|
94e69f399b | ||
|
|
001064885d | ||
|
|
bffbaff7e2 | ||
|
|
36a630e023 | ||
|
|
45a9f64174 | ||
|
|
4e4aa05639 | ||
|
|
cb2eb3a1fb | ||
|
|
b4daa5eae2 | ||
|
|
6feaee84e0 | ||
|
|
b5c058bf6e | ||
|
|
267731917b | ||
|
|
b8a3af8cd6 | ||
|
|
9a558bd942 | ||
|
|
d78b0debd7 | ||
|
|
711c1e2f4b | ||
|
|
2ca65d5451 | ||
|
|
e8b91f8862 | ||
|
|
26daac8690 | ||
|
|
1c5400a670 | ||
|
|
700f62e28e | ||
|
|
371488c102 | ||
|
|
1cda9b6a80 | ||
|
|
f9b19189d7 | ||
|
|
d3c40a1851 | ||
|
|
65413344bd | ||
|
|
2bee348c9a | ||
|
|
dccd5a7593 | ||
|
|
b3c41bd5d7 | ||
|
|
ad8a7e78e1 | ||
|
|
4f4d229e0a | ||
|
|
d76cfe05b1 | ||
|
|
fd2093914e | ||
|
|
10864cfa71 | ||
|
|
38072c0716 | ||
|
|
122acf8f81 | ||
|
|
332da936b7 | ||
|
|
f78ab342fd | ||
|
|
49625639f2 | ||
|
|
838bada36d | ||
|
|
1be2c47da6 | ||
|
|
8c12b515b8 | ||
|
|
93a4c3c699 | ||
|
|
1d52247080 | ||
|
|
1f04cab99f | ||
|
|
31f48f0651 | ||
|
|
610cf28dab | ||
|
|
994eea7a53 | ||
|
|
8d48eecc2f | ||
|
|
aa6c5ccd45 | ||
|
|
3c414db312 | ||
|
|
ce6d9df192 | ||
|
|
33343e6688 | ||
|
|
2339c8af0f | ||
|
|
93a73cc483 | ||
|
|
3d4e8cfea3 | ||
|
|
f97d83d847 | ||
|
|
9c70c76cfd | ||
|
|
313388b293 | ||
|
|
2b812b087c | ||
|
|
481329a47e | ||
|
|
50e0abfd16 | ||
|
|
0534eb7644 | ||
|
|
289bf4f84a | ||
|
|
af44a1cc83 | ||
|
|
0cb35ab04e | ||
|
|
b0dbbfcc03 | ||
|
|
1766a21145 | ||
|
|
52d9c34465 | ||
|
|
9ee5e6e59c | ||
|
|
66a4cf578f | ||
|
|
19baee2242 | ||
|
|
ce54b07e2d | ||
|
|
167b8bf0a0 | ||
|
|
ab9afd33d1 | ||
|
|
4d473c3305 | ||
|
|
93a9a8d638 | ||
|
|
c8fe9136d7 | ||
|
|
97af2b0b62 | ||
|
|
81ce743986 | ||
|
|
2b66040f0d | ||
|
|
872449d6fc | ||
|
|
a2f345b24b | ||
|
|
161edcca48 | ||
|
|
cfd35799da | ||
|
|
0ccbceb9e8 | ||
|
|
cbc0475634 | ||
|
|
cf456bfe4a | ||
|
|
fd36e3cf8d | ||
|
|
149dd082f3 | ||
|
|
44ff360379 | ||
|
|
8a089b65fb | ||
|
|
3c9ef8ec7e | ||
|
|
1fe0d4a94b | ||
|
|
cccce9d0ab | ||
|
|
c6401945d9 | ||
|
|
c6a69b763f | ||
|
|
080f0c7b22 | ||
|
|
2c6b323a62 | ||
|
|
b42d59b29c | ||
|
|
c8ff9bad93 | ||
|
|
7fbf6111e3 | ||
|
|
d75bd7b82c | ||
|
|
217f83fd56 | ||
|
|
6e3aa3357c | ||
|
|
e886404171 | ||
|
|
4a8c6d8a8b | ||
|
|
a827ab2d4e | ||
|
|
c3915b9798 | ||
|
|
c28b839c17 | ||
|
|
511862c4ee | ||
|
|
dce22ce5f6 | ||
|
|
edc91849cb | ||
|
|
f117721251 | ||
|
|
5df6babfad | ||
|
|
e4f43aa51b | ||
|
|
05f708c330 | ||
|
|
8f9f800dc5 | ||
|
|
83debbfda0 | ||
|
|
c1bec5c4de | ||
|
|
740a546249 | ||
|
|
a55236d383 | ||
|
|
e2464f462e | ||
|
|
177c0b4979 | ||
|
|
167741b80b | ||
|
|
f083e49a63 | ||
|
|
9380324a0f | ||
|
|
0778f623fb | ||
|
|
1adc834b10 | ||
|
|
c510fa79d0 | ||
|
|
02d63b7ec4 | ||
|
|
c35137040a | ||
|
|
3b673ef4b6 | ||
|
|
318a530dfa | ||
|
|
fa7dfc272a | ||
|
|
423683e7ef | ||
|
|
c078e11bcf | ||
|
|
61e1c5b546 | ||
|
|
4249dcd353 | ||
|
|
f76be581b3 | ||
|
|
faa003168c | ||
|
|
204ba86418 | ||
|
|
c435628b6a | ||
|
|
72e8f9d969 | ||
|
|
27c9abfae5 | ||
|
|
78361c1518 | ||
|
|
12dd87f96b | ||
|
|
2ddb2d4c89 | ||
|
|
3d901f5960 | ||
|
|
0859607b4e | ||
|
|
5352ad41c5 | ||
|
|
8f9cc6b827 | ||
|
|
a294ab4545 | ||
|
|
d08053d483 | ||
|
|
677d42f7ad | ||
|
|
b4fb1d3aca | ||
|
|
dd8ba490ee | ||
|
|
afd72ba541 | ||
|
|
463cda9a10 | ||
|
|
b5e0dbe8e8 | ||
|
|
6dc026c203 | ||
|
|
cc4ce5bbed | ||
|
|
95c4c77df1 | ||
|
|
c0a7ebf51b | ||
|
|
742b1cb65d | ||
|
|
229a1922d8 | ||
|
|
2b17528c5d | ||
|
|
61243967ac | ||
|
|
4cdf59532d | ||
|
|
b2405a9924 | ||
|
|
8812bf735e | ||
|
|
ac163a64fe | ||
|
|
412aee0be0 | ||
|
|
fea7ef937e | ||
|
|
03492bae52 | ||
|
|
e8c6b4e988 | ||
|
|
8d46c00125 | ||
|
|
2140a08e3e | ||
|
|
d06c003344 | ||
|
|
9740af8be4 | ||
|
|
5b57763788 | ||
|
|
69c303ea00 | ||
|
|
7d8de4e2ae | ||
|
|
cd0f5ccc93 | ||
|
|
6476a8d916 | ||
|
|
839c5ed577 | ||
|
|
21294eb228 | ||
|
|
71ab33eff4 | ||
|
|
4255c0f812 | ||
|
|
436716fdd7 | ||
|
|
f79577a7ec | ||
|
|
18b029ca88 | ||
|
|
2c868efbad | ||
|
|
39e9fc9e40 | ||
|
|
19e2f1bb33 | ||
|
|
af51b545ba | ||
|
|
582cf6cc8a | ||
|
|
06ccbca763 | ||
|
|
56a27a0647 | ||
|
|
4437132372 | ||
|
|
c5bbf91892 | ||
|
|
d4318aa0d8 | ||
|
|
80888a1b23 | ||
|
|
8d65e3e894 | ||
|
|
bb29041dce | ||
|
|
9c452f5b14 | ||
|
|
2bb5101112 | ||
|
|
ec9a75173b | ||
|
|
c551545f29 | ||
|
|
8baea68c6c | ||
|
|
e7aecdce71 | ||
|
|
61555c6ebd | ||
|
|
efef3af7b8 | ||
|
|
39fa1c4ac2 | ||
|
|
05f5cc3ea8 | ||
|
|
f57dde1ac3 | ||
|
|
d9bf8d252e | ||
|
|
8c4adbf98d | ||
|
|
4e884f439e | ||
|
|
78a7af3c0a | ||
|
|
b26b8efca4 | ||
|
|
0de11015cc | ||
|
|
6b05576d99 | ||
|
|
dee7261bbe | ||
|
|
1502bf6a2d | ||
|
|
e72e79694f | ||
|
|
b05ae77e41 | ||
|
|
7ff5dd56e8 | ||
|
|
c22414c1fd | ||
|
|
96a9af0a06 | ||
|
|
cec51daa04 | ||
|
|
c3b0bb21e9 | ||
|
|
cf57c817cb | ||
|
|
0de733b66a | ||
|
|
d16f726b15 | ||
|
|
d224153cba | ||
|
|
da3d4bf537 | ||
|
|
0c47ebe881 | ||
|
|
eaec0f1595 | ||
|
|
d5e2ac1fb6 | ||
|
|
1c25c8eed3 | ||
|
|
d83aa7f6ce | ||
|
|
4ba3178d8e | ||
|
|
5d23153aed | ||
|
|
adc009b832 | ||
|
|
c15a7c6b65 | ||
|
|
face6ff6af | ||
|
|
c38ea387e5 | ||
|
|
84a8d342f2 | ||
|
|
8d3a7244c3 | ||
|
|
b10c9b0357 | ||
|
|
6bcdfb11cc | ||
|
|
6a2938deaa | ||
|
|
ade0b3b21b | ||
|
|
e6ba27075e | ||
|
|
a4f6edab85 | ||
|
|
866a77a8cc | ||
|
|
b95ea1092e | ||
|
|
7f0ce79fae | ||
|
|
813ede0cd5 | ||
|
|
b845304ce2 | ||
|
|
9cc077638a | ||
|
|
573020678a | ||
|
|
48c23ad8ef | ||
|
|
1230588b98 | ||
|
|
0e50a0b6e0 | ||
|
|
80114dda35 | ||
|
|
a5f9a8fea0 | ||
|
|
7fa06fa566 | ||
|
|
47a771a7b1 | ||
|
|
82f3fe4147 | ||
|
|
54adf244dd | ||
|
|
b699e4f2aa | ||
|
|
5ba504f809 | ||
|
|
730f2528dc | ||
|
|
9731e496c8 | ||
|
|
d84fc559f2 | ||
|
|
527287aa29 | ||
|
|
758e8d40e5 | ||
|
|
0f13e5708b | ||
|
|
77c5b0f3b7 | ||
|
|
e571aec2ff | ||
|
|
46f65bcf49 | ||
|
|
47c1673092 | ||
|
|
d301c8e099 | ||
|
|
729cedc925 | ||
|
|
4a531aaba4 | ||
|
|
ded2e420b1 | ||
|
|
b9ae556f9f | ||
|
|
ce91f1869b | ||
|
|
0d0cc6bb83 | ||
|
|
665f0d6002 | ||
|
|
fcb367666d | ||
|
|
cbe8c84ec1 | ||
|
|
3fced333e8 | ||
|
|
6762396aec | ||
|
|
7625971974 | ||
|
|
24eef21756 | ||
|
|
64b63e44bf | ||
|
|
47e3808aa4 | ||
|
|
78ca83eb6f | ||
|
|
6556b06f23 | ||
|
|
a31835836d | ||
|
|
71a5782ab7 | ||
|
|
9a77a7dbaa | ||
|
|
955dd1e126 | ||
|
|
02f4f5e885 | ||
|
|
e08a0fab99 | ||
|
|
e4cee14aa6 | ||
|
|
0f1910891d | ||
|
|
1cc579cb5d | ||
|
|
e891659b21 | ||
|
|
bde03060a5 | ||
|
|
24aa904d99 | ||
|
|
5b2df4ce30 | ||
|
|
1ca488c3ec | ||
|
|
9117398452 | ||
|
|
1d1d7a5145 | ||
|
|
a14e1e8fd1 | ||
|
|
932d799e28 | ||
|
|
be9da7ef08 | ||
|
|
65a6fce75c | ||
|
|
041c7e246f | ||
|
|
5c226d0451 | ||
|
|
d70e358a94 | ||
|
|
5d5c7c6ae1 | ||
|
|
b0fcf28267 | ||
|
|
3a5d6ee433 | ||
|
|
7c39f9477f | ||
|
|
0076d85f5d | ||
|
|
ad2ca8dd4b | ||
|
|
a3230ce730 | ||
|
|
e13c2f535c | ||
|
|
7499b0cab0 | ||
|
|
74d47288c0 | ||
|
|
a47d722c07 | ||
|
|
85d858984b | ||
|
|
794e8b12eb | ||
|
|
288a74e55f | ||
|
|
4b35717b04 | ||
|
|
a2f678151d | ||
|
|
8a527d1ef5 | ||
|
|
1ce807d5de | ||
|
|
773c340514 | ||
|
|
50122b7078 | ||
|
|
3bbc507a3f | ||
|
|
cada67daeb | ||
|
|
af4dcb616d | ||
|
|
d4a1e97249 | ||
|
|
292003444d | ||
|
|
d9b467403a | ||
|
|
ff304c3890 | ||
|
|
42ad818e3f | ||
|
|
6117b83b55 | ||
|
|
1f4e239217 | ||
|
|
4819beb149 | ||
|
|
9279489413 | ||
|
|
1536dfda0a | ||
|
|
b2b1416fbc | ||
|
|
c3bc500240 | ||
|
|
0f87764827 | ||
|
|
978f3392c5 | ||
|
|
c88f903374 | ||
|
|
edcf1b59dd | ||
|
|
b95c7aa556 | ||
|
|
bfa69bbdb6 | ||
|
|
5706f0531b | ||
|
|
a48f2e209c | ||
|
|
13feb7278e | ||
|
|
15b0283650 | ||
|
|
e1839e5ec9 | ||
|
|
433b6ba3a4 | ||
|
|
1d1101eb7c | ||
|
|
67ea7f4b4d | ||
|
|
7633f09479 | ||
|
|
ce070ce422 | ||
|
|
f71338baf9 | ||
|
|
ecad667dda | ||
|
|
d9fd07929a | ||
|
|
d413a3078c | ||
|
|
4cb5e0a013 | ||
|
|
b2767c7d8a | ||
|
|
8e5f2dc929 | ||
|
|
2b082601a7 | ||
|
|
70c0ed512a | ||
|
|
8c2ed89aaa | ||
|
|
e315d65a7a | ||
|
|
0287c0f02f | ||
|
|
c2bace4b73 | ||
|
|
35f4d12763 | ||
|
|
9082e68d6f | ||
|
|
bdb4318f47 | ||
|
|
3ab035bab6 | ||
|
|
2cd5ad0c80 | ||
|
|
2640e5a27c | ||
|
|
0f949990c3 | ||
|
|
f544753bb8 | ||
|
|
d3db02da30 | ||
|
|
42c8e0fb2f | ||
|
|
bf48fca6a0 | ||
|
|
f8eb290da1 | ||
|
|
5f2240e7ab | ||
|
|
97faa83953 | ||
|
|
cdbffe3990 | ||
|
|
b114486bc1 | ||
|
|
e9c1bce50f | ||
|
|
87feda7c2a | ||
|
|
d25262ec4b | ||
|
|
861844761f | ||
|
|
43aa7e262c | ||
|
|
5e24016623 | ||
|
|
d023e105b7 | ||
|
|
abce0ef49d | ||
|
|
5c0d8a9de7 | ||
|
|
bea1b0d0af | ||
|
|
58a646be59 | ||
|
|
c7d8b8a377 | ||
|
|
d08702c9d2 | ||
|
|
a2b5437b01 | ||
|
|
0b0edc3e3d | ||
|
|
e419e5fe42 | ||
|
|
4e6a4b08bb | ||
|
|
3d2f365074 | ||
|
|
8ffca0475a | ||
|
|
ec3345bb57 | ||
|
|
4b3a19ea9f | ||
|
|
198b4a0fbd | ||
|
|
143d159982 | ||
|
|
63f9a3c946 | ||
|
|
3a5e8a8dd4 | ||
|
|
38a3063111 | ||
|
|
4cd93ab5f3 | ||
|
|
d248e2d188 | ||
|
|
f47fbd5f39 | ||
|
|
be0fcaaf49 | ||
|
|
4e5ac1fd5c | ||
|
|
1d1fab4ea2 | ||
|
|
f1bc6c4e18 | ||
|
|
b6ef9689b2 | ||
|
|
01927babe2 | ||
|
|
9ada30c207 | ||
|
|
43065a9e24 | ||
|
|
fce1b74105 | ||
|
|
562b6c3bbb | ||
|
|
1770dace34 | ||
|
|
5b40845afe | ||
|
|
fe258dec04 | ||
|
|
78cd63d9cf | ||
|
|
43b623c1f1 | ||
|
|
b5b8055cc0 | ||
|
|
da9c9a64c2 | ||
|
|
8c94b3f209 | ||
|
|
095f28a913 | ||
|
|
487f10f84d | ||
|
|
5800fc97b3 | ||
|
|
2254542010 | ||
|
|
d234ff6572 | ||
|
|
800eccc046 | ||
|
|
cd5d3abc32 | ||
|
|
272d85d0ad | ||
|
|
686186cabc | ||
|
|
06313a6288 | ||
|
|
dcf7d89b8e | ||
|
|
1b19608a5a | ||
|
|
e28c8ac612 | ||
|
|
99035ca96e | ||
|
|
c455d2af86 | ||
|
|
a422ea64ee | ||
|
|
34d30e28d6 | ||
|
|
3ad4c70d3a | ||
|
|
34937f13d5 | ||
|
|
c7add11fdc | ||
|
|
d329156ebc | ||
|
|
25b35261ca | ||
|
|
563874c06c | ||
|
|
b0acfb24dd | ||
|
|
599d2ff324 | ||
|
|
0856618ed5 | ||
|
|
bc0966a46f | ||
|
|
3498195ae2 | ||
|
|
fbf3cb0ac4 | ||
|
|
e6264a0992 | ||
|
|
0b37ab0362 | ||
|
|
57ae306457 | ||
|
|
fa5a40c8d5 | ||
|
|
a219b6de7a | ||
|
|
fa5057f9fb | ||
|
|
02f2d17e83 | ||
|
|
b351f29033 | ||
|
|
298c9a6c33 | ||
|
|
80d99b4d4e | ||
|
|
94fcabc4e3 | ||
|
|
5f1970433d | ||
|
|
b459f6a0a4 | ||
|
|
66062c2a8c | ||
|
|
8d4f95de45 | ||
|
|
d0f093e716 | ||
|
|
490798a26d | ||
|
|
eaa1474541 | ||
|
|
0e9502685a | ||
|
|
26be14b24d | ||
|
|
6f3460c767 | ||
|
|
cc080417b9 | ||
|
|
a00f371610 | ||
|
|
af66d521bd | ||
|
|
b9cb4af953 | ||
|
|
69d00dc5b0 | ||
|
|
f339d2d034 | ||
|
|
3069747a81 | ||
|
|
962015f7e7 | ||
|
|
b7333ea97a | ||
|
|
46c70ad734 | ||
|
|
3a7b6e1c22 | ||
|
|
9c1ad0a9f7 | ||
|
|
87dc201411 | ||
|
|
0ef4972295 | ||
|
|
cb881e6b3f | ||
|
|
45a484f0a2 | ||
|
|
99f4f6c3b0 | ||
|
|
e4b4831100 | ||
|
|
256fa5aa04 | ||
|
|
0ee2c42b55 | ||
|
|
1b352ca8a1 | ||
|
|
53af9e8b7a | ||
|
|
af04f40ee0 | ||
|
|
98b14843ba | ||
|
|
4395c22f3a | ||
|
|
610d6bdc62 | ||
|
|
8027dca501 | ||
|
|
81831032c3 | ||
|
|
daf25af47c | ||
|
|
6a5cee8f27 | ||
|
|
2096d0cfcb | ||
|
|
a79fbe62e4 | ||
|
|
381b066bd0 | ||
|
|
15b63bc89e | ||
|
|
fc8e14264c | ||
|
|
7e4f48139c | ||
|
|
cbd5a26e57 | ||
|
|
42e5974fd4 | ||
|
|
735abc0ed8 | ||
|
|
aa7678f32a | ||
|
|
b64cb9aaf1 | ||
|
|
8da9d8b4b8 | ||
|
|
3e4889d649 | ||
|
|
da0af5fd99 | ||
|
|
b02e35c19a | ||
|
|
3e8a5c5e28 | ||
|
|
8769903284 | ||
|
|
5c859b1117 | ||
|
|
2e7bea4a6a | ||
|
|
29734b924a | ||
|
|
6813ee02d7 | ||
|
|
fcb77de901 | ||
|
|
d05bd9edc8 | ||
|
|
27ba292774 | ||
|
|
a08e856804 | ||
|
|
c0e3fa0081 | ||
|
|
e5afa57cca | ||
|
|
e7fa566442 | ||
|
|
7c0333e12a | ||
|
|
8a775a32ba | ||
|
|
94e47c30a9 | ||
|
|
1664cce681 | ||
|
|
a2bf68981f | ||
|
|
15aa511b8e | ||
|
|
11ed2e2bf5 | ||
|
|
eb3767d58b | ||
|
|
f0c2364d01 | ||
|
|
ee344c3e4c | ||
|
|
64041e1669 | ||
|
|
469a5a71cd | ||
|
|
75090f10e5 | ||
|
|
22df2ae244 | ||
|
|
051965052c | ||
|
|
ee397ff107 | ||
|
|
15535cf52c | ||
|
|
682d9f9f09 | ||
|
|
a112be2fa0 | ||
|
|
9ec26a7d3e | ||
|
|
ba2c0f7adf | ||
|
|
5fb4d84a33 | ||
|
|
3e4a9d588b | ||
|
|
be2cbde560 | ||
|
|
66727632e8 | ||
|
|
ba28f462bc | ||
|
|
f08062b1de | ||
|
|
4f0840ab88 | ||
|
|
6a9d2538e0 | ||
|
|
f160522ab0 | ||
|
|
4d30379d36 | ||
|
|
4d12c8971b | ||
|
|
4506590557 | ||
|
|
1e7ed5c461 | ||
|
|
fced5cea43 | ||
|
|
9bc9571381 | ||
|
|
fb910e063c | ||
|
|
3b4a86aea4 | ||
|
|
94b678c949 | ||
|
|
c84a4c8bfa | ||
|
|
dfd59c183e | ||
|
|
718017d896 | ||
|
|
a0cb7b1ab1 | ||
|
|
0b886418c8 | ||
|
|
0371979a3e | ||
|
|
0407f034f0 | ||
|
|
d919ecd254 | ||
|
|
d8da63c929 | ||
|
|
eb3230f9db | ||
|
|
7dc5fdb390 | ||
|
|
ee68d6d1b0 | ||
|
|
d3fe22f0e1 | ||
|
|
7f47cb65d0 | ||
|
|
8b9af1be2f | ||
|
|
f5ca0587d1 | ||
|
|
a9660cf559 | ||
|
|
8107a6faa2 | ||
|
|
42000b9907 | ||
|
|
5d9a786b2f | ||
|
|
e88a569e83 | ||
|
|
4eab157502 |
@@ -1,4 +1,5 @@
|
||||
version: 2
|
||||
version: 2.1
|
||||
|
||||
aliases:
|
||||
- &restore-node-modules-cache
|
||||
keys:
|
||||
@@ -30,15 +31,31 @@ aliases:
|
||||
- &artifact_env_min
|
||||
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
|
||||
|
||||
jobs:
|
||||
build:
|
||||
working_directory: ~/babel
|
||||
- &test262_workdir
|
||||
working_directory: ~/babel/babel-test262-runner
|
||||
|
||||
- &artifact_test262_tap
|
||||
path: ~/test262.tap
|
||||
|
||||
- &artifact_test262_xunit
|
||||
path: ~/test-results
|
||||
|
||||
- &artifact_test262_diff_tap
|
||||
path: ~/diff.tap
|
||||
|
||||
executors:
|
||||
node-executor:
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
- image: circleci/node:13
|
||||
working_directory: ~/babel
|
||||
|
||||
jobs:
|
||||
test:
|
||||
executor: node-executor
|
||||
steps:
|
||||
- checkout
|
||||
- restore-cache: *restore-yarn-cache
|
||||
- restore-cache: *restore-node-modules-cache
|
||||
- restore_cache: *restore-yarn-cache
|
||||
- restore_cache: *restore-node-modules-cache
|
||||
- run: yarn --version
|
||||
- run: make test-ci-coverage
|
||||
# Builds babel-standalone with the regular Babel config
|
||||
@@ -54,3 +71,111 @@ jobs:
|
||||
- store_artifacts: *artifact_env_min
|
||||
- save_cache: *save-node-modules-cache
|
||||
- save_cache: *save-yarn-cache
|
||||
|
||||
test262:
|
||||
executor: node-executor
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Sync with latest master branch (only on PRs)
|
||||
command: |
|
||||
if [ -n "$CIRCLE_PULL_REQUEST" ]
|
||||
then
|
||||
git fetch origin refs/pull/$CIRCLE_PR_NUMBER/merge
|
||||
git checkout -qf FETCH_HEAD
|
||||
fi
|
||||
- restore_cache: *restore-yarn-cache
|
||||
- restore_cache: *restore-node-modules-cache
|
||||
- run:
|
||||
name: Build Babel
|
||||
command: BABEL_ENV=test make bootstrap
|
||||
- run:
|
||||
name: Setup Test Runner
|
||||
command: |
|
||||
git clone --recurse-submodules https://github.com/babel/babel-test262-runner
|
||||
cd babel-test262-runner
|
||||
yarn
|
||||
yarn add tap-mocha-reporter --dev
|
||||
node lib/download-node
|
||||
- run:
|
||||
name: Download master branch Test262 artifact
|
||||
command: node lib/download-master-artifact ~/master.tap
|
||||
<<: *test262_workdir
|
||||
- run:
|
||||
name: Run Test262
|
||||
command: BABEL_PATH=.. node lib/run-tests I_AM_SURE | tee ~/test262.tap
|
||||
<<: *test262_workdir
|
||||
- store_artifacts: *artifact_test262_tap
|
||||
- run:
|
||||
name: Output Test262 results
|
||||
command: |
|
||||
cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true
|
||||
<<: *test262_workdir
|
||||
- run:
|
||||
name: Compare previous master branch & current job results
|
||||
command: |
|
||||
mkdir -p ~/test-results/test262
|
||||
node lib/compare-results ~/master.tap ~/test262.tap | tee ~/diff.tap
|
||||
<<: *test262_workdir
|
||||
- store_artifacts: *artifact_test262_diff_tap
|
||||
- run:
|
||||
name: Output comparision results and report to CircleCI
|
||||
command: |
|
||||
mkdir -p ~/test-results/test262
|
||||
cat ~/diff.tap | $(npm bin)/tap-merge | $(npm bin)/tap-mocha-reporter xunit | tee ~/test-results/test262/results.xml
|
||||
<<: *test262_workdir
|
||||
- store_test_results: *artifact_test262_xunit
|
||||
|
||||
publish-verdaccio:
|
||||
executor: node-executor
|
||||
steps:
|
||||
- checkout
|
||||
- run: yarn install
|
||||
- run: ./scripts/integration-tests/publish-local.sh
|
||||
- persist_to_workspace:
|
||||
root: /tmp/verdaccio-workspace
|
||||
paths:
|
||||
- storage
|
||||
- htpasswd
|
||||
|
||||
e2e-babel:
|
||||
executor: node-executor
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: /tmp/verdaccio-workspace
|
||||
- run: ./scripts/integration-tests/e2e-babel.sh
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
test:
|
||||
jobs:
|
||||
- test
|
||||
test262-master:
|
||||
jobs:
|
||||
- test262:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
test262:
|
||||
jobs:
|
||||
- approve-test262-run:
|
||||
type: approval
|
||||
filters:
|
||||
branches:
|
||||
ignore:
|
||||
- master
|
||||
- test262:
|
||||
requires:
|
||||
- approve-test262-run
|
||||
filters:
|
||||
branches:
|
||||
ignore:
|
||||
- master
|
||||
e2e:
|
||||
jobs:
|
||||
- publish-verdaccio
|
||||
- e2e-babel:
|
||||
requires:
|
||||
- publish-verdaccio
|
||||
|
||||
@@ -6,7 +6,7 @@ charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
|
||||
[*.{js,json}]
|
||||
[*.{js,json,ts,tsx}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
||||
@@ -24,3 +24,8 @@ packages/babel-preset-env-standalone/babel-preset-env.min.js
|
||||
packages/babel-standalone/babel.js
|
||||
packages/babel-standalone/babel.min.js
|
||||
packages/babel-parser/test/expressions
|
||||
|
||||
eslint/*/lib
|
||||
eslint/*/node_modules
|
||||
eslint/*/test
|
||||
eslint/*/tests
|
||||
|
||||
48
.eslintrc.js
Normal file
48
.eslintrc.js
Normal file
@@ -0,0 +1,48 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
plugins: ["prettier", "@babel/development", "import"],
|
||||
extends: "babel",
|
||||
rules: {
|
||||
"prettier/prettier": "error",
|
||||
// TODO: remove after babel-eslint-config-internal is fully integrated into this repository.
|
||||
"max-len": "off",
|
||||
},
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
"packages/*/src/**/*.js",
|
||||
"codemods/*/src/**/*.js",
|
||||
"eslint/*/src/**/*.js",
|
||||
],
|
||||
rules: {
|
||||
"@babel/development/no-undefined-identifier": "error",
|
||||
"@babel/development/no-deprecated-clone": "error",
|
||||
"import/no-extraneous-dependencies": "error",
|
||||
"guard-for-in": "error",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
"packages/*/test/**/*.js",
|
||||
"codemods/*/test/**/*.js",
|
||||
"eslint/*/test/**/*.js",
|
||||
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
|
||||
"test/**/*.js",
|
||||
],
|
||||
env: {
|
||||
jest: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["packages/babel-plugin-*/src/index.js"],
|
||||
excludedFiles: ["packages/babel-plugin-transform-regenerator/**/*.js"],
|
||||
rules: {
|
||||
"@babel/development/plugin-name": "error",
|
||||
eqeqeq: ["error", "always", { null: "ignore" }],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"root": true,
|
||||
"plugins": ["prettier", "@babel/development", "import"],
|
||||
"extends": "babel",
|
||||
"rules": {
|
||||
"prettier/prettier": "error"
|
||||
},
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
|
||||
"rules": {
|
||||
"@babel/development/no-undefined-identifier": "error",
|
||||
"@babel/development/no-deprecated-clone": "error",
|
||||
"import/no-extraneous-dependencies": "error",
|
||||
"guard-for-in": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"packages/*/test/**/*.js",
|
||||
"codemods/*/test/**/*.js",
|
||||
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
|
||||
"test/**/*.js"
|
||||
],
|
||||
"env": {
|
||||
"jest": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["packages/babel-plugin-*/src/index.js"],
|
||||
"excludedFiles": ["packages/babel-plugin-transform-regenerator/**/*.js"],
|
||||
"rules": {
|
||||
"@babel/development/plugin-name": "error",
|
||||
"eqeqeq": ["error", "always", { "null": "ignore" }]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,4 +24,6 @@ suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
|
||||
suppress_type=$FlowFixMe
|
||||
suppress_type=$FlowSubtype
|
||||
esproposal.export_star_as=enable
|
||||
esproposal.optional_chaining=enable
|
||||
esproposal.nullish_coalescing=enable
|
||||
module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'
|
||||
|
||||
10
.github/CHANGELOG-6to5.md
vendored
10
.github/CHANGELOG-6to5.md
vendored
@@ -122,7 +122,7 @@
|
||||
* Restructure transformers so they're only ran if the AST contains nodes that they need to worry about. Improves transpilation speed significantly.
|
||||
* **Bug Fix**
|
||||
* Fix source maps not tracking end of node locations.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Use static super references as the home object is actually done at definition time.
|
||||
* **Polish**
|
||||
* Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is.
|
||||
@@ -479,7 +479,7 @@
|
||||
|
||||
## 2.12.3
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Optional `typeof` transformer checks for `undefined` before passing it to the helper.
|
||||
* Class methods are now named.
|
||||
|
||||
@@ -551,7 +551,7 @@
|
||||
* Add `classesFastSuper` optional transformer that doesn't support parent getters and prototype changing.
|
||||
* Add `forOfFast` transformer that speeds up `for...of` on arrays but produces more code.
|
||||
* Add `--react-compat` to `bin/6to5`.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Disallow setters without a single parameter.
|
||||
* Add `configurable` and `writable` to defined properties.
|
||||
* Use define instead of assignment for class methods.
|
||||
@@ -619,7 +619,7 @@
|
||||
|
||||
## 2.7.0
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Disallow reassignments of imports.
|
||||
* **New Feature**
|
||||
* `reactCompat` option to enable pre-v0.12 react components.
|
||||
@@ -662,7 +662,7 @@
|
||||
* **Polish**
|
||||
* Move `"use strict";` to inside module bodies instead of at the top of the file.
|
||||
* Better handling of dynamic imports.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Class inheritance now has a `function` or `null` type check.
|
||||
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
|
||||
|
||||
|
||||
6
.github/CHANGELOG-v4.md
vendored
6
.github/CHANGELOG-v4.md
vendored
@@ -110,7 +110,7 @@
|
||||
* Throw an error on different `babel` and `babel-runtime` versions.
|
||||
* Replicate module environment for `babel-node` eval.
|
||||
* Clean up classes output.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Make it illegal to use a rest parameter on a setter.
|
||||
|
||||
## 4.6.6
|
||||
@@ -150,8 +150,8 @@
|
||||
|
||||
* **New Feature**
|
||||
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
|
||||
* **Spec Compliancy**
|
||||
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliancy in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
|
||||
* **Spec Compliance**
|
||||
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliance in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
|
||||
* **Polish**
|
||||
* Rest parameters that are only referred to via number properties on member expressions are desugared into a direct `arguments` reference. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
|
||||
* `$ babel` no longer exits on syntax errors.
|
||||
|
||||
8
.github/CHANGELOG-v5.md
vendored
8
.github/CHANGELOG-v5.md
vendored
@@ -12,7 +12,7 @@
|
||||
|
||||
## 5.8.24
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
|
||||
* **Polish**
|
||||
* Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)!
|
||||
@@ -451,7 +451,7 @@ Issues with publish process.
|
||||
|
||||

|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Allow trailing param commas for methods when using the `es7.trailingCommas` transformer.
|
||||
* **Bug Fix**
|
||||
* Fix `es6.blockScoping` transformer not properly ignoring `break` in `SwitchCase`.
|
||||
@@ -481,7 +481,7 @@ Issues with publish process.
|
||||
* Fix correct function scope being passed to `nameMethod.property` when inferring the function name for class methods.
|
||||
* Fix incorrect extensions reference causing weird issues when using the Babel CLI.
|
||||
* Fix destructuring param reference replacements not inheriting from their original param.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Fix order that method decorators are ran in.
|
||||
|
||||
## 5.2.15
|
||||
@@ -616,7 +616,7 @@ Issues with publish process.
|
||||
* Fix `externalHelpers` option being incorrectly listed as type `string`.
|
||||
* **Internal**
|
||||
* Upgrade `core-js` to `0.9.0`.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Fix object decorators not using the `initializer` pattern.
|
||||
* Remove property initializer descriptor reflection.
|
||||
|
||||
|
||||
22
.github/CHANGELOG-v6.md
vendored
22
.github/CHANGELOG-v6.md
vendored
@@ -22,7 +22,7 @@
|
||||
> Backports for some folks (also other's when we accidentally merged PRs from both 6.x/master)
|
||||
> Lesson learned: just use `master` and backport on another branch.
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`, `babel-types`
|
||||
* [#6081](https://github.com/babel/babel/pull/6081) Flow opaque type 6.x backport. ([@jbrown215](https://github.com/jbrown215))
|
||||
|
||||
@@ -1468,7 +1468,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from
|
||||
|
||||
## v6.17.0 (2016-10-01)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-preset-stage-2`, `babel-preset-stage-3`
|
||||
* [#4617](https://github.com/babel/babel/pull/4617) Move async-generators to stage-3. ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
@@ -1476,7 +1476,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from
|
||||
|
||||
Specification repo: https://github.com/tc39/proposal-async-iteration
|
||||
|
||||
Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliancy) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39).
|
||||
Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliance) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39).
|
||||
|
||||
```js
|
||||
// async generator syntax
|
||||
@@ -1569,7 +1569,7 @@ First PR!
|
||||
|
||||
Babel 6.16: Happy 2nd Birthday 🎂!
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
|
||||
* `babel-core`, `babel-generator`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-types`, `babel-preset-stage-2`, ...
|
||||
* [#3473](https://github.com/babel/babel/pull/3473) via [#4576](https://github.com/babel/babel/pull/4576) Implement support for async generator functions and for-await statements. ([@zenparsing](https://github.com/zenparsing))
|
||||
@@ -2036,7 +2036,7 @@ It's also a lot folk's first PR (or first code PR)!
|
||||
* `babel-generator`, `babel-types`
|
||||
* [#3570](https://github.com/babel/babel/pull/3570) Add support for the new declare module.exports of flow. ([@danez](https://github.com/danez))
|
||||
|
||||
#### Spec Compliancy
|
||||
#### Spec Compliance
|
||||
* `babel-plugin-transform-es2015-modules-amd`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-modules-umd`
|
||||
* [#3518](https://github.com/babel/babel/pull/3518) Throw error for multiple exports default. ([@kaicataldo](https://github.com/kaicataldo))
|
||||
|
||||
@@ -2332,7 +2332,7 @@ Length: The number of characters in the output code
|
||||
* `babel-plugin-transform-react-jsx-self`, `babel-preset-react`
|
||||
* [#3540](https://github.com/babel/babel/pull/3540) Added jsx-self babel transform plugin. ([@jimfb](https://github.com/jimfb))
|
||||
|
||||
#### Spec Compliancy
|
||||
#### Spec Compliance
|
||||
* `babel-plugin-transform-es2015-unicode-regex`
|
||||
* [#3338](https://github.com/babel/babel/pull/3338) Update to `regexpu-core@2.0.0` for ES2016 compliance. ([@mathiasbynens](https://github.com/mathiasbynens))
|
||||
|
||||
@@ -3206,7 +3206,7 @@ Changes to note:
|
||||
- Reverting the class properties semicolon parser error.
|
||||
- Fix regression with plugin ordering with `babel-register`.
|
||||
|
||||
#### Spec Compliancy
|
||||
#### Spec Compliance
|
||||
* `babel-plugin-transform-class-properties`, `babylon`
|
||||
* [#3332](https://github.com/babel/babel/pull/3332) Revert to standard ASI behavior for class properties. ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
|
||||
@@ -3628,7 +3628,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
* `babel-plugin-transform-es2015-parameters`: [#3191](https://github.com/babel/babel/pull/3191) Fix the order of arguments initialization (fixes [T6809](http://phabricator.babeljs.io/T6809))
|
||||
* `babel-traverse`: [#3198](https://github.com/babel/babel/pull/3198) In `evaluate()`, it should not mistake lack of confidence for falsy
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* `babylon`, `babel-generator`, `babel-plugin-transform-regenerator`: [#3190](https://github.com/babel/babel/pull/3190): Remove `await *` from `babylon` and raise an error for that syntax since it was removed from the proposal and was causing an issue at runtime but not at compile time (fixes [T6688](http://phabricator.babeljs.io/T6688)).
|
||||
|
||||
* **Internal**
|
||||
@@ -3863,7 +3863,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
* Move `children` prop pushing to after props to ensure correct order in the react inline elements plugin.
|
||||
* Fix `buildExternalHelpers` script ignoring non-underscored helpers.
|
||||
* Fix exported classes with static class properties.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`.
|
||||
* **Polish**
|
||||
* Make interop for plugins with the `__esModule` work for all plugins no matter how they're imported/specified.
|
||||
@@ -3904,7 +3904,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
* **Polish**
|
||||
* Add npm 3 check to `babel-doctor`.
|
||||
* Autoclear the `babel/register` cache when it gets too big to be serialised.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Add support for flow existential type parameters.
|
||||
|
||||
## 6.1.1
|
||||
@@ -3969,7 +3969,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
|
||||
## 6.0.14
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Update exponentiation operator precedence.
|
||||
* Fix parser bug where arrow functions have a higher precedence than they should.
|
||||
* **Bug Fix**
|
||||
|
||||
12
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
12
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
@@ -9,6 +9,11 @@ assignees: ''
|
||||
|
||||
## Bug Report
|
||||
|
||||
<!--
|
||||
@babel/eslint-parser:
|
||||
If you are having issues with JSX you might want to check out eslint-plugin-react. If there's an issue with new experimental syntax you might need check if it's supported by @babel/eslint-plugin.
|
||||
-->
|
||||
|
||||
**Current Behavior**
|
||||
A clear and concise description of the behavior.
|
||||
|
||||
@@ -22,7 +27,8 @@ var your => (code) => here;
|
||||
**Expected behavior/code**
|
||||
A clear and concise description of what you expected to happen (or code).
|
||||
|
||||
**Babel Configuration (.babelrc, package.json, cli command)**
|
||||
**Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)**
|
||||
- Filename: `babel.config.js`
|
||||
|
||||
```js
|
||||
{
|
||||
@@ -31,6 +37,10 @@ A clear and concise description of what you expected to happen (or code).
|
||||
```
|
||||
|
||||
**Environment**
|
||||
<!--- Tip: Instead of filling out the questions below, you can run `npx envinfo --preset babel` and paste the result below ``` -->
|
||||
```
|
||||
|
||||
```
|
||||
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
|
||||
- Node/npm version: [e.g. Node 8/npm 5]
|
||||
- OS: [e.g. OSX 10.13.4, Windows 10]
|
||||
|
||||
12
.github/ISSUE_TEMPLATE/Regression-v7.md
vendored
12
.github/ISSUE_TEMPLATE/Regression-v7.md
vendored
@@ -26,7 +26,10 @@ A clear and concise description of what the regression is.
|
||||
var your => (code) => here;
|
||||
```
|
||||
|
||||
**Babel Configuration (.babelrc, package.json, cli command)**
|
||||
**Expected behavior/code**
|
||||
A clear and concise description of what you expected to happen (or code).
|
||||
|
||||
**Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command)**
|
||||
|
||||
```js
|
||||
{
|
||||
@@ -34,10 +37,11 @@ var your => (code) => here;
|
||||
}
|
||||
```
|
||||
|
||||
**Expected behavior/code**
|
||||
A clear and concise description of what you expected to happen (or code).
|
||||
|
||||
**Environment**
|
||||
<!--- Tip: Instead of filling out the questions below, you can run `npx envinfo --preset babel` and paste the result below ``` -->
|
||||
```
|
||||
|
||||
```
|
||||
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
|
||||
- Node/npm version: [e.g. Node 8/npm 5]
|
||||
- OS: [e.g. OSX 10.13.4, Windows 10]
|
||||
|
||||
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,6 +2,8 @@
|
||||
Before making a PR, please read our contributing guidelines
|
||||
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
|
||||
|
||||
Please note that the Babel Team requires two approvals before merging most PRs.
|
||||
|
||||
For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)
|
||||
|
||||
If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
|
||||
@@ -9,7 +11,7 @@ If you are making a change that should have a docs update: submit another PR to
|
||||
|
||||
| Q | A <!--(Can use an emoji 👍) -->
|
||||
| ------------------------ | ---
|
||||
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes to link the issues -->
|
||||
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes and write "Fixes" before the number to link the issues -->
|
||||
| Patch: Bug Fix? |
|
||||
| Major: Breaking Change? |
|
||||
| Minor: New Feature? |
|
||||
|
||||
16
.github/actions/create-release-tag/Dockerfile
vendored
16
.github/actions/create-release-tag/Dockerfile
vendored
@@ -1,16 +0,0 @@
|
||||
FROM debian:stable-slim
|
||||
|
||||
LABEL "name"="create-release-tag"
|
||||
LABEL "version"="0.0.1"
|
||||
|
||||
LABEL "com.github.actions.name"="Create release tag"
|
||||
LABEL "com.github.actions.description"="Creates a release tag equal to the last commit message"
|
||||
LABEL "com.github.actions.icon"="tag"
|
||||
LABEL "com.github.actions.color"="gray-dark"
|
||||
|
||||
ADD entrypoint.sh /action/entrypoint.sh
|
||||
|
||||
RUN chmod +x /action/entrypoint.sh
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends git
|
||||
|
||||
ENTRYPOINT ["/action/entrypoint.sh"]
|
||||
14
.github/actions/create-release-tag/entrypoint.sh
vendored
14
.github/actions/create-release-tag/entrypoint.sh
vendored
@@ -1,14 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# GitHub doesn't support running actions on new tags yet: we need to run it on the commit.
|
||||
# For this reason, we can't be sure that the tag already exists. We can use the commit
|
||||
# message to create the tag. If the tag already exists locally, they won't conflict because
|
||||
# they have the same name and are on the same commit.
|
||||
|
||||
echo "INFO: Getting release version..."
|
||||
tag_name=$(git log --oneline --format=%B -1 $GITHUB_SHA)
|
||||
|
||||
echo "INFO: Creating new tag..."
|
||||
(git tag $tag_name $GITHUB_SHA) || echo "INFO: Tag already exists"
|
||||
16
.github/actions/filter-commit-message/Dockerfile
vendored
16
.github/actions/filter-commit-message/Dockerfile
vendored
@@ -1,16 +0,0 @@
|
||||
FROM debian:stable-slim
|
||||
|
||||
LABEL "name"="filter"
|
||||
LABEL "version"="1.1.0"
|
||||
|
||||
LABEL "com.github.actions.name"="Filter commit message"
|
||||
LABEL "com.github.actions.description"="Stop a workflow if the message of the current commit doesn't match the pattern"
|
||||
LABEL "com.github.actions.icon"="filter"
|
||||
LABEL "com.github.actions.color"="gray-dark"
|
||||
|
||||
ADD entrypoint.sh /action/entrypoint.sh
|
||||
|
||||
RUN chmod +x /action/entrypoint.sh
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends git
|
||||
|
||||
ENTRYPOINT ["/action/entrypoint.sh"]
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
pattern=$1
|
||||
message=$(git log --oneline --format=%B -1 $GITHUB_SHA)
|
||||
|
||||
if echo "$message" | grep -Pq "$pattern"; then
|
||||
echo "INFO: $message matches $pattern"
|
||||
exit 0
|
||||
else
|
||||
echo "INFO: $message does not match $pattern"
|
||||
# 78 is the "neutral" exit status
|
||||
exit 78
|
||||
fi
|
||||
@@ -1,19 +0,0 @@
|
||||
FROM node:10
|
||||
|
||||
LABEL "name" = "trigger-github-release"
|
||||
LABEL "version" = "0.0.1"
|
||||
|
||||
LABEL "com.github.actions.name" = "Trigger GitHub release"
|
||||
LABEL "com.github.actions.description" = "Trigger a new GitHub release and generate the changelog using lerna-changelog."
|
||||
LABEL "com.github.actions.icon" = "tag"
|
||||
LABEL "com.github.actions.color" = "yellow"
|
||||
|
||||
ADD entrypoint.sh /action/entrypoint.sh
|
||||
ADD package.json /action/package.json
|
||||
ADD package-lock.json /action/package-lock.json
|
||||
ADD release.js /action/release.js
|
||||
ADD update-changelog.js /action/update-changelog.js
|
||||
|
||||
RUN chmod +x /action/entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/action/entrypoint.sh"]
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
echo "INFO: Installing action dependencies..."
|
||||
(cd /action; npm ci)
|
||||
|
||||
echo "INFO: Getting release version..."
|
||||
current_tag=$(git describe --abbrev=0 --tags $GITHUB_SHA)
|
||||
|
||||
last_tag=$(git describe --abbrev=0 --tags $current_tag^)
|
||||
echo "INFO: New version is $current_tag; last version is $last_tag."
|
||||
|
||||
echo "INFO: Generating the changelog..."
|
||||
|
||||
# lerna-changelog expects the token to be provided as GITHUB_AUTH,
|
||||
# but GitHub actions don't allow to predefine custom env vars prefixed with
|
||||
# GITHUB_. We need to define it here.
|
||||
changelog=$(
|
||||
GITHUB_AUTH="$GITHUB_TOKEN" \
|
||||
node /action/node_modules/.bin/lerna-changelog --tag-from $last_tag --tag-to $current_tag
|
||||
)
|
||||
|
||||
echo "INFO: Publishing the new GitHub release..."
|
||||
echo "$changelog" | node /action/release $current_tag
|
||||
|
||||
echo "INFO: Updating CHANGELOG.md..."
|
||||
echo "$changelog" | node /action/update-changelog
|
||||
|
||||
echo "INFO: Committing changelog..."
|
||||
git add CHANGELOG.md
|
||||
git -c user.name="$COMMIT_AUTHOR_NAME" -c user.email="$COMMIT_AUTHOR_EMAIL" \
|
||||
commit -m "Add $current_tag to CHANGELOG.md [skip ci]" --no-verify --quiet
|
||||
|
||||
echo "INFO: Pushing updates..."
|
||||
git push "https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" master
|
||||
|
||||
echo "INFO: Done! Don't forget to thank new contributors :)"
|
||||
1415
.github/actions/trigger-github-release/package-lock.json
generated
vendored
1415
.github/actions/trigger-github-release/package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@internal/trigger-github-release",
|
||||
"version": "0.0.1",
|
||||
"author": "Nicolò Ribaudo <nicolo.ribaudo@gmail.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@octokit/rest": "^16.3.0",
|
||||
"get-stdin": "^6.0.0",
|
||||
"lerna-changelog": "^0.8.2"
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const [ /* node */, /* file */, tag ] = process.argv;
|
||||
|
||||
const getStdin = require("get-stdin");
|
||||
const octokit = require("@octokit/rest")();
|
||||
|
||||
octokit.authenticate({
|
||||
type: "token",
|
||||
token: process.env.GITHUB_TOKEN
|
||||
});
|
||||
|
||||
const [ repoOwner, repoName ] = process.env.GITHUB_REPOSITORY.split("/");
|
||||
|
||||
getStdin()
|
||||
.then(changelog => octokit.repos.createRelease({
|
||||
owner: repoOwner,
|
||||
repo: repoName,
|
||||
tag_name: tag,
|
||||
body: changelog,
|
||||
draft: true,
|
||||
}))
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const getStdin = require("get-stdin");
|
||||
const fs = require("fs").promises;
|
||||
const path = require("path");
|
||||
|
||||
const { GITHUB_WORKSPACE } = process.env;
|
||||
|
||||
const INSERTION_POINT = "<!-- insert-new-changelog-here -->";
|
||||
const CHANGELOG = path.resolve(GITHUB_WORKSPACE, "CHANGELOG.md");
|
||||
|
||||
main();
|
||||
async function main() {
|
||||
let [stdin, changelog] = await Promise.all([
|
||||
getStdin(),
|
||||
fs.readFile(CHANGELOG, "utf8"),
|
||||
]);
|
||||
|
||||
if (!changelog.includes(INSERTION_POINT)) {
|
||||
throw new Error(`Missing "${INSERTION_POINT}" in CHANGELOG.md`);
|
||||
}
|
||||
|
||||
// Remove committers
|
||||
stdin = stdin.split("\n\n#### Committers")[0];
|
||||
changelog = changelog.replace(
|
||||
INSERTION_POINT,
|
||||
INSERTION_POINT + "\n" + stdin
|
||||
);
|
||||
|
||||
await fs.writeFile(CHANGELOG, changelog);
|
||||
}
|
||||
2
.github/lock.yml
vendored
2
.github/lock.yml
vendored
@@ -4,7 +4,7 @@
|
||||
daysUntilLock: 91
|
||||
# Comment to post before locking. Set to `false` to disable
|
||||
lockComment: false
|
||||
only: issues
|
||||
# The label to be applied when an issue is locked
|
||||
lockLabel: 'outdated'
|
||||
|
||||
# Issues or pull requests with these labels will not be locked
|
||||
|
||||
53
.github/main.workflow
vendored
53
.github/main.workflow
vendored
@@ -1,53 +0,0 @@
|
||||
workflow "Release" {
|
||||
on = "push"
|
||||
resolves = [
|
||||
"Trigger GitHub release",
|
||||
# GitHub actions are too slow for this, it takes more than 15 mins.
|
||||
# Publishing to npm from GH actions is a cool idea, but it's a lot faster to
|
||||
# publish locally.
|
||||
# "Publish to npm",
|
||||
]
|
||||
}
|
||||
|
||||
action "Trigger GitHub release" {
|
||||
uses = "./.github/actions/trigger-github-release/"
|
||||
secrets = ["GITHUB_TOKEN"]
|
||||
env = {
|
||||
COMMIT_AUTHOR_NAME = "Babel Bot"
|
||||
COMMIT_AUTHOR_EMAIL = "babel-bot@users.noreply.github.com"
|
||||
}
|
||||
needs = ["Create release tag"]
|
||||
}
|
||||
|
||||
action "Publish to npm" {
|
||||
uses = "docker://node:10"
|
||||
secrets = ["NPM_TOKEN"]
|
||||
runs = "make"
|
||||
args = "publish-ci"
|
||||
env = {
|
||||
CI = "true"
|
||||
}
|
||||
needs = ["Create release tag"]
|
||||
}
|
||||
|
||||
# When GitHub Actions will support the "release" event for public
|
||||
# repositories, we won't need this checks anymore.
|
||||
action "Create release tag" {
|
||||
uses = "./.github/actions/create-release-tag"
|
||||
needs = [
|
||||
"Is version commit",
|
||||
"On master branch",
|
||||
]
|
||||
}
|
||||
|
||||
action "Is version commit" {
|
||||
uses = "./.github/actions/filter-commit-message"
|
||||
# This regex is run using "grep -P".
|
||||
# The (-\\S+) part is for 7.0.0-beta.1 releases.
|
||||
args = "^v(\\d+\\.){2}\\d+(-\\S+)?$"
|
||||
}
|
||||
|
||||
action "On master branch" {
|
||||
uses = "actions/bin/filter@master"
|
||||
args = "branch master"
|
||||
}
|
||||
81
.github/workflows/issue-triage.yml
vendored
Normal file
81
.github/workflows/issue-triage.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: Issue Triage
|
||||
|
||||
on:
|
||||
issues:
|
||||
types: [opened, labeled]
|
||||
|
||||
jobs:
|
||||
welcome:
|
||||
name: Welcome comment
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if Babel member
|
||||
id: is_babel_member
|
||||
if: github.event.action == 'opened'
|
||||
uses: babel/actions/is-org-member@v2
|
||||
with:
|
||||
org: babel
|
||||
username: ${{ github.event.issue.user.login }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Create Welcome Comment
|
||||
uses: babel/actions/create-comment@v2
|
||||
if: |
|
||||
github.event.action == 'opened' &&
|
||||
steps.is_babel_member.outputs.result == 0
|
||||
with:
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
issue: ${{ github.event.issue.number }}
|
||||
comment: >
|
||||
Hey @${{ github.event.issue.user.login }}!
|
||||
We really appreciate you taking the time to report an issue. The
|
||||
collaborators on this project attempt to help as many people as
|
||||
possible, but we're a limited number of volunteers, so it's
|
||||
possible this won't be addressed swiftly.
|
||||
|
||||
|
||||
If you need any help, or just have general Babel or JavaScript questions, we have a
|
||||
vibrant [Slack community](https://babeljs.slack.com) that typically always has someone
|
||||
willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite."
|
||||
|
||||
needs_info:
|
||||
name: Needs Info
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Create Needs Info Comment
|
||||
uses: babel/actions/create-comment@v2
|
||||
if: |
|
||||
github.event.action == 'labeled' &&
|
||||
github.event.label.name == 'Needs Info'
|
||||
with:
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
issue: ${{ github.event.issue.number }}
|
||||
comment: >
|
||||
Hi @${{ github.event.issue.user.login }}!
|
||||
This issue is missing some important information we'll need
|
||||
to be able to reproduce this issue.
|
||||
|
||||
|
||||
Please understand that we receive a high volume of issues,
|
||||
and there are only a limited number of volunteers that help
|
||||
maintain this project. The easier it is for us to decipher an
|
||||
issue with the info provided, the more likely it is that we'll
|
||||
be able to help.
|
||||
|
||||
|
||||
Please make sure you have the following information documented in
|
||||
this ticket:
|
||||
|
||||
1. Your Babel configuration (typically from `.babelrc` or `babel.config.js`)
|
||||
|
||||
2. The current (incorrect) behavior you're seeing
|
||||
|
||||
3. The behavior you expect
|
||||
|
||||
4. A [short, self-contained example](http://sscce.org/)
|
||||
|
||||
|
||||
Please provide either a link to the problem via the
|
||||
[`repl`](https://babeljs.io/repl/), or if the `repl` is
|
||||
insufficient, a new and minimal repository with instructions on
|
||||
how to build/replicate the issue.
|
||||
|
||||
53
.github/workflows/release.yml
vendored
Normal file
53
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["v*"]
|
||||
|
||||
jobs:
|
||||
github_release:
|
||||
name: Trigger GitHub release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the new tag
|
||||
uses: actions/checkout@v1.0.0
|
||||
|
||||
- name: Get tag info
|
||||
id: tags
|
||||
uses: babel/actions/get-release-tags@v2
|
||||
|
||||
- name: Generate the changelog
|
||||
id: changelog
|
||||
uses: babel/actions/generate-lerna-changelog@v2
|
||||
with:
|
||||
from: ${{ steps.tags.outputs.old }}
|
||||
to: ${{ steps.tags.outputs.new }}
|
||||
env:
|
||||
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create a draft GitHub release
|
||||
uses: babel/actions/publish-github-release@v2
|
||||
with:
|
||||
tag: ${{ steps.tags.outputs.new }}
|
||||
changelog: ${{ steps.changelog.outputs.changelog }}
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
|
||||
- name: Check if releasing from master
|
||||
id: is_master
|
||||
uses: babel/actions/ref-matches-branch@v2
|
||||
with:
|
||||
name: master
|
||||
|
||||
- name: Update CHANGELOG.md
|
||||
if: steps.is_master.outputs.result == 1
|
||||
uses: babel/actions/update-changelog@v2
|
||||
with:
|
||||
changelog: ${{ steps.changelog.outputs.changelog }}
|
||||
|
||||
- name: Commit CHANGELOG.md
|
||||
if: steps.is_master.outputs.result == 1
|
||||
run: |
|
||||
git add CHANGELOG.md
|
||||
git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \
|
||||
commit -m "Add ${{ steps.tags.outputs.new }} to CHANGELOG.md [skip ci]" --no-verify --quiet
|
||||
git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" master
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -60,3 +60,8 @@ packages/babel-preset-env-standalone/babel-preset-env.min.js
|
||||
/packages/babel-parser/build
|
||||
.idea/
|
||||
/.changelog
|
||||
|
||||
/eslint/*/lib
|
||||
/eslint/*/node_modules
|
||||
/eslint/*/LICENSE
|
||||
!/packages/babel-eslint-plugin/LICENSE
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
"**/codemods/*/src/**/*.js",
|
||||
"**/codemods/*/test/**/*.js",
|
||||
"**/packages/*/src/**/*.js",
|
||||
"**/packages/*/test/**/*.js"
|
||||
"**/packages/*/test/**/*.js",
|
||||
"**/eslint/*/src/**/*.js",
|
||||
"**/eslint/*/test/**/*.js"
|
||||
],
|
||||
"parser": "babylon",
|
||||
"options": {
|
||||
"parser": "babel",
|
||||
"trailingComma": "all"
|
||||
}
|
||||
}]
|
||||
|
||||
42
.travis.yml
42
.travis.yml
@@ -3,41 +3,43 @@ git:
|
||||
language: node_js
|
||||
cache:
|
||||
yarn: true
|
||||
node_js:
|
||||
# We test the latest version on circleci
|
||||
- '11'
|
||||
- '10'
|
||||
- '8'
|
||||
- '6'
|
||||
|
||||
os: linux
|
||||
|
||||
env:
|
||||
global:
|
||||
- PATH=$HOME/.yarn/bin:$PATH
|
||||
- JOB=test
|
||||
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
|
||||
install:
|
||||
# the `make test-ci` script runs this command already
|
||||
- if [ "$JOB" != "test" ] && [ "$JOB" != "lint" ]; then yarn install; fi
|
||||
- if [ "$JOB" = "lint" ]; then make bootstrap; fi
|
||||
|
||||
install: skip
|
||||
before_script:
|
||||
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make bootstrap-flow; fi
|
||||
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make bootstrap-test262; fi
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi
|
||||
|
||||
script:
|
||||
- if [ "$JOB" = "test" ]; then make test-ci; fi
|
||||
- if [ "$JOB" = "lint" ]; then make lint && make flow; fi
|
||||
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make test-flow-ci; fi
|
||||
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make test-test262-ci; fi
|
||||
- if [ "$JOB" = "test" ]; then make -j test-ci; fi
|
||||
- if [ "$JOB" = "lint" ]; then make -j code-quality-ci; fi
|
||||
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make -j test-flow-ci; fi
|
||||
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make -j test-test262-ci; fi
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- node_js: "node"
|
||||
env: JOB=lint
|
||||
# We test the latest version on circleci
|
||||
- node_js: "12"
|
||||
# Move `windows` build to be the third since it is slow
|
||||
- os: windows
|
||||
node_js: "node"
|
||||
env:
|
||||
- JOB=test
|
||||
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9
|
||||
- YARN_GPG=no
|
||||
# Continue node_js matrix
|
||||
- node_js: "6"
|
||||
- node_js: "10"
|
||||
- node_js: "8"
|
||||
- node_js: "node"
|
||||
env: JOB=babel-parser-flow-tests
|
||||
- node_js: "node"
|
||||
|
||||
439
CHANGELOG.md
439
CHANGELOG.md
@@ -2,7 +2,7 @@
|
||||
|
||||
> **Tags:**
|
||||
> - :boom: [Breaking Change]
|
||||
> - :eyeglasses: [Spec Compliancy]
|
||||
> - :eyeglasses: [Spec Compliance]
|
||||
> - :rocket: [New Feature]
|
||||
> - :bug: [Bug Fix]
|
||||
> - :memo: [Documentation]
|
||||
@@ -13,11 +13,402 @@ _Note: Gaps between patch versions are faulty, broken or test releases._
|
||||
|
||||
See [CHANGELOG - v4](/.github/CHANGELOG-v4.md), [CHANGELOG - v5](/.github/CHANGELOG-v5.md), and [CHANGELOG - v6](/.github/CHANGELOG-v6.md) for v4.x-v6.x changes.
|
||||
See [CHANGELOG - 6to5](/.github/CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0.0-beta.29 version changelog.
|
||||
See [Babylon's CHANGELOG](packages/babel-parser/CHANGELOG.md) for the Babylon pre-7.0.0-beta.29 version changelog.
|
||||
See [`babel-eslint`'s releases](https://github.com/babel/babel-eslint/releases) for the changelog before `@babel/eslint-parser` 7.8.0.
|
||||
See [`eslint-plugin-babel`'s releases](https://github.com/babel/eslint-plugin-babel/releases) for the changelog before `@babel/eslint-plugin` 7.8.0.
|
||||
|
||||
<!-- DO NOT CHANGE THESE COMMENTS - See .github/actions/trigger-github-release/update-changelog.js -->
|
||||
<!-- insert-new-changelog-here -->
|
||||
|
||||
## v7.7.4 (2019-11-23)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-runtime-corejs2`, `babel-runtime-corejs3`, `babel-runtime`
|
||||
* [#10748](https://github.com/babel/babel/pull/10748) Add support for native esm to @babel/runtime. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-preset-env`
|
||||
* [#10742](https://github.com/babel/babel/pull/10742) Update preset-env mappings. ([@existentialism](https://github.com/existentialism))
|
||||
* `babel-parser`
|
||||
* [#10737](https://github.com/babel/babel/pull/10737) Flow enums: fix enum body location. ([@gkz](https://github.com/gkz))
|
||||
* [#10657](https://github.com/babel/babel/pull/10657) Fix some incorrect typeof parsing in flow. ([@existentialism](https://github.com/existentialism))
|
||||
* [#10582](https://github.com/babel/babel/pull/10582) [parser] Allow optional async methods. ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
|
||||
* [#10710](https://github.com/babel/babel/pull/10710) register import equals specifier. ([@JLHwung](https://github.com/JLHwung))
|
||||
* [#10592](https://github.com/babel/babel/pull/10592) Allow TypeScript type assertions in array destructuring. ([@SakibulMowla](https://github.com/SakibulMowla))
|
||||
* `babel-preset-env-standalone`
|
||||
* [#10732](https://github.com/babel/babel/pull/10732) fix: add missing available plugins to babel-preset-env-standalone. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-umd`, `babel-preset-env`
|
||||
* [#10701](https://github.com/babel/babel/pull/10701) Circumvent typeof transform for umd build template. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-cli`
|
||||
* [#10698](https://github.com/babel/babel/pull/10698) Babel should not silently remove unknown options after commander arguments. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-plugin-proposal-optional-chaining`
|
||||
* [#10694](https://github.com/babel/babel/pull/10694) Fix optional method chaining in derived classes. ([@Shriram-Balaji](https://github.com/Shriram-Balaji))
|
||||
* `babel-parser`, `babel-types`
|
||||
* [#10677](https://github.com/babel/babel/pull/10677) Add `asserts this [is type]` parsing support. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-traverse`
|
||||
* [#10598](https://github.com/babel/babel/pull/10598) Fix parentheses on replaceWithMultiple for JSX. ([@khoumani](https://github.com/khoumani))
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10683](https://github.com/babel/babel/pull/10683) Fix: Don't call Object.keys on non-objects (babel#10482). ([@chrishinrichs](https://github.com/chrishinrichs))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-plugin-proposal-nullish-coalescing-operator`
|
||||
* [#10720](https://github.com/babel/babel/pull/10720) polish: skip creating extra reference for safely re-used node. ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
#### :house: Internal
|
||||
* Other
|
||||
* [#10731](https://github.com/babel/babel/pull/10731) Removed duplicate key in package.json. ([@rajasekarm](https://github.com/rajasekarm))
|
||||
* [#10718](https://github.com/babel/babel/pull/10718) chore: use loose mode of transform. ([@JLHwung](https://github.com/JLHwung))
|
||||
* [#10579](https://github.com/babel/babel/pull/10579) Implement PR workflow for running test262 on babel PRs. ([@jbhoosreddy](https://github.com/jbhoosreddy))
|
||||
* [#10648](https://github.com/babel/babel/pull/10648) bump @babel/* dev dependencies. ([@JLHwung](https://github.com/JLHwung))
|
||||
* [#10569](https://github.com/babel/babel/pull/10569) E2E test Babel with itself before publishing. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-core`
|
||||
* [#10668](https://github.com/babel/babel/pull/10668) Reduce standalone build size. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-plugin-transform-literals`, `babel-preset-env-standalone`
|
||||
* [#10725](https://github.com/babel/babel/pull/10725) fix typo [ci-skip]. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-cli`
|
||||
* [#10692](https://github.com/babel/babel/pull/10692) Add missing flow type to babel-cli for consistency. ([@ZYSzys](https://github.com/ZYSzys))
|
||||
|
||||
## v7.7.3 (2019-11-08)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-parser`
|
||||
* [#10682](https://github.com/babel/babel/pull/10682) Don't recover from "adjacent jsx elements" parser error ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
## v7.7.2 (2019-11-07)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-parser`
|
||||
* [#10669](https://github.com/babel/babel/pull/10669) Parse arrows with params annotations in conditional expressions ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#10658](https://github.com/babel/babel/pull/10658) fix: remove accessibility of constructor ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-traverse`
|
||||
* [#10656](https://github.com/babel/babel/pull/10656) fix: add inList setter for compatibility with babel-minify ([@JLHwung](https://github.com/JLHwung))
|
||||
## v7.7.1 (2019-11-05)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-types`
|
||||
* [#10650](https://github.com/babel/babel/pull/10650) Revert "throw a TypeError if identifier validation fails (#10621)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-preset-env`
|
||||
* [#10649](https://github.com/babel/babel/pull/10649) Fix(babel-preset-env): check api.caller is a function to avoid to thr… ([@love2me](https://github.com/love2me))
|
||||
|
||||
## v7.7.0 (2019-11-05)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-types`
|
||||
* [#10621](https://github.com/babel/babel/pull/10621) throw a TypeError if identifier validation fails. ([@dentrado](https://github.com/dentrado))
|
||||
* `babel-parser`
|
||||
* [#10559](https://github.com/babel/babel/pull/10559) fix: Exclude catch clause from let identifier error. ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
|
||||
* [#10567](https://github.com/babel/babel/pull/10567) [parser] Exception to 8 and 9 in tagged template. ([@pnowak](https://github.com/pnowak))
|
||||
* [#10532](https://github.com/babel/babel/pull/10532) Allow duplicate __proto__ keys in patterns, simple case (#6705). ([@alejo90](https://github.com/alejo90))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-parser`, `babel-plugin-transform-typescript`, `babel-preset-typescript`, `babel-types`
|
||||
* [#10545](https://github.com/babel/babel/pull/10545) Add support for TS declare modifier on fields. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-core`, `babel-parser`, `babel-preset-typescript`
|
||||
* [#10363](https://github.com/babel/babel/pull/10363) @babel/parser error recovery. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-core`
|
||||
* [#10599](https://github.com/babel/babel/pull/10599) Add support for .cjs config files. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#10501](https://github.com/babel/babel/pull/10501) Add support for babel.config.json. ([@devongovett](https://github.com/devongovett))
|
||||
* [#10361](https://github.com/babel/babel/pull/10361) feat: if code frame error is on a single line, highlight the whole path. ([@SimenB](https://github.com/SimenB))
|
||||
* `babel-plugin-syntax-top-level-await`, `babel-preset-env`
|
||||
* [#10573](https://github.com/babel/babel/pull/10573) Create @babel/plugin-syntax-top-level-await. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-helper-builder-react-jsx`, `babel-plugin-transform-react-jsx`, `babel-preset-react`
|
||||
* [#10572](https://github.com/babel/babel/pull/10572) [transform-react-jsx] Add useSpread option to transform JSX. ([@ivandevp](https://github.com/ivandevp))
|
||||
* `babel-generator`, `babel-parser`, `babel-plugin-proposal-decorators`, `babel-plugin-syntax-flow`, `babel-types`
|
||||
* [#10344](https://github.com/babel/babel/pull/10344) Flow enums parsing. ([@gkz](https://github.com/gkz))
|
||||
* `babel-plugin-transform-function-name`, `babel-plugin-transform-modules-umd`, `babel-preset-env`
|
||||
* [#10477](https://github.com/babel/babel/pull/10477) Changes UMD callsite to be more likely to pass in the intended object.. ([@MicahZoltu](https://github.com/MicahZoltu))
|
||||
* `babel-parser`
|
||||
* [#10449](https://github.com/babel/babel/pull/10449) Create parser plugin "topLevelAwait". ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#10521](https://github.com/babel/babel/pull/10521) [parser] Enable "exportNamespaceFrom" by default. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#10483](https://github.com/babel/babel/pull/10483) [parser] Add support for private fields in TypeScript. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-generator`, `babel-parser`, `babel-types`
|
||||
* [#10543](https://github.com/babel/babel/pull/10543) add assertions signature for TypeScript. ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-cli`, `babel-register`
|
||||
* [#8622](https://github.com/babel/babel/pull/8622) Make dir for babel --out-file. ([@TrySound](https://github.com/TrySound))
|
||||
* `babel-cli`
|
||||
* [#10399](https://github.com/babel/babel/pull/10399) Closes [#8326](https://github.com/babel/babel/issues/8326), add back --quiet option.. ([@chris-peng-1244](https://github.com/chris-peng-1244))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-proposal-async-generator-functions`, `babel-plugin-proposal-function-sent`, `babel-preset-env`
|
||||
* [#10422](https://github.com/babel/babel/pull/10422) Correctly delegate .return() in async generator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs`
|
||||
* [#10628](https://github.com/babel/babel/pull/10628) Don't throw when destructuring into a var named as an import. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-modules-systemjs`
|
||||
* [#10638](https://github.com/babel/babel/pull/10638) fix: remove ExportNamedDeclaration when the specifier is empty. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-parser`
|
||||
* [#10631](https://github.com/babel/babel/pull/10631) [TS] Parse calls with type args in optional chains. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#10607](https://github.com/babel/babel/pull/10607) fixed missing errors on assignment pattern in object expression. ([@vivek12345](https://github.com/vivek12345))
|
||||
* [#10594](https://github.com/babel/babel/pull/10594) [parser] Parse only modifiers of actual methods. ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#10555](https://github.com/babel/babel/pull/10555) [TS] Correctly transform computed strings and templates in enums. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-core`
|
||||
* [#10623](https://github.com/babel/babel/pull/10623) Fix: inputSourceMap should work when it is an external file. ([@JLHwung](https://github.com/JLHwung))
|
||||
* [#10539](https://github.com/babel/babel/pull/10539) fix: remove filename annotation in buildCodeFrameError. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-plugin-proposal-decorators`
|
||||
* [#10578](https://github.com/babel/babel/pull/10578) [decorators] fix: support string literal properties. ([@mwhitworth](https://github.com/mwhitworth))
|
||||
* `babel-helpers`, `babel-plugin-proposal-dynamic-import`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
|
||||
* [#10574](https://github.com/babel/babel/pull/10574) fix: _interopRequireWildcard should only cache objects. ([@samMeow](https://github.com/samMeow))
|
||||
* `babel-traverse`
|
||||
* [#9777](https://github.com/babel/babel/pull/9777) [traverse] Allow skipping nodes inserted with .replaceWith(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-preset-env`
|
||||
* [#10146](https://github.com/babel/babel/pull/10146) Inject core-js@3 imports in Program:exit instead of on post(). ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-generator`
|
||||
* [#10519](https://github.com/babel/babel/pull/10519) Fix generator missing parens around an arrow returning function type. ([@existentialism](https://github.com/existentialism))
|
||||
* `babel-plugin-transform-async-to-generator`, `babel-preset-env`, `babel-traverse`
|
||||
* [#9939](https://github.com/babel/babel/pull/9939) Don't use args rest/spread to hoist super method calls. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-plugin-transform-classes`, `babel-plugin-transform-regenerator`, `babel-preset-env`
|
||||
* [#9481](https://github.com/babel/babel/pull/9481) [preset-env] Don't use async-to-generator when already using regenerator. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
|
||||
* [#10585](https://github.com/babel/babel/pull/10585) fix(babel‑helpers/interopRequireWildcard): Avoid double nullish check. ([@ExE-Boss](https://github.com/ExE-Boss))
|
||||
* `babel-register`
|
||||
* [#10557](https://github.com/babel/babel/pull/10557) fix: disable caching when babel could not read/write cache. ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-cli`, `babel-node`
|
||||
* [#10619](https://github.com/babel/babel/pull/10619) chore: remove output-file-sync dependency. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-register`
|
||||
* [#10614](https://github.com/babel/babel/pull/10614) chore: bump source-map-support to 0.5.14. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-helper-create-regexp-features-plugin`, `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-transform-dotall-regex`, `babel-plugin-transform-named-capturing-groups-regex`, `babel-plugin-transform-unicode-regex`, `babel-preset-env`
|
||||
* [#10447](https://github.com/babel/babel/pull/10447) Merge multiple regex transform plugin. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-preset-env`
|
||||
* [#10612](https://github.com/babel/babel/pull/10612) chore: update web.immediate support fixtures. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-helper-module-imports`
|
||||
* [#10608](https://github.com/babel/babel/pull/10608) Use .find instead of .filter to get targetPath in ImportInjector. ([@Andarist](https://github.com/Andarist))
|
||||
* Other
|
||||
* [#10600](https://github.com/babel/babel/pull/10600) Test node@13 on circle. ([@existentialism](https://github.com/existentialism))
|
||||
* [#10593](https://github.com/babel/babel/pull/10593) chore: replace outdated travis-ci.org badges [ci skip]. ([@JLHwung](https://github.com/JLHwung))
|
||||
* [#10591](https://github.com/babel/babel/pull/10591) chore: test against Node.js 13. ([@JLHwung](https://github.com/JLHwung))
|
||||
* [#10556](https://github.com/babel/babel/pull/10556) Add master branch workflow for test262 tests. ([@jbhoosreddy](https://github.com/jbhoosreddy))
|
||||
* [#10553](https://github.com/babel/babel/pull/10553) chore: introduce envinfo into environment section. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-runtime`
|
||||
* [#10418](https://github.com/babel/babel/pull/10418) docs: add homepage link. ([@DanArthurGallagher](https://github.com/DanArthurGallagher))
|
||||
* `babel-helper-annotate-as-pure`, `babel-helper-bindify-decorators`, `babel-helper-builder-binary-assignment-operator-visitor`, `babel-helper-builder-react-jsx`, `babel-helper-call-delegate`, `babel-helper-define-map`, `babel-helper-explode-assignable-expression`, `babel-helper-explode-class`, `babel-helper-function-name`, `babel-helper-get-function-arity`, `babel-helper-hoist-variables`, `babel-helper-member-expression-to-functions`, `babel-helper-module-imports`, `babel-helper-module-transforms`, `babel-helper-optimise-call-expression`, `babel-helper-remap-async-to-generator`, `babel-helper-replace-supers`, `babel-helper-simple-access`, `babel-helper-split-export-declaration`, `babel-helper-wrap-function`, `babel-helpers`, `babel-template`
|
||||
* [#10568](https://github.com/babel/babel/pull/10568) Bump babel-types to ^7.6.3. ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-traverse`
|
||||
* [#10480](https://github.com/babel/babel/pull/10480) Traverse performance. ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.6.4 (2019-10-10)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#10491](https://github.com/babel/babel/pull/10491) Trailing comma after rest - The final fix ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-transform-fixture-test-runner`
|
||||
* [#10536](https://github.com/babel/babel/pull/10536) Revert "chore: Upgrade source-map to 0.6.1 (#10446)" ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
## v7.6.3 (2019-10-08)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#10469](https://github.com/babel/babel/pull/10469) Disallow await inside async arrow params ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#10493](https://github.com/babel/babel/pull/10493) [parser] Disallow numeric separators in legacy octal like integers ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-types`
|
||||
* [#10504](https://github.com/babel/babel/pull/10504) Add declarations for more of @babel/types exports ([@Jessidhia](https://github.com/Jessidhia))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-transform-block-scoping`
|
||||
* [#10343](https://github.com/babel/babel/pull/10343) Do not remove let bindings even they are wrapped in closure ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-parser`
|
||||
* [#10119](https://github.com/babel/babel/pull/10119) add scope to TSModuleDeclaration ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#10332](https://github.com/babel/babel/pull/10332) Do not allow member expressions to start async arrows ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#10490](https://github.com/babel/babel/pull/10490) [parser] Don't crash on comment after trailing comma after elision ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-react-constant-elements`, `babel-traverse`
|
||||
* [#10529](https://github.com/babel/babel/pull/10529) Do not hoist jsx referencing a mutable binding ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-generator`, `babel-parser`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-typescript`
|
||||
* [#10220](https://github.com/babel/babel/pull/10220) Flow: interface identifier should be declared in the scope ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-core`
|
||||
* [#10419](https://github.com/babel/babel/pull/10419) assertNoDuplicates throw with more context ([@hjdivad](https://github.com/hjdivad))
|
||||
* [#10511](https://github.com/babel/babel/pull/10511) Add filename to transform error ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
#### :house: Internal
|
||||
* Other
|
||||
* [#10506](https://github.com/babel/babel/pull/10506) Use `make -j` for parallel build ([@JLHwung](https://github.com/JLHwung))
|
||||
* [#10443](https://github.com/babel/babel/pull/10443) perf: only apply lazy cjs module transform on cli and core ([@JLHwung](https://github.com/JLHwung))
|
||||
* [#10494](https://github.com/babel/babel/pull/10494) Enable optional chaining and nullish coalescing plugins ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-node`, `babel-plugin-transform-react-jsx-source`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-preset-react`
|
||||
* [#10249](https://github.com/babel/babel/pull/10249) Add windows to travis ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-parser`
|
||||
* [#10371](https://github.com/babel/babel/pull/10371) perf: replace lookahead by lookaheadCharCode ([@JLHwung](https://github.com/JLHwung))
|
||||
* Other
|
||||
* [#10443](https://github.com/babel/babel/pull/10443) perf: only apply lazy cjs module transform on cli and core ([@JLHwung](https://github.com/JLHwung))
|
||||
## v7.6.2 (2019-09-23)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#10472](https://github.com/babel/babel/pull/10472) added check to disallow super.private variable access and test case added. ([@vivek12345](https://github.com/vivek12345))
|
||||
* [#10468](https://github.com/babel/babel/pull/10468) [parser] Disallow numeric separator in unicode scape sequences. ([@ivandevp](https://github.com/ivandevp))
|
||||
* [#10467](https://github.com/babel/babel/pull/10467) [parser] Invalid NonOctal Decimal. ([@gonzarodriguezt](https://github.com/gonzarodriguezt))
|
||||
* [#10461](https://github.com/babel/babel/pull/10461) [parser] Disallow static fields named `constructor`. ([@guywaldman](https://github.com/guywaldman))
|
||||
* [#10455](https://github.com/babel/babel/pull/10455) [parser] Report escapes in kws only if they won't be used as identifiers. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-parser`
|
||||
* [#10445](https://github.com/babel/babel/pull/10445) Leave trailing comments after handling a possible trailing comma. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-cli`
|
||||
* [#10400](https://github.com/babel/babel/pull/10400) fix: allow the process to exit naturally. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-core`
|
||||
* [#10402](https://github.com/babel/babel/pull/10402) fix: pass optionLoc when validating plugin object. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-plugin-transform-block-scoping`, `babel-plugin-transform-spread`, `babel-traverse`
|
||||
* [#10417](https://github.com/babel/babel/pull/10417) Do not guess relative execution status for exported fns. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10275](https://github.com/babel/babel/pull/10275) fix object rest in array pattern. ([@tanhauhau](https://github.com/tanhauhau))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#10430](https://github.com/babel/babel/pull/10430) refactor: replace regexp-tree by regexpu. ([@JLHwung](https://github.com/JLHwung))
|
||||
* Other
|
||||
* [#10441](https://github.com/babel/babel/pull/10441) Update GitHub actions to v2. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#10427](https://github.com/babel/babel/pull/10427) chore: add lint-ts rule. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-helper-fixtures`
|
||||
* [#10428](https://github.com/babel/babel/pull/10428) chore: remove tryResolve dependency. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-node`
|
||||
* [#10429](https://github.com/babel/babel/pull/10429) Remove babel polyfill dependency of babel-node. ([@bdwain](https://github.com/bdwain))
|
||||
* `babel-generator`, `babel-helper-fixtures`
|
||||
* [#10420](https://github.com/babel/babel/pull/10420) chore: remove trim-right dependency. ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-core`, `babel-plugin-transform-runtime`, `babel-register`
|
||||
* [#10405](https://github.com/babel/babel/pull/10405) Remove circular dependency. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-parser`
|
||||
* [#10421](https://github.com/babel/babel/pull/10421) Miscellaneous perf tweak. ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.6.1 (2019-09-06)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-types`
|
||||
* [#10404](https://github.com/babel/babel/pull/10404) fix(types): correct typescript function headers ([@forstermatth](https://github.com/forstermatth))
|
||||
* `babel-node`
|
||||
* [#9758](https://github.com/babel/babel/pull/9758) Remove process.exit(1) from babel-node ([@dword-design](https://github.com/dword-design))
|
||||
|
||||
## v7.6.0 (2019-09-06)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-parser`
|
||||
* [#10269](https://github.com/babel/babel/pull/10269) Fix parenthesis for nullish coalescing ([@vivek12345](https://github.com/vivek12345))
|
||||
* `babel-helpers`, `babel-plugin-transform-block-scoping`, `babel-traverse`
|
||||
* [#9498](https://github.com/babel/babel/pull/9498) Fix tdz checks in transform-block-scoping plugin ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-core`
|
||||
* [#10181](https://github.com/babel/babel/pull/10181) feat(errors): validate preset when filename is absent ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-private-methods`
|
||||
* [#10217](https://github.com/babel/babel/pull/10217) Class Private Static Accessors ([@tim-mc](https://github.com/tim-mc))
|
||||
* `babel-generator`, `babel-parser`, `babel-types`
|
||||
* [#10148](https://github.com/babel/babel/pull/10148) V8intrinsic syntax plugin ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-preset-typescript`
|
||||
* [#10382](https://github.com/babel/babel/pull/10382) Allow setting 'allowNamespaces' in typescript preset ([@dsgkirkby](https://github.com/dsgkirkby))
|
||||
* `babel-parser`
|
||||
* [#10352](https://github.com/babel/babel/pull/10352) Do not register ambient classes to the TS scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-types`
|
||||
* [#10248](https://github.com/babel/babel/pull/10248) Add static to class property builder ([@yuri-karadzhov](https://github.com/yuri-karadzhov))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
|
||||
* [#10396](https://github.com/babel/babel/pull/10396) fix: early return when instance is not iterable ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#10398](https://github.com/babel/babel/pull/10398) Add supports for polyfill computed methods ([@rhyzx](https://github.com/rhyzx))
|
||||
* `babel-preset-env`
|
||||
* [#10397](https://github.com/babel/babel/pull/10397) Don't polyfill when evaluation is not confident ([@rhyzx](https://github.com/rhyzx))
|
||||
* [#10218](https://github.com/babel/babel/pull/10218) [preset-env] Include / exclude module plugins properly ([@AdamRamberg](https://github.com/AdamRamberg))
|
||||
* [#10284](https://github.com/babel/babel/pull/10284) Replace es.string.reverse with es.array.reverse ([@epicfaace](https://github.com/epicfaace))
|
||||
* `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#10395](https://github.com/babel/babel/pull/10395) fix: transform name capturing regex once ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-types`
|
||||
* [#10098](https://github.com/babel/babel/pull/10098) fix typescript for babel-types ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#10319](https://github.com/babel/babel/pull/10319) Add a builder definition including name for tsTypeParameter ([@deificx](https://github.com/deificx))
|
||||
* `babel-parser`
|
||||
* [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga))
|
||||
* [#10369](https://github.com/babel/babel/pull/10369) Retain trailing comments in array expressions ([@banga](https://github.com/banga))
|
||||
* [#10292](https://github.com/babel/babel/pull/10292) fix: assign trailing comment to ObjectProperty only when inside an ObjectExpression ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-parser`, `babel-types`
|
||||
* [#10366](https://github.com/babel/babel/pull/10366) Don't allow JSXNamespacedName to chain ([@jridgewell](https://github.com/jridgewell))
|
||||
* `babel-generator`, `babel-plugin-transform-typescript`, `babel-types`
|
||||
* [#10341](https://github.com/babel/babel/pull/10341) Add TSBigIntKeyword to @babel/types ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-core`, `babel-types`
|
||||
* [#9960](https://github.com/babel/babel/pull/9960) Do not delete "fake" source map comments from strings ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-flow-comments`
|
||||
* [#10329](https://github.com/babel/babel/pull/10329) Fix flow comments plugin issues ([@zaygraveyard](https://github.com/zaygraveyard))
|
||||
* `babel-helpers`, `babel-plugin-transform-react-constant-elements`
|
||||
* [#10307](https://github.com/babel/babel/pull/10307) [fix] jsx helper calls order ([@Sinewyk](https://github.com/Sinewyk))
|
||||
* `babel-plugin-proposal-decorators`
|
||||
* [#10302](https://github.com/babel/babel/pull/10302) fix: register inserted class declaration ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
* `babel-plugin-proposal-do-expressions`, `babel-traverse`
|
||||
* [#10070](https://github.com/babel/babel/pull/10070) Do expressions transform for switch statements ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#10277](https://github.com/babel/babel/pull/10277) remove finally from completion record in try statement ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helpers`, `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#10136](https://github.com/babel/babel/pull/10136) fix capturing group for matchAll ([@tanhauhau](https://github.com/tanhauhau))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-plugin-transform-runtime`, `babel-preset-env`
|
||||
* [#10372](https://github.com/babel/babel/pull/10372) Don't allow instance properties transformation on namespace ([@rhyzx](https://github.com/rhyzx))
|
||||
|
||||
#### :memo: Documentation
|
||||
* [#10313](https://github.com/babel/babel/pull/10313) Adds note about two approval policy to PR template ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-register`
|
||||
* [#9847](https://github.com/babel/babel/pull/9847) Remove core-js dependency from @babel/register ([@coreyfarrell](https://github.com/coreyfarrell))
|
||||
* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-preset-env`
|
||||
* [#10401](https://github.com/babel/babel/pull/10401) Use "validateLogs" for preset-env's debug fixtures ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-parser`
|
||||
* [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga))
|
||||
* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-plugin-proposal-dynamic-import`, `babel-preset-env`
|
||||
* [#10326](https://github.com/babel/babel/pull/10326) Allow testing logs with `@babel/helper-transform-fixture-test-runner` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-runtime-corejs2`, `babel-runtime`, `babel-types`
|
||||
* [#10331](https://github.com/babel/babel/pull/10331) Commit generated code ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-helper-fixtures`, `babel-node`, `babel-parser`, `babel-plugin-proposal-do-expressions`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-standalone`, `babel-template`, `babel-traverse`, `babel-types`
|
||||
* [#10228](https://github.com/babel/babel/pull/10228) Update dev dependencies and fix linting errors ([@danez](https://github.com/danez))
|
||||
* `babel-cli`
|
||||
* [#10244](https://github.com/babel/babel/pull/10244) added flow to babel cli ([@Letladi](https://github.com/Letladi))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
|
||||
* [#10161](https://github.com/babel/babel/pull/10161) Improves the logic to import objects in helpers ([@ifsnow](https://github.com/ifsnow))
|
||||
* `babel-traverse`
|
||||
* [#10243](https://github.com/babel/babel/pull/10243) perf: always return `void 0` as undefined node ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.5.5 (2019-07-17)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-code-frame`
|
||||
* [#10211](https://github.com/babel/babel/pull/10211) fix code-frame marker with highlighting ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-proposal-object-rest-spread`
|
||||
* [#10200](https://github.com/babel/babel/pull/10200) Workaround #10179 in proposal-object-rest-spread ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-types`
|
||||
* [#10198](https://github.com/babel/babel/pull/10198) add assertShape to validate templateElement ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helper-member-expression-to-functions`, `babel-helper-replace-supers`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-object-super`, `babel-types`
|
||||
* [#10017](https://github.com/babel/babel/pull/10017) destructuring private fields with array pattern / object pattern ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-transform-flow-comments`
|
||||
* [#9901](https://github.com/babel/babel/pull/9901) fix transform-flow-comments for import types ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-core`, `babel-helpers`
|
||||
* [#10208](https://github.com/babel/babel/pull/10208) always throw when add missing helpers ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#10207](https://github.com/babel/babel/pull/10207) Closes [#10205](https://github.com/babel/babel/issues/10205) ([@sag1v](https://github.com/sag1v))
|
||||
* `babel-helpers`, `babel-plugin-transform-instanceof`
|
||||
* [#10197](https://github.com/babel/babel/pull/10197) fix: custom instOfHandler result should be cast to boolean ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-parser`, `babel-plugin-transform-typescript`
|
||||
* [#10014](https://github.com/babel/babel/pull/10014) Use correct extension for typescript fixtures ([@danez](https://github.com/danez))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10189](https://github.com/babel/babel/pull/10189) perf: match ownKeys perf to the one of objectSpread ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.5.4 (2019-07-09)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10188](https://github.com/babel/babel/pull/10188) Fix _objectSpread2 for real ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
## v7.5.3 (2019-07-09)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
@@ -355,7 +746,7 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0
|
||||
|
||||
## v7.3.3 (2019-02-15)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`
|
||||
* [#9501](https://github.com/babel/babel/pull/9501) Correctly output escapes in directives ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
@@ -377,11 +768,11 @@ See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0
|
||||
* [#9491](https://github.com/babel/babel/pull/9491) Better error output in parser tests ([@danez](https://github.com/danez))
|
||||
## v7.3.2 (2019-02-04)
|
||||
|
||||
Various spec compliancy fixes and better support for smart pipelines and private methods.
|
||||
Various spec compliance fixes and better support for smart pipelines and private methods.
|
||||
|
||||
Thanks @gverni, @naffiq, @spondbob and @dstaley for their first PRs!
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#9403](https://github.com/babel/babel/pull/9403) Fix line continuation with Unicode line terminators. ([@danez](https://github.com/danez))
|
||||
* [#9400](https://github.com/babel/babel/pull/9400) Make yield a contextual keyword. ([@danez](https://github.com/danez))
|
||||
@@ -429,7 +820,7 @@ This release fixes some regressions introduced in v7.3.0
|
||||
|
||||
Thanks to @jamesgeorge007 and @armano2 for their first PR!
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#9314](https://github.com/babel/babel/pull/9314) Disallow async functions as loop body. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9315](https://github.com/babel/babel/pull/9315) Parse class heritage as strict mode code. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
@@ -650,7 +1041,7 @@ You can read more about this release at https://babeljs.io/blog/2018/12/03/7.2.0
|
||||
|
||||
## v7.1.5 (2018-11-06)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`, `babylon`
|
||||
* [#7727](https://github.com/babel/babel/pull/7727) Fix await in function name and parameters. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
@@ -1113,7 +1504,7 @@ Fixed a peerDep issue
|
||||
|
||||
Mostly bug fixes and some decorator updates
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-unicode-property-regex`
|
||||
* [#8127](https://github.com/babel/babel/pull/8127) Update plugin-proposal-unicode-property-regex for Unicode v11. ([@mathiasbynens](https://github.com/mathiasbynens))
|
||||
* `babel-parser`
|
||||
@@ -1213,7 +1604,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
- Fix IE10 class regression
|
||||
- Various fixes, many TS fixes
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`, `babel-plugin-proposal-json-strings`, `babel-plugin-syntax-json-strings`, `babel-preset-stage-3`
|
||||
* [#7985](https://github.com/babel/babel/pull/7985) Subsume json. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -1403,7 +1794,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
* `babel-generator`, `babel-helper-define-map`, `babel-plugin-syntax-class-properties`, `babel-plugin-transform-parameters`, `babel-plugin-transform-react-constant-elements`, `babel-traverse`, `babel-types`
|
||||
* [#7666](https://github.com/babel/babel/pull/7666) Private Properties phase 1. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-helper-simple-access`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`
|
||||
* [#7766](https://github.com/babel/babel/pull/7766) Correct update expression Number coercion. ([@jridgewell](https://github.com/jridgewell))
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-proposal-decorators`, `babel-types`, `babylon`
|
||||
@@ -1491,7 +1882,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
|
||||
Various fixes, also lazy-load `@babel/core` dependencies (should make config lookup and other API methods fast for other projects to use).
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-logical-assignment-operators`
|
||||
* [#7604](https://github.com/babel/babel/pull/7604) Logical Assignment: ensure computed key isn't recomputed. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -1590,7 +1981,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2
|
||||
* `babel-register`
|
||||
* [#7416](https://github.com/babel/babel/pull/7416) Replace instead of merging babel-register options, and resolve cwd up front. ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babylon`
|
||||
* [#7503](https://github.com/babel/babel/pull/7503) Update test262 test script and a few keyword escape fixes. ([@existentialism](https://github.com/existentialism))
|
||||
* [#7498](https://github.com/babel/babel/pull/7498) Disallow setters to have RestElement. ([@danez](https://github.com/danez))
|
||||
@@ -1738,7 +2129,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2
|
||||
|
||||
## v7.0.0-beta.39 (2018-01-30)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-optional-chaining`
|
||||
* [#6345](https://github.com/babel/babel/pull/6345) Remove old optional chain features. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -1951,7 +2342,7 @@ Fixes + [overrides](https://github.com/babel/babel/pull/7091) config feature
|
||||
|
||||
Various bug fixes, first version of Babel to use the MIT version of `regenerator`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babylon`
|
||||
* [#6986](https://github.com/babel/babel/pull/6986) Fix destructuring assignment spec violation. ([@ksashikumar](https://github.com/ksashikumar))
|
||||
* `babel-helper-replace-supers`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters`
|
||||
@@ -2004,7 +2395,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
* `babel-preset-stage-1`, `babel-preset-stage-2`
|
||||
* [#6949](https://github.com/babel/babel/pull/6949) Fix stage refs to exportNamespaceFrom and exportDefaultFrom. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-preset-stage-0`, `babel-preset-stage-1`
|
||||
* [#6943](https://github.com/babel/babel/pull/6943) Moving Do expression to stage 1. ([@rajzshkr](https://github.com/rajzshkr))
|
||||
|
||||
@@ -2018,7 +2409,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
|
||||
## v7.0.0-beta.33 (2017-12-01)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-proposal-export-default-from`, `babel-plugin-proposal-export-default`, `babel-plugin-proposal-export-namespace-from`, `babel-plugin-proposal-export-namespace`, `babel-plugin-syntax-export-default-from`, `babel-plugin-syntax-export-extensions`, `babel-plugin-syntax-export-namespace-from`, `babel-standalone`, `babylon`
|
||||
* [#6920](https://github.com/babel/babel/pull/6920) Split exportExtensions into exportDefault and exportNamespace plugins…. ([@existentialism](https://github.com/existentialism))
|
||||
* `babylon`
|
||||
@@ -2203,7 +2594,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
|
||||
> Note: don't use ^ in your dependencies when using a beta. It can still break between (we should try not to do it but it can), so pin all the packages like `"@babel/cli" : "7.0.0-beta.4"`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-transform-optional-chaining`
|
||||
* [#6525](https://github.com/babel/babel/pull/6525) Optional Chaining: Account for document.all. ([@azz](https://github.com/azz))
|
||||
* `babel-preset-env`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`, `babel-plugin-transform-function-sent`
|
||||
@@ -2483,7 +2874,7 @@ let {...{}} = {}; let {...[]} = {};
|
||||
- Add `--config-file` CLI flag to explicitly pass a config location
|
||||
- Move `babel-standalone` into the repo (another form of this used to be `babel-browser`)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-transform-async-to-generator`, `babel-*`
|
||||
* [#6094](https://github.com/babel/babel/pull/6094) Spec compatibility for iteratorClose condition.. ([@yavorsky](https://github.com/yavorsky))
|
||||
* `babel-helpers`, `babel-plugin-transform-es2015-computed-properties`
|
||||
@@ -2619,7 +3010,7 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b
|
||||
|
||||
## v7.0.0-alpha.18 (2017-08-03)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-types`
|
||||
* [#5990](https://github.com/babel/babel/pull/5990) Flow opaque type aliases. ([@jbrown215](https://github.com/jbrown215))
|
||||
* `babel-preset-stage-3`
|
||||
@@ -2668,9 +3059,9 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b
|
||||
- Optional catch binding `try {} catch {}`: `babel-plugin-transform-optional-catch-binding`
|
||||
- es2015-parameters `loose` mode that doesn't use `arguments`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-check-es2015-constants`
|
||||
* [#5930](https://github.com/babel/babel/pull/5930) Spec compliancy of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf))
|
||||
* [#5930](https://github.com/babel/babel/pull/5930) Spec compliance of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf))
|
||||
|
||||
> Instead of throwing a compile time error when const is violated, Babel should insert a throw statement before the violation.
|
||||
|
||||
@@ -2975,7 +3366,7 @@ var A = function A() {
|
||||
|
||||
## v7.0.0-alpha.12 (2017-05-31)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-syntax-numeric-separator`, `babel-plugin-transform-numeric-separator`, `babel-preset-stage-1`, `babel-template`, `babel-traverse`, `babel-types`
|
||||
* [#5793](https://github.com/babel/babel/pull/5793) Support for NumericLiteralSeparator, Stage 1 feature. ([@rwaldron](https://github.com/rwaldron))
|
||||
|
||||
@@ -3016,7 +3407,7 @@ var A = function A() {
|
||||
|
||||
Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, https://github.com/babel/babylon/releases/tag/v7.0.0-beta.10
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-transform-flow-strip-types`, `babel-types`
|
||||
* [#5525](https://github.com/babel/babel/pull/5525) Add support for object type spread. ([@conartist6](https://github.com/conartist6))
|
||||
|
||||
@@ -3090,7 +3481,7 @@ Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, htt
|
||||
|
||||
## v7.0.0-alpha.8 (2017-04-17)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-preset-stage-2`, `babel-preset-stage-3`
|
||||
* [#5610](https://github.com/babel/babel/pull/5610) Move syntax-dynamic-import to stage-3. ([@dkaoster](https://github.com/dkaoster))
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ contributing, please read the
|
||||
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/)
|
||||
for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
|
||||
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
|
||||
- You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to babel on CodeTriage](https://www.codetriage.com/babel/babel). [](https://www.codetriage.com/babel/babel)
|
||||
|
||||
## Chat
|
||||
|
||||
|
||||
56
Gulpfile.js
56
Gulpfile.js
@@ -11,25 +11,20 @@ const filter = require("gulp-filter");
|
||||
const gulp = require("gulp");
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const merge = require("merge-stream");
|
||||
const rollup = require("rollup");
|
||||
const rollupBabel = require("rollup-plugin-babel");
|
||||
const rollupNodeResolve = require("rollup-plugin-node-resolve");
|
||||
const rollupReplace = require("rollup-plugin-replace");
|
||||
const { registerStandalonePackageTask } = require("./scripts/gulp-tasks");
|
||||
|
||||
const sources = ["codemods", "packages"];
|
||||
const defaultSourcesGlob = "./@(codemods|packages|eslint)/*/src/**/*.js";
|
||||
|
||||
function swapSrcWithLib(srcPath) {
|
||||
const parts = srcPath.split(path.sep);
|
||||
parts[1] = "lib";
|
||||
parts[2] = "lib";
|
||||
return parts.join(path.sep);
|
||||
}
|
||||
|
||||
function getGlobFromSource(source) {
|
||||
return `./${source}/*/src/**/*.js`;
|
||||
}
|
||||
|
||||
function getIndexFromPackage(name) {
|
||||
return `${name}/src/index.js`;
|
||||
}
|
||||
@@ -56,32 +51,28 @@ function rename(fn) {
|
||||
});
|
||||
}
|
||||
|
||||
function buildBabel(exclude) {
|
||||
return merge(
|
||||
sources.map(source => {
|
||||
const base = path.join(__dirname, source);
|
||||
function buildBabel(exclude, sourcesGlob = defaultSourcesGlob) {
|
||||
const base = __dirname;
|
||||
|
||||
let stream = gulp.src(getGlobFromSource(source), { base: base });
|
||||
let stream = gulp.src(sourcesGlob, { base: __dirname });
|
||||
|
||||
if (exclude) {
|
||||
const filters = exclude.map(p => `!**/${p}/**`);
|
||||
filters.unshift("**");
|
||||
stream = stream.pipe(filter(filters));
|
||||
}
|
||||
if (exclude) {
|
||||
const filters = exclude.map(p => `!**/${p}/**`);
|
||||
filters.unshift("**");
|
||||
stream = stream.pipe(filter(filters));
|
||||
}
|
||||
|
||||
return stream
|
||||
.pipe(errorsLogger())
|
||||
.pipe(newer({ dest: base, map: swapSrcWithLib }))
|
||||
.pipe(compilationLogger())
|
||||
.pipe(babel())
|
||||
.pipe(
|
||||
// Passing 'file.relative' because newer() above uses a relative
|
||||
// path and this keeps it consistent.
|
||||
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
|
||||
)
|
||||
.pipe(gulp.dest(base));
|
||||
})
|
||||
);
|
||||
return stream
|
||||
.pipe(errorsLogger())
|
||||
.pipe(newer({ dest: base, map: swapSrcWithLib }))
|
||||
.pipe(compilationLogger())
|
||||
.pipe(babel())
|
||||
.pipe(
|
||||
// Passing 'file.relative' because newer() above uses a relative
|
||||
// path and this keeps it consistent.
|
||||
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
|
||||
)
|
||||
.pipe(gulp.dest(base));
|
||||
}
|
||||
|
||||
function buildRollup(packages) {
|
||||
@@ -118,6 +109,9 @@ const bundles = ["packages/babel-parser"];
|
||||
|
||||
gulp.task("build-rollup", () => buildRollup(bundles));
|
||||
gulp.task("build-babel", () => buildBabel(/* exclude */ bundles));
|
||||
gulp.task("build-babel-types", () =>
|
||||
buildBabel(/* exclude */ bundles, "packages/babel-types/src/**/*.js")
|
||||
);
|
||||
gulp.task("build", gulp.parallel("build-rollup", "build-babel"));
|
||||
|
||||
gulp.task("default", gulp.series("build"));
|
||||
@@ -128,7 +122,7 @@ gulp.task(
|
||||
"watch",
|
||||
gulp.series("build-no-bundle", function watch() {
|
||||
gulpWatch(
|
||||
sources.map(getGlobFromSource),
|
||||
defaultSourcesGlob,
|
||||
{ debounceDelay: 200 },
|
||||
gulp.task("build-no-bundle")
|
||||
);
|
||||
|
||||
237
Makefile
237
Makefile
@@ -1,67 +1,125 @@
|
||||
MAKEFLAGS = -j1
|
||||
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
|
||||
TEST262_COMMIT = de567d3aa5de4eaa11e00131d26b9fe77997dfb0
|
||||
TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409
|
||||
|
||||
FORCE_PUBLISH = "@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
|
||||
|
||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||
export FORCE_COLOR = true
|
||||
|
||||
SOURCES = packages codemods
|
||||
SOURCES = packages codemods eslint
|
||||
|
||||
COMMA := ,
|
||||
EMPTY :=
|
||||
SPACE := $(EMPTY) $(EMPTY)
|
||||
COMMA_SEPARATED_SOURCES = $(subst $(SPACE),$(COMMA),$(SOURCES))
|
||||
|
||||
|
||||
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
|
||||
|
||||
build: clean clean-lib
|
||||
./node_modules/.bin/gulp build
|
||||
node ./packages/babel-standalone/scripts/generate.js
|
||||
node ./packages/babel-types/scripts/generateTypeHelpers.js
|
||||
# call build again as the generated files might need to be compiled again.
|
||||
./node_modules/.bin/gulp build
|
||||
# generate flow and typescript typings
|
||||
node packages/babel-types/scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
|
||||
node packages/babel-types/scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts
|
||||
build: build-bundle
|
||||
ifneq ("$(BABEL_COVERAGE)", "true")
|
||||
make build-standalone
|
||||
make build-preset-env-standalone
|
||||
$(MAKE) build-standalone
|
||||
endif
|
||||
|
||||
build-standalone:
|
||||
./node_modules/.bin/gulp build-babel-standalone
|
||||
build-bundle: clean clean-lib
|
||||
yarn gulp build
|
||||
$(MAKE) generate-standalone generate-type-helpers
|
||||
# call build again as the generated files might need to be compiled again.
|
||||
yarn gulp build
|
||||
$(MAKE) build-typings
|
||||
$(MAKE) build-dist
|
||||
|
||||
build-bundle-ci: bootstrap-only
|
||||
$(MAKE) build-bundle
|
||||
|
||||
generate-standalone:
|
||||
node packages/babel-standalone/scripts/generate.js
|
||||
|
||||
generate-type-helpers:
|
||||
node packages/babel-types/scripts/generateTypeHelpers.js
|
||||
|
||||
build-typings: build-flow-typings build-typescript-typings
|
||||
|
||||
build-flow-typings:
|
||||
node packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow
|
||||
|
||||
build-typescript-typings:
|
||||
node packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts
|
||||
|
||||
build-standalone: build-babel-standalone build-preset-env-standalone
|
||||
|
||||
build-standalone-ci: build-bundle-ci
|
||||
$(MAKE) build-standalone
|
||||
|
||||
build-babel-standalone:
|
||||
yarn gulp build-babel-standalone
|
||||
|
||||
build-preset-env-standalone:
|
||||
./node_modules/.bin/gulp build-babel-preset-env-standalone
|
||||
yarn gulp build-babel-preset-env-standalone
|
||||
|
||||
prepublish-build-standalone:
|
||||
BABEL_ENV=production IS_PUBLISH=true ./node_modules/.bin/gulp build-babel-standalone
|
||||
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-standalone
|
||||
|
||||
prepublish-build-preset-env-standalone:
|
||||
BABEL_ENV=production IS_PUBLISH=true ./node_modules/.bin/gulp build-babel-preset-env-standalone
|
||||
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-preset-env-standalone
|
||||
|
||||
build-dist: build
|
||||
build-dist: build-polyfill-dist build-plugin-transform-runtime-dist
|
||||
|
||||
build-polyfill-dist:
|
||||
cd packages/babel-polyfill; \
|
||||
scripts/build-dist.sh
|
||||
|
||||
build-plugin-transform-runtime-dist:
|
||||
cd packages/babel-plugin-transform-runtime; \
|
||||
node scripts/build-dist.js
|
||||
|
||||
watch: clean clean-lib
|
||||
|
||||
build-no-bundle: clean clean-lib
|
||||
BABEL_ENV=development yarn gulp build-no-bundle
|
||||
# Ensure that build artifacts for types are created during local
|
||||
# development too.
|
||||
BABEL_ENV=development ./node_modules/.bin/gulp build-no-bundle
|
||||
node ./packages/babel-types/scripts/generateTypeHelpers.js
|
||||
node packages/babel-types/scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
|
||||
node packages/babel-types/scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts
|
||||
BABEL_ENV=development ./node_modules/.bin/gulp watch
|
||||
$(MAKE) generate-type-helpers
|
||||
$(MAKE) build-typings
|
||||
|
||||
watch: build-no-bundle
|
||||
BABEL_ENV=development yarn gulp watch
|
||||
|
||||
code-quality-ci: flowcheck-ci lint-ci
|
||||
|
||||
flowcheck-ci: bootstrap-flowcheck
|
||||
$(MAKE) flow
|
||||
|
||||
code-quality: flow lint
|
||||
|
||||
flow:
|
||||
./node_modules/.bin/flow check --strip-root
|
||||
yarn flow check --strip-root
|
||||
|
||||
lint:
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe
|
||||
bootstrap-flowcheck: bootstrap-only
|
||||
yarn gulp build-babel-types
|
||||
$(MAKE) build-typings
|
||||
|
||||
fix: fix-json
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
|
||||
lint-ci: lint-js-ci lint-ts-ci
|
||||
|
||||
lint-js-ci: bootstrap-only
|
||||
$(MAKE) lint-js
|
||||
|
||||
lint-ts-ci: bootstrap-flowcheck
|
||||
$(MAKE) lint-ts
|
||||
|
||||
lint: lint-js lint-ts
|
||||
|
||||
lint-js:
|
||||
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe
|
||||
|
||||
lint-ts:
|
||||
scripts/tests/typescript/lint.sh
|
||||
|
||||
fix: fix-json fix-js
|
||||
|
||||
fix-js:
|
||||
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
|
||||
|
||||
fix-json:
|
||||
./node_modules/.bin/prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
|
||||
yarn prettier "{$(COMMA_SEPARATED_SOURCES)}/*/test/fixtures/**/options.json" --write --loglevel warn
|
||||
|
||||
clean: test-clean
|
||||
rm -f .npmrc
|
||||
@@ -74,72 +132,83 @@ test-clean:
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-test, $(source)))
|
||||
|
||||
# Does not work on Windows; use "yarn jest" instead
|
||||
test-only:
|
||||
BABEL_ENV=test ./scripts/test.sh
|
||||
make test-clean
|
||||
$(MAKE) test-clean
|
||||
|
||||
test: lint test-only
|
||||
|
||||
test-ci: bootstrap test-only
|
||||
test-ci: jest-ci
|
||||
|
||||
jest-ci: build-standalone-ci
|
||||
BABEL_ENV=test yarn jest --maxWorkers=4 --ci
|
||||
$(MAKE) test-clean
|
||||
|
||||
# Does not work on Windows
|
||||
test-ci-coverage: SHELL:=/bin/bash
|
||||
test-ci-coverage:
|
||||
BABEL_COVERAGE=true BABEL_ENV=test make bootstrap
|
||||
BABEL_COVERAGE=true BABEL_ENV=test $(MAKE) bootstrap
|
||||
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
|
||||
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
||||
|
||||
bootstrap-flow:
|
||||
rm -rf ./build/flow
|
||||
mkdir -p ./build
|
||||
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git ./build/flow
|
||||
rm -rf build/flow
|
||||
mkdir -p build
|
||||
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git build/flow
|
||||
cd build/flow && git checkout $(FLOW_COMMIT)
|
||||
|
||||
test-flow:
|
||||
node scripts/tests/flow/run_babel_parser_flow_tests.js
|
||||
|
||||
test-flow-ci: bootstrap test-flow
|
||||
test-flow-ci: build-bundle-ci bootstrap-flow
|
||||
$(MAKE) test-flow
|
||||
|
||||
test-flow-update-whitelist:
|
||||
node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist
|
||||
|
||||
bootstrap-test262:
|
||||
rm -rf ./build/test262
|
||||
mkdir -p ./build
|
||||
git clone --branch=master --single-branch --shallow-since=2019-01-01 https://github.com/tc39/test262.git ./build/test262
|
||||
rm -rf build/test262
|
||||
mkdir -p build
|
||||
git clone --branch=master --single-branch --shallow-since=2019-09-01 https://github.com/tc39/test262.git build/test262
|
||||
cd build/test262 && git checkout $(TEST262_COMMIT)
|
||||
|
||||
test-test262:
|
||||
node scripts/tests/test262/run_babel_parser_test262.js
|
||||
|
||||
test-test262-ci: bootstrap test-test262
|
||||
test-test262-ci: build-bundle-ci bootstrap-test262
|
||||
$(MAKE) test-test262
|
||||
|
||||
test-test262-update-whitelist:
|
||||
node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist
|
||||
|
||||
# Does not work on Windows
|
||||
clone-license:
|
||||
./scripts/clone-license.sh
|
||||
|
||||
prepublish-build:
|
||||
make clean-lib
|
||||
rm -rf packages/babel-runtime/helpers
|
||||
rm -rf packages/babel-runtime-corejs2/helpers
|
||||
rm -rf packages/babel-runtime-corejs2/core-js
|
||||
NODE_ENV=production BABEL_ENV=production make build-dist
|
||||
make clone-license
|
||||
prepublish-build: clean-lib clean-runtime-helpers
|
||||
NODE_ENV=production BABEL_ENV=production $(MAKE) build
|
||||
$(MAKE) clone-license
|
||||
|
||||
prepublish:
|
||||
make bootstrap-only
|
||||
make prepublish-build
|
||||
make test
|
||||
$(MAKE) bootstrap-only
|
||||
$(MAKE) prepublish-build
|
||||
$(MAKE) test
|
||||
|
||||
new-version:
|
||||
git pull --rebase
|
||||
./node_modules/.bin/lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
|
||||
yarn lerna version --force-publish=$(FORCE_PUBLISH)
|
||||
|
||||
version-cerxes:
|
||||
yarn lerna version prerelease --allow-branch initializer-fix-v7.7.4 --preid csx
|
||||
|
||||
publish-cerxes: prepublish
|
||||
yarn lerna publish --registry="https://npm.cerxes.net" --force-publish --allow-branch initializer-fix-v7.7.4 --canary --preid csx --dist-tag csx
|
||||
|
||||
# NOTE: Run make new-version first
|
||||
publish: prepublish
|
||||
./node_modules/.bin/lerna publish from-git --require-scripts
|
||||
make clean
|
||||
yarn lerna publish from-git
|
||||
$(MAKE) clean
|
||||
|
||||
publish-ci: prepublish
|
||||
ifneq ("$(NPM_TOKEN)", "")
|
||||
@@ -148,22 +217,48 @@ else
|
||||
echo "Missing NPM_TOKEN env var"
|
||||
exit 1
|
||||
endif
|
||||
./node_modules/.bin/lerna publish from-git --require-scripts --yes
|
||||
yarn lerna publish from-git --yes
|
||||
rm -f .npmrc
|
||||
make clean
|
||||
$(MAKE) clean
|
||||
|
||||
bootstrap-only: clean-all
|
||||
publish-test:
|
||||
ifneq ("$(I_AM_USING_VERDACCIO)", "I_AM_SURE")
|
||||
echo "You probably don't know what you are doing"
|
||||
exit 1
|
||||
endif
|
||||
$(MAKE) prepublish-build
|
||||
yarn lerna version patch --force-publish=$(FORCE_PUBLISH) --no-push --yes --tag-version-prefix="version-e2e-test-"
|
||||
yarn lerna publish from-git --registry http://localhost:4873 --yes --tag-version-prefix="version-e2e-test-"
|
||||
$(MAKE) clean
|
||||
|
||||
publish-eslint:
|
||||
$(call set-json-field, ./eslint/$(PKG)/package.json, private, false)
|
||||
cd eslint/$(PKG); yarn publish
|
||||
$(call set-json-field, ./eslint/$(PKG)/package.json, private, true)
|
||||
|
||||
bootstrap-only: lerna-bootstrap
|
||||
|
||||
yarn-install: clean-all
|
||||
yarn --ignore-engines
|
||||
./node_modules/.bin/lerna bootstrap -- --ignore-engines
|
||||
|
||||
lerna-bootstrap: yarn-install
|
||||
# todo: remove `-- -- --ignore-engines` in Babel 8
|
||||
yarn lerna bootstrap -- -- --ignore-engines
|
||||
|
||||
bootstrap: bootstrap-only
|
||||
make build
|
||||
cd packages/babel-plugin-transform-runtime; \
|
||||
node scripts/build-dist.js
|
||||
$(MAKE) build
|
||||
|
||||
clean-lib:
|
||||
# TODO: Don't delete eslint/*/lib when they use src
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-lib, $(source)))
|
||||
$(if $(filter-out $(source), eslint), \
|
||||
$(call clean-source-lib, $(source))))
|
||||
|
||||
clean-runtime-helpers:
|
||||
rm -f packages/babel-runtime/helpers/**/*.js
|
||||
rm -f packages/babel-runtime-corejs2/helpers/**/*.js
|
||||
rm -f packages/babel-runtime-corejs3/helpers/**/*.js
|
||||
rm -rf packages/babel-runtime-corejs2/core-js
|
||||
|
||||
clean-all:
|
||||
rm -rf node_modules
|
||||
@@ -173,7 +268,7 @@ clean-all:
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-all, $(source)))
|
||||
|
||||
make clean
|
||||
$(MAKE) clean
|
||||
|
||||
define clean-source-lib
|
||||
rm -rf $(1)/*/lib
|
||||
@@ -187,8 +282,16 @@ define clean-source-test
|
||||
endef
|
||||
|
||||
define clean-source-all
|
||||
rm -rf $(1)/*/lib
|
||||
# TODO: Don't delete eslint/*/lib when they use src
|
||||
$(if $(filter-out $1, eslint), $(call clean-source-lib, $1))
|
||||
rm -rf $(1)/*/node_modules
|
||||
rm -rf $(1)/*/package-lock.json
|
||||
|
||||
endef
|
||||
|
||||
define set-json-field
|
||||
node -e "\
|
||||
require('fs').writeFileSync('$1'.trim(), \
|
||||
JSON.stringify({ ...require('$1'.trim()), $2: $3 }, null, 2) + '\\n' \
|
||||
)"
|
||||
endef
|
||||
|
||||
23
README.md
23
README.md
@@ -13,7 +13,7 @@
|
||||
<a href="https://www.npmjs.com/package/babel-core"><img alt="v6 npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200&label=v6%20downloads"></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/babel/babel"><img alt="Travis Status" src="https://img.shields.io/travis/babel/babel/master.svg?label=travis&maxAge=43200"></a>
|
||||
<a href="https://travis-ci.com/babel/babel"><img alt="Travis Status" src="https://img.shields.io/travis/com/babel/babel/master.svg?label=travis&maxAge=43200"></a>
|
||||
<a href="https://circleci.com/gh/babel/babel"><img alt="CircleCI Status" src="https://img.shields.io/circleci/project/github/babel/babel/master.svg?label=circle&maxAge=43200"></a>
|
||||
<a href="https://codecov.io/github/babel/babel"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/babel/babel/master.svg?maxAge=43200"></a>
|
||||
<a href="https://slack.babeljs.io/"><img alt="Slack Status" src="https://slack.babeljs.io/badge.svg"></a>
|
||||
@@ -80,14 +80,14 @@ Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGD
|
||||
|
||||
Mostly a handful of volunteers, funded by you! Please check out our [team page](https://babeljs.io/team)!
|
||||
|
||||
### Looking for support?
|
||||
|
||||
For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
||||
|
||||
### Is there a Babel song?
|
||||
|
||||
I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings!
|
||||
|
||||
### Looking for support?
|
||||
|
||||
For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
||||
|
||||
### Where are the docs?
|
||||
|
||||
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
|
||||
@@ -98,12 +98,19 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu
|
||||
|
||||
### Want to contribute to Babel?
|
||||
|
||||
Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
|
||||
Check out:
|
||||
|
||||
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
|
||||
- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
|
||||
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))!
|
||||
- Issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle.
|
||||
|
||||
Some resources:
|
||||
|
||||
- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
|
||||
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
||||
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
|
||||
- Our blog which contains release posts and explanations: [/blog](https://babeljs.io/blog)
|
||||
- Our videos page with talks about open source and Babel: [/videos](https://babeljs.io/videos)
|
||||
- Our [podcast](https://podcast.babeljs.io)
|
||||
|
||||
### How is the repo structured?
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ module.exports = function(api) {
|
||||
exclude: ["transform-typeof-symbol"],
|
||||
};
|
||||
const envOpts = Object.assign({}, envOptsNoTargets);
|
||||
let transformRuntimeOpts = null;
|
||||
|
||||
let convertESM = true;
|
||||
let ignoreLib = true;
|
||||
@@ -50,6 +51,17 @@ module.exports = function(api) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (includeRuntime) {
|
||||
const babelRuntimePackageJSONPath = require.resolve(
|
||||
"@babel/runtime/package.json"
|
||||
);
|
||||
const path = require("path");
|
||||
transformRuntimeOpts = {
|
||||
version: require(babelRuntimePackageJSONPath).version,
|
||||
absoluteRuntime: path.dirname(babelRuntimePackageJSONPath),
|
||||
};
|
||||
}
|
||||
|
||||
const config = {
|
||||
// Our dependencies are all standard CommonJS, along with all sorts of
|
||||
// other random files in Babel's codebase, so we use script as the default,
|
||||
@@ -77,9 +89,10 @@ module.exports = function(api) {
|
||||
"@babel/proposal-object-rest-spread",
|
||||
{ useBuiltIns: true, loose: true },
|
||||
],
|
||||
["@babel/plugin-proposal-optional-chaining", { loose: true }],
|
||||
["@babel/plugin-proposal-nullish-coalescing-operator", { loose: true }],
|
||||
|
||||
// Explicitly use the lazy version of CommonJS modules.
|
||||
convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null,
|
||||
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||
].filter(Boolean),
|
||||
overrides: [
|
||||
{
|
||||
@@ -90,18 +103,17 @@ module.exports = function(api) {
|
||||
],
|
||||
},
|
||||
{
|
||||
test: "./packages/babel-register",
|
||||
test: ["./packages/babel-cli", "./packages/babel-core"],
|
||||
plugins: [
|
||||
// Override the root options to disable lazy imports for babel-register
|
||||
// because otherwise the require hook will try to lazy-import things
|
||||
// leading to dependency cycles.
|
||||
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||
// Explicitly use the lazy version of CommonJS modules.
|
||||
convertESM
|
||||
? ["@babel/transform-modules-commonjs", { lazy: true }]
|
||||
: null,
|
||||
].filter(Boolean),
|
||||
},
|
||||
{
|
||||
test: "./packages/babel-polyfill",
|
||||
presets: [["@babel/env", envOptsNoTargets]],
|
||||
plugins: [["@babel/transform-modules-commonjs", { lazy: false }]],
|
||||
},
|
||||
{
|
||||
// The vast majority of our src files are modules, but we use
|
||||
@@ -112,6 +124,8 @@ module.exports = function(api) {
|
||||
"packages/*/test",
|
||||
"codemods/*/src",
|
||||
"codemods/*/test",
|
||||
"eslint/*/src",
|
||||
"eslint/*/test",
|
||||
],
|
||||
sourceType: "unambiguous",
|
||||
},
|
||||
@@ -123,7 +137,7 @@ module.exports = function(api) {
|
||||
],
|
||||
plugins: [
|
||||
includeRuntime
|
||||
? ["@babel/transform-runtime", { version: "7.4.4" }]
|
||||
? ["@babel/transform-runtime", transformRuntimeOpts]
|
||||
: null,
|
||||
].filter(Boolean),
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/plugin-codemod-object-assign-to-object-spread",
|
||||
"version": "7.0.0",
|
||||
"version": "7.7.4-csx.0",
|
||||
"description": "Transforms Object.assign into object spread syntax",
|
||||
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-object-assign-to-object-spread",
|
||||
"license": "MIT",
|
||||
@@ -13,16 +13,13 @@
|
||||
"@babel/plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.7.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
"@babel/core": "^7.0.0-0 || csx"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/helper-plugin-test-runner": "^7.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
"@babel/core": "^7.7.4",
|
||||
"@babel/helper-plugin-test-runner": "^7.7.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/plugin-codemod-optional-catch-binding",
|
||||
"version": "7.0.0",
|
||||
"version": "7.7.4-csx.0",
|
||||
"description": "Remove unused catch bindings",
|
||||
"repository": "https://github.com/babel/babel/tree/master/codemods/babel-plugin-codemod-remove-unused-catch-binding",
|
||||
"license": "MIT",
|
||||
@@ -13,13 +13,13 @@
|
||||
"@babel/plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/plugin-syntax-optional-catch-binding": "^7.0.0"
|
||||
"@babel/plugin-syntax-optional-catch-binding": "^7.7.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
"@babel/core": "^7.0.0-0 || csx"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/helper-plugin-test-runner": "^7.0.0"
|
||||
"@babel/core": "^7.7.4",
|
||||
"@babel/helper-plugin-test-runner": "^7.7.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ This is quite taboo but let's look at the pros and cons:
|
||||
* Easy to coordinate changes across modules.
|
||||
* Single place to report issues.
|
||||
* Easier to setup a development environment.
|
||||
* Tests across modules are run together which finds bugs that touch multiple modules easier.
|
||||
* Tests across modules are run together which finds bugs that touch multiple modules more easily.
|
||||
|
||||
**Cons:**
|
||||
|
||||
|
||||
4
eslint/babel-eslint-config-internal/.npmignore
Normal file
4
eslint/babel-eslint-config-internal/.npmignore
Normal file
@@ -0,0 +1,4 @@
|
||||
src
|
||||
test
|
||||
.*
|
||||
*.log
|
||||
4
eslint/babel-eslint-config-internal/README.md
Normal file
4
eslint/babel-eslint-config-internal/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
## @babel/eslint-config-internal
|
||||
---
|
||||
|
||||
ESLint config for the Babel codebase (originally taken from `eslint-config-kittens`)
|
||||
49
eslint/babel-eslint-config-internal/index.js
Normal file
49
eslint/babel-eslint-config-internal/index.js
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
parser: "babel-eslint",
|
||||
extends: "eslint:recommended",
|
||||
plugins: ["flowtype"],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
sourceType: "module",
|
||||
},
|
||||
globals: {
|
||||
// Flow
|
||||
Iterator: true,
|
||||
$Keys: true,
|
||||
},
|
||||
env: {
|
||||
node: true,
|
||||
es2020: true,
|
||||
browser: true,
|
||||
},
|
||||
rules: {
|
||||
camelcase: "off",
|
||||
"consistent-return": "off",
|
||||
curly: ["error", "multi-line"],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"new-cap": "off",
|
||||
"no-case-declarations": "error",
|
||||
"no-cond-assign": "off",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-console": "off",
|
||||
"no-constant-condition": "off",
|
||||
"no-empty": "off",
|
||||
"no-fallthrough": "off",
|
||||
"no-inner-declarations": "off",
|
||||
"no-labels": "off",
|
||||
"no-loop-func": "off",
|
||||
"no-process-exit": "off",
|
||||
"no-return-assign": "off",
|
||||
"no-shadow": "off",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-unreachable": "off",
|
||||
"no-use-before-define": "off",
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
strict: "off",
|
||||
"flowtype/define-flow-type": "warn",
|
||||
"flowtype/use-flow-type": "warn",
|
||||
},
|
||||
};
|
||||
15
eslint/babel-eslint-config-internal/package.json
Normal file
15
eslint/babel-eslint-config-internal/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "@babel/eslint-config-internal",
|
||||
"version": "0.0.0",
|
||||
"description": "The Babel Team's ESLint configuration. Since it's internal, it might not respect semver.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"repository": "https://github.com/babel/babel/tree/master/eslint/babel-eslint-config-internal",
|
||||
"main": "lib/index.js",
|
||||
"peerDependencies": {
|
||||
"babel-eslint": "^10.0.0 || ^11.0.0-0",
|
||||
"eslint-plugin-flowtype": "^3.0.0"
|
||||
}
|
||||
}
|
||||
4
eslint/babel-eslint-parser/.npmignore
Normal file
4
eslint/babel-eslint-parser/.npmignore
Normal file
@@ -0,0 +1,4 @@
|
||||
src
|
||||
test
|
||||
.*
|
||||
*.log
|
||||
128
eslint/babel-eslint-parser/README.md
Normal file
128
eslint/babel-eslint-parser/README.md
Normal file
@@ -0,0 +1,128 @@
|
||||
# babel-eslint [](https://www.npmjs.com/package/babel-eslint) [](https://travis-ci.org/babel/babel-eslint) [](https://www.npmjs.com/package/babel-eslint)
|
||||
|
||||
**babel-eslint** allows you to lint **ALL** valid Babel code with the fantastic
|
||||
[ESLint](https://github.com/eslint/eslint).
|
||||
|
||||
## Breaking change in v11.x.x
|
||||
|
||||
As of the v11.x.x release, babel-eslint now requires Babel as a peer dependency and expects a valid [Babel configuration file](https://babeljs.io/docs/en/configuration) to exist. This ensures that the same Babel configuration is used during both linting and compilation.
|
||||
|
||||
## When should I use babel-eslint?
|
||||
|
||||
ESLint's default parser and core rules [only support the latest final ECMAScript standard](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features) and do not support experimental (such as new features) and non-standard (such as Flow or TypeScript types) syntax provided by Babel. babel-eslint is a parser that allows ESLint to run on source code that is transformed by Babel.
|
||||
|
||||
**Note:** You only need to use babel-eslint if you are using Babel to transform your code. If this is not the case, please use the relevant parser for your chosen flavor of ECMAScript (note that the default parser supports all non-experimental syntax as well as JSX).
|
||||
|
||||
## How does it work?
|
||||
|
||||
ESLint allows for the use of [custom parsers](https://eslint.org/docs/developer-guide/working-with-custom-parsers). When using this plugin, your code is parsed by Babel's parser (using the configuration specified in your [Babel configuration file](https://babeljs.io/docs/en/configuration)) and the resulting AST is
|
||||
transformed into an [ESTree](https://github.com/estree/estree)-compliant structure that ESLint can understand. All location info such as line numbers,
|
||||
columns is also retained so you can track down errors with ease.
|
||||
|
||||
**Note:** ESLint's core rules do not support experimental syntax and may therefore not work as expected when using babel-eslint. Please use the companion [`eslint-plugin-babel`](https://github.com/babel/eslint-plugin-babel) plugin for core rules that you have issues with.
|
||||
|
||||
## Usage
|
||||
|
||||
### Installation
|
||||
|
||||
```sh
|
||||
$ npm install eslint babel-eslint --save-dev
|
||||
# or
|
||||
$ yarn add eslint babel-eslint -D
|
||||
```
|
||||
|
||||
**Note:** babel-eslint requires `babel/core@>=7.2.0` and a valid Babel configuration file to run. If you do not have this already set up, please see the [Babel Usage Guide](https://babeljs.io/docs/en/usage).
|
||||
|
||||
### Setup
|
||||
|
||||
To use babel-eslint, `"babel-eslint"` must be specified as the `parser` in your ESLint configuration file (see [here](https://eslint.org/docs/user-guide/configuring#specifying-parser) for more detailed information).
|
||||
|
||||
**.eslintrc.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
parser: "babel-eslint",
|
||||
};
|
||||
```
|
||||
|
||||
With the parser set, your configuration can be configured as described in the [Configuring ESLint](https://eslint.org/docs/user-guide/configuring) documentation.
|
||||
|
||||
**Note:** The `parserOptions` described in the [official documentation](https://eslint.org/docs/user-guide/configuring#specifying-parser-options) are for the default parser and are not necessarily supported by babel-eslint. Please see the section directly below for supported `parserOptions`.
|
||||
|
||||
### Additional parser configuration
|
||||
|
||||
Additional configuration options can be set in your ESLint configuration under the `parserOptions` key. Please note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default.
|
||||
|
||||
- `requireConfigFile` (default `true`) can be set to `false` to allow babel-eslint to run on files that do not have a Babel configuration associated with them. This can be useful for linting files that are not transformed by Babel (such as tooling configuration files), though we recommend using the default parser via [glob-based configuration](https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns). Note: babel-eslint will not parse any experimental syntax when no configuration file is found.
|
||||
- `sourceType` can be set to `"module"`(default) or `"script"` if your code isn't using ECMAScript modules.
|
||||
- `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level.
|
||||
- `ecmaFeatures.globalReturn` (default `false`) allow return statements in the global scope when used with `sourceType: "script"`.
|
||||
- `babelOptions` passes through Babel's configuration [loading](https://babeljs.io/docs/en/options#config-loading-options) and [merging](https://babeljs.io/docs/en/options#config-merging-options) options (for instance, in case of a monorepo). When not defined, babel-eslint will use Babel's default configuration file resolution logic.
|
||||
|
||||
**.eslintrc.js**
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
parser: "babel-eslint",
|
||||
parserOptions: {
|
||||
sourceType: "module",
|
||||
allowImportExportEverywhere: false,
|
||||
ecmaFeatures: {
|
||||
globalReturn: false,
|
||||
},
|
||||
babelOptions: {
|
||||
configFile: "path/to/config.js",
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
**.eslintrc.js using glob-based configuration**
|
||||
|
||||
This configuration would use the default parser for all files except for those found by the `"files/transformed/by/babel/*.js"` glob.
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
rules: {
|
||||
indent: "error"
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["files/transformed/by/babel/*.js"],
|
||||
parser: "babel-eslint",
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
### Run
|
||||
|
||||
```sh
|
||||
$ ./node_modules/.bin/eslint yourfile.js
|
||||
```
|
||||
|
||||
## Known issues
|
||||
|
||||
Flow:
|
||||
|
||||
> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`.
|
||||
|
||||
- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076)
|
||||
- Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'`
|
||||
- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926)
|
||||
|
||||
Modules/strict mode
|
||||
|
||||
- `no-unused-vars: ["error", { vars: local }]` [#136](https://github.com/babel/babel-eslint/issues/136)
|
||||
|
||||
Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues.
|
||||
|
||||
- `no-unused-vars` with jsx
|
||||
|
||||
Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues.
|
||||
|
||||
## Questions and support
|
||||
|
||||
If you have an issue, please first check if it can be reproduced with the default parser and with the latest versions of `eslint` and `babel-eslint`. If it is not reproducible with the default parser, it is most likely an issue with babel-eslint.
|
||||
|
||||
For questions and support please visit the [`#discussion`](https://babeljs.slack.com/messages/discussion/) Babel Slack channel (sign up [here](https://github.com/babel/notes/issues/38)) or the ESLint [Gitter](https://gitter.im/eslint/eslint).
|
||||
51
eslint/babel-eslint-parser/package.json
Normal file
51
eslint/babel-eslint-parser/package.json
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "babel-eslint",
|
||||
"version": "7.7.4-csx.1",
|
||||
"description": "Custom parser for ESLint",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel-eslint.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel-eslint/issues"
|
||||
},
|
||||
"homepage": "https://github.com/babel/babel-eslint",
|
||||
"scripts": {
|
||||
"changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"peerDependencies": {
|
||||
"@babel/core": ">=7.2.0",
|
||||
"eslint": ">= 4.12.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"eslint-scope": "3.7.1",
|
||||
"eslint-visitor-keys": "^1.0.0",
|
||||
"semver": "^6.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.7.4-csx.1",
|
||||
"@babel/plugin-proposal-class-properties": "7.7.4-csx.1",
|
||||
"@babel/plugin-proposal-decorators": "7.7.4-csx.1",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.7.4-csx.1",
|
||||
"@babel/plugin-proposal-optional-chaining": "7.7.4-csx.1",
|
||||
"@babel/plugin-proposal-pipeline-operator": "7.7.4-csx.1",
|
||||
"@babel/plugin-syntax-dynamic-import": "7.7.4-csx.1",
|
||||
"@babel/plugin-syntax-export-default-from": "7.7.4-csx.1",
|
||||
"@babel/plugin-syntax-export-namespace-from": "7.7.4-csx.1",
|
||||
"@babel/plugin-syntax-import-meta": "7.7.4-csx.1",
|
||||
"@babel/plugin-syntax-numeric-separator": "7.7.4-csx.1",
|
||||
"@babel/preset-env": "7.7.4-csx.1",
|
||||
"@babel/preset-flow": "7.7.4-csx.1",
|
||||
"@babel/preset-react": "7.7.4-csx.1",
|
||||
"dedent": "^0.7.0",
|
||||
"eslint": "^6.0.1",
|
||||
"espree": "^6.0.0"
|
||||
}
|
||||
}
|
||||
338
eslint/babel-eslint-parser/src/analyze-scope.js
Normal file
338
eslint/babel-eslint-parser/src/analyze-scope.js
Normal file
@@ -0,0 +1,338 @@
|
||||
"use strict";
|
||||
|
||||
const t = require("@babel/core").types;
|
||||
const escope = require("eslint-scope");
|
||||
const Definition = require("eslint-scope/lib/definition").Definition;
|
||||
const OriginalPatternVisitor = require("eslint-scope/lib/pattern-visitor");
|
||||
const OriginalReferencer = require("eslint-scope/lib/referencer");
|
||||
const fallback = require("eslint-visitor-keys").getKeys;
|
||||
const childVisitorKeys = require("./visitor-keys");
|
||||
|
||||
const flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([
|
||||
"ArrayPattern",
|
||||
"ClassDeclaration",
|
||||
"ClassExpression",
|
||||
"FunctionDeclaration",
|
||||
"FunctionExpression",
|
||||
"Identifier",
|
||||
"ObjectPattern",
|
||||
"RestElement",
|
||||
]);
|
||||
const visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) {
|
||||
const value = t.VISITOR_KEYS[key];
|
||||
if (flowFlippedAliasKeys.indexOf(value) === -1) {
|
||||
acc[key] = value;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const propertyTypes = {
|
||||
// loops
|
||||
callProperties: { type: "loop", values: ["value"] },
|
||||
indexers: { type: "loop", values: ["key", "value"] },
|
||||
properties: { type: "loop", values: ["argument", "value"] },
|
||||
types: { type: "loop" },
|
||||
params: { type: "loop" },
|
||||
// single property
|
||||
argument: { type: "single" },
|
||||
elementType: { type: "single" },
|
||||
qualification: { type: "single" },
|
||||
rest: { type: "single" },
|
||||
returnType: { type: "single" },
|
||||
// others
|
||||
typeAnnotation: { type: "typeAnnotation" },
|
||||
typeParameters: { type: "typeParameters" },
|
||||
id: { type: "id" },
|
||||
};
|
||||
|
||||
class PatternVisitor extends OriginalPatternVisitor {
|
||||
ArrayPattern(node) {
|
||||
node.elements.forEach(this.visit, this);
|
||||
}
|
||||
|
||||
ObjectPattern(node) {
|
||||
node.properties.forEach(this.visit, this);
|
||||
}
|
||||
}
|
||||
|
||||
class Referencer extends OriginalReferencer {
|
||||
// inherits.
|
||||
visitPattern(node, options, callback) {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Visit type annotations.
|
||||
this._checkIdentifierOrVisit(node.typeAnnotation);
|
||||
if (t.isAssignmentPattern(node)) {
|
||||
this._checkIdentifierOrVisit(node.left.typeAnnotation);
|
||||
}
|
||||
|
||||
// Overwrite `super.visitPattern(node, options, callback)` in order to not visit `ArrayPattern#typeAnnotation` and `ObjectPattern#typeAnnotation`.
|
||||
if (typeof options === "function") {
|
||||
callback = options;
|
||||
options = { processRightHandNodes: false };
|
||||
}
|
||||
|
||||
const visitor = new PatternVisitor(this.options, node, callback);
|
||||
visitor.visit(node);
|
||||
|
||||
// Process the right hand nodes recursively.
|
||||
if (options.processRightHandNodes) {
|
||||
visitor.rightHandNodes.forEach(this.visit, this);
|
||||
}
|
||||
}
|
||||
|
||||
// inherits.
|
||||
visitClass(node) {
|
||||
// Decorators.
|
||||
this._visitArray(node.decorators);
|
||||
|
||||
// Flow type parameters.
|
||||
const typeParamScope = this._nestTypeParamScope(node);
|
||||
|
||||
// Flow super types.
|
||||
this._visitTypeAnnotation(node.implements);
|
||||
this._visitTypeAnnotation(
|
||||
node.superTypeParameters && node.superTypeParameters.params,
|
||||
);
|
||||
|
||||
// Basic.
|
||||
super.visitClass(node);
|
||||
|
||||
// Close the type parameter scope.
|
||||
if (typeParamScope) {
|
||||
this.close(node);
|
||||
}
|
||||
}
|
||||
|
||||
// inherits.
|
||||
visitFunction(node) {
|
||||
const typeParamScope = this._nestTypeParamScope(node);
|
||||
|
||||
// Flow return types.
|
||||
this._checkIdentifierOrVisit(node.returnType);
|
||||
|
||||
// Basic.
|
||||
super.visitFunction(node);
|
||||
|
||||
// Close the type parameter scope.
|
||||
if (typeParamScope) {
|
||||
this.close(node);
|
||||
}
|
||||
}
|
||||
|
||||
// inherits.
|
||||
visitProperty(node) {
|
||||
if (node.value && node.value.type === "TypeCastExpression") {
|
||||
this._visitTypeAnnotation(node.value);
|
||||
}
|
||||
this._visitArray(node.decorators);
|
||||
super.visitProperty(node);
|
||||
}
|
||||
|
||||
InterfaceDeclaration(node) {
|
||||
this._createScopeVariable(node, node.id);
|
||||
|
||||
const typeParamScope = this._nestTypeParamScope(node);
|
||||
|
||||
// TODO: Handle mixins
|
||||
this._visitArray(node.extends);
|
||||
this.visit(node.body);
|
||||
|
||||
if (typeParamScope) {
|
||||
this.close(node);
|
||||
}
|
||||
}
|
||||
|
||||
TypeAlias(node) {
|
||||
this._createScopeVariable(node, node.id);
|
||||
|
||||
const typeParamScope = this._nestTypeParamScope(node);
|
||||
|
||||
this.visit(node.right);
|
||||
|
||||
if (typeParamScope) {
|
||||
this.close(node);
|
||||
}
|
||||
}
|
||||
|
||||
ClassProperty(node) {
|
||||
this._visitClassProperty(node);
|
||||
}
|
||||
|
||||
ClassPrivateProperty(node) {
|
||||
this._visitClassProperty(node);
|
||||
}
|
||||
|
||||
DeclareModule(node) {
|
||||
this._visitDeclareX(node);
|
||||
}
|
||||
|
||||
DeclareFunction(node) {
|
||||
this._visitDeclareX(node);
|
||||
}
|
||||
|
||||
DeclareVariable(node) {
|
||||
this._visitDeclareX(node);
|
||||
}
|
||||
|
||||
DeclareClass(node) {
|
||||
this._visitDeclareX(node);
|
||||
}
|
||||
|
||||
// visit OptionalMemberExpression as a MemberExpression.
|
||||
OptionalMemberExpression(node) {
|
||||
super.MemberExpression(node);
|
||||
}
|
||||
|
||||
_visitClassProperty(node) {
|
||||
this._visitTypeAnnotation(node.typeAnnotation);
|
||||
this.visitProperty(node);
|
||||
}
|
||||
|
||||
_visitDeclareX(node) {
|
||||
if (node.id) {
|
||||
this._createScopeVariable(node, node.id);
|
||||
}
|
||||
|
||||
const typeParamScope = this._nestTypeParamScope(node);
|
||||
if (typeParamScope) {
|
||||
this.close(node);
|
||||
}
|
||||
}
|
||||
|
||||
_createScopeVariable(node, name) {
|
||||
this.currentScope().variableScope.__define(
|
||||
name,
|
||||
new Definition("Variable", name, node, null, null, null),
|
||||
);
|
||||
}
|
||||
|
||||
_nestTypeParamScope(node) {
|
||||
if (!node.typeParameters) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const parentScope = this.scopeManager.__currentScope;
|
||||
const scope = new escope.Scope(
|
||||
this.scopeManager,
|
||||
"type-parameters",
|
||||
parentScope,
|
||||
node,
|
||||
false,
|
||||
);
|
||||
|
||||
this.scopeManager.__nestScope(scope);
|
||||
for (let j = 0; j < node.typeParameters.params.length; j++) {
|
||||
const name = node.typeParameters.params[j];
|
||||
scope.__define(name, new Definition("TypeParameter", name, name));
|
||||
if (name.typeAnnotation) {
|
||||
this._checkIdentifierOrVisit(name);
|
||||
}
|
||||
}
|
||||
scope.__define = function() {
|
||||
return parentScope.__define.apply(parentScope, arguments);
|
||||
};
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
||||
_visitTypeAnnotation(node) {
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
if (Array.isArray(node)) {
|
||||
node.forEach(this._visitTypeAnnotation, this);
|
||||
return;
|
||||
}
|
||||
|
||||
// get property to check (params, id, etc...)
|
||||
const visitorValues = visitorKeysMap[node.type];
|
||||
if (!visitorValues) {
|
||||
return;
|
||||
}
|
||||
|
||||
// can have multiple properties
|
||||
for (let i = 0; i < visitorValues.length; i++) {
|
||||
const visitorValue = visitorValues[i];
|
||||
const propertyType = propertyTypes[visitorValue];
|
||||
const nodeProperty = node[visitorValue];
|
||||
// check if property or type is defined
|
||||
if (propertyType == null || nodeProperty == null) {
|
||||
continue;
|
||||
}
|
||||
if (propertyType.type === "loop") {
|
||||
for (let j = 0; j < nodeProperty.length; j++) {
|
||||
if (Array.isArray(propertyType.values)) {
|
||||
for (let k = 0; k < propertyType.values.length; k++) {
|
||||
const loopPropertyNode = nodeProperty[j][propertyType.values[k]];
|
||||
if (loopPropertyNode) {
|
||||
this._checkIdentifierOrVisit(loopPropertyNode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this._checkIdentifierOrVisit(nodeProperty[j]);
|
||||
}
|
||||
}
|
||||
} else if (propertyType.type === "single") {
|
||||
this._checkIdentifierOrVisit(nodeProperty);
|
||||
} else if (propertyType.type === "typeAnnotation") {
|
||||
this._visitTypeAnnotation(node.typeAnnotation);
|
||||
} else if (propertyType.type === "typeParameters") {
|
||||
for (let l = 0; l < node.typeParameters.params.length; l++) {
|
||||
this._checkIdentifierOrVisit(node.typeParameters.params[l]);
|
||||
}
|
||||
} else if (propertyType.type === "id") {
|
||||
if (node.id.type === "Identifier") {
|
||||
this._checkIdentifierOrVisit(node.id);
|
||||
} else {
|
||||
this._visitTypeAnnotation(node.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_checkIdentifierOrVisit(node) {
|
||||
if (node && node.typeAnnotation) {
|
||||
this._visitTypeAnnotation(node.typeAnnotation);
|
||||
} else if (node && node.type === "Identifier") {
|
||||
this.visit(node);
|
||||
} else {
|
||||
this._visitTypeAnnotation(node);
|
||||
}
|
||||
}
|
||||
|
||||
_visitArray(nodeList) {
|
||||
if (nodeList) {
|
||||
for (const node of nodeList) {
|
||||
this.visit(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function(ast, parserOptions) {
|
||||
const options = {
|
||||
ignoreEval: true,
|
||||
optimistic: false,
|
||||
directive: false,
|
||||
nodejsScope:
|
||||
ast.sourceType === "script" &&
|
||||
(parserOptions.ecmaFeatures &&
|
||||
parserOptions.ecmaFeatures.globalReturn) === true,
|
||||
impliedStrict: false,
|
||||
sourceType: ast.sourceType,
|
||||
ecmaVersion: parserOptions.ecmaVersion,
|
||||
fallback,
|
||||
};
|
||||
|
||||
options.childVisitorKeys = childVisitorKeys;
|
||||
|
||||
const scopeManager = new escope.ScopeManager(options);
|
||||
const referencer = new Referencer(options, scopeManager);
|
||||
|
||||
referencer.visit(ast);
|
||||
|
||||
return scopeManager;
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
const t = require("@babel/core").types;
|
||||
const convertProgramNode = require("./convertProgramNode");
|
||||
|
||||
module.exports = function(ast, traverse, code) {
|
||||
const state = { source: code };
|
||||
|
||||
// Monkey patch visitor keys in order to be able to traverse the estree nodes
|
||||
t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty;
|
||||
t.VISITOR_KEYS.MethodDefinition = [
|
||||
"key",
|
||||
"value",
|
||||
"decorators",
|
||||
"returnType",
|
||||
"typeParameters",
|
||||
];
|
||||
|
||||
traverse(ast, astTransformVisitor, null, state);
|
||||
|
||||
delete t.VISITOR_KEYS.Property;
|
||||
delete t.VISITOR_KEYS.MethodDefinition;
|
||||
|
||||
convertProgramNode(ast);
|
||||
};
|
||||
|
||||
const astTransformVisitor = {
|
||||
noScope: true,
|
||||
enter(path) {
|
||||
const node = path.node;
|
||||
|
||||
// private var to track original node type
|
||||
node._babelType = node.type;
|
||||
|
||||
if (node.innerComments) {
|
||||
delete node.innerComments;
|
||||
}
|
||||
|
||||
if (node.trailingComments) {
|
||||
delete node.trailingComments;
|
||||
}
|
||||
|
||||
if (node.leadingComments) {
|
||||
delete node.leadingComments;
|
||||
}
|
||||
},
|
||||
exit(path) {
|
||||
const node = path.node;
|
||||
|
||||
if (path.isTypeParameter()) {
|
||||
node.type = "Identifier";
|
||||
node.typeAnnotation = node.bound;
|
||||
delete node.bound;
|
||||
}
|
||||
|
||||
// flow: prevent "no-undef"
|
||||
// for "Component" in: "let x: React.Component"
|
||||
if (path.isQualifiedTypeIdentifier()) {
|
||||
delete node.id;
|
||||
}
|
||||
// for "b" in: "var a: { b: Foo }"
|
||||
if (path.isObjectTypeProperty()) {
|
||||
delete node.key;
|
||||
}
|
||||
// for "indexer" in: "var a: {[indexer: string]: number}"
|
||||
if (path.isObjectTypeIndexer()) {
|
||||
delete node.id;
|
||||
}
|
||||
// for "param" in: "var a: { func(param: Foo): Bar };"
|
||||
if (path.isFunctionTypeParam()) {
|
||||
delete node.name;
|
||||
}
|
||||
|
||||
// modules
|
||||
|
||||
if (path.isImportDeclaration()) {
|
||||
delete node.isType;
|
||||
}
|
||||
|
||||
// template string range fixes
|
||||
if (path.isTemplateLiteral()) {
|
||||
for (let j = 0; j < node.quasis.length; j++) {
|
||||
const q = node.quasis[j];
|
||||
q.range[0] -= 1;
|
||||
if (q.tail) {
|
||||
q.range[1] += 1;
|
||||
} else {
|
||||
q.range[1] += 2;
|
||||
}
|
||||
q.loc.start.column -= 1;
|
||||
if (q.tail) {
|
||||
q.loc.end.column += 1;
|
||||
} else {
|
||||
q.loc.end.column += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function(comments) {
|
||||
for (let i = 0; i < comments.length; i++) {
|
||||
const comment = comments[i];
|
||||
if (comment.type === "CommentBlock") {
|
||||
comment.type = "Block";
|
||||
} else if (comment.type === "CommentLine") {
|
||||
comment.type = "Line";
|
||||
}
|
||||
// sometimes comments don't get ranges computed,
|
||||
// even with options.ranges === true
|
||||
if (!comment.range) {
|
||||
comment.range = [comment.start, comment.end];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function(ast) {
|
||||
ast.type = "Program";
|
||||
ast.sourceType = ast.program.sourceType;
|
||||
ast.directives = ast.program.directives;
|
||||
ast.body = ast.program.body;
|
||||
delete ast.program;
|
||||
|
||||
if (ast.comments.length) {
|
||||
const lastComment = ast.comments[ast.comments.length - 1];
|
||||
|
||||
if (!ast.tokens.length) {
|
||||
// if no tokens, the program starts at the end of the last comment
|
||||
ast.start = lastComment.end;
|
||||
ast.loc.start.line = lastComment.loc.end.line;
|
||||
ast.loc.start.column = lastComment.loc.end.column;
|
||||
} else {
|
||||
const lastToken = ast.tokens[ast.tokens.length - 1];
|
||||
|
||||
if (lastComment.end > lastToken.end) {
|
||||
// If there is a comment after the last token, the program ends at the
|
||||
// last token and not the comment
|
||||
ast.range[1] = lastToken.end;
|
||||
ast.loc.end.line = lastToken.loc.end.line;
|
||||
ast.loc.end.column = lastToken.loc.end.column;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!ast.tokens.length) {
|
||||
ast.loc.start.line = 1;
|
||||
ast.loc.end.line = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ast.body && ast.body.length > 0) {
|
||||
ast.loc.start.line = ast.body[0].loc.start.line;
|
||||
ast.range[0] = ast.body[0].start;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function(tokens, tt) {
|
||||
let curlyBrace = null;
|
||||
let templateTokens = [];
|
||||
const result = [];
|
||||
|
||||
function addTemplateType() {
|
||||
const start = templateTokens[0];
|
||||
const end = templateTokens[templateTokens.length - 1];
|
||||
|
||||
const value = templateTokens.reduce((result, token) => {
|
||||
if (token.value) {
|
||||
result += token.value;
|
||||
} else if (token.type !== tt.template) {
|
||||
result += token.type.label;
|
||||
}
|
||||
|
||||
return result;
|
||||
}, "");
|
||||
|
||||
result.push({
|
||||
type: "Template",
|
||||
value: value,
|
||||
start: start.start,
|
||||
end: end.end,
|
||||
loc: {
|
||||
start: start.loc.start,
|
||||
end: end.loc.end,
|
||||
},
|
||||
});
|
||||
|
||||
templateTokens = [];
|
||||
}
|
||||
|
||||
tokens.forEach(token => {
|
||||
switch (token.type) {
|
||||
case tt.backQuote:
|
||||
if (curlyBrace) {
|
||||
result.push(curlyBrace);
|
||||
curlyBrace = null;
|
||||
}
|
||||
|
||||
templateTokens.push(token);
|
||||
|
||||
if (templateTokens.length > 1) {
|
||||
addTemplateType();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case tt.dollarBraceL:
|
||||
templateTokens.push(token);
|
||||
addTemplateType();
|
||||
break;
|
||||
|
||||
case tt.braceR:
|
||||
if (curlyBrace) {
|
||||
result.push(curlyBrace);
|
||||
}
|
||||
|
||||
curlyBrace = token;
|
||||
break;
|
||||
|
||||
case tt.template:
|
||||
if (curlyBrace) {
|
||||
templateTokens.push(curlyBrace);
|
||||
curlyBrace = null;
|
||||
}
|
||||
|
||||
templateTokens.push(token);
|
||||
break;
|
||||
|
||||
case tt.eof:
|
||||
if (curlyBrace) {
|
||||
result.push(curlyBrace);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
if (curlyBrace) {
|
||||
result.push(curlyBrace);
|
||||
curlyBrace = null;
|
||||
}
|
||||
|
||||
result.push(token);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function(token, tt, source) {
|
||||
const type = token.type;
|
||||
token.range = [token.start, token.end];
|
||||
|
||||
if (type === tt.name) {
|
||||
token.type = "Identifier";
|
||||
} else if (
|
||||
type === tt.semi ||
|
||||
type === tt.comma ||
|
||||
type === tt.parenL ||
|
||||
type === tt.parenR ||
|
||||
type === tt.braceL ||
|
||||
type === tt.braceR ||
|
||||
type === tt.slash ||
|
||||
type === tt.dot ||
|
||||
type === tt.bracketL ||
|
||||
type === tt.bracketR ||
|
||||
type === tt.ellipsis ||
|
||||
type === tt.arrow ||
|
||||
type === tt.pipeline ||
|
||||
type === tt.star ||
|
||||
type === tt.incDec ||
|
||||
type === tt.colon ||
|
||||
type === tt.question ||
|
||||
type === tt.questionDot ||
|
||||
type === tt.template ||
|
||||
type === tt.backQuote ||
|
||||
type === tt.dollarBraceL ||
|
||||
type === tt.at ||
|
||||
type === tt.logicalOR ||
|
||||
type === tt.logicalAND ||
|
||||
type === tt.nullishCoalescing ||
|
||||
type === tt.bitwiseOR ||
|
||||
type === tt.bitwiseXOR ||
|
||||
type === tt.bitwiseAND ||
|
||||
type === tt.equality ||
|
||||
type === tt.relational ||
|
||||
type === tt.bitShift ||
|
||||
type === tt.plusMin ||
|
||||
type === tt.modulo ||
|
||||
type === tt.exponent ||
|
||||
type === tt.bang ||
|
||||
type === tt.tilde ||
|
||||
type === tt.doubleColon ||
|
||||
type === tt.hash ||
|
||||
type.isAssign
|
||||
) {
|
||||
token.type = "Punctuator";
|
||||
if (!token.value) token.value = type.label;
|
||||
} else if (type === tt.jsxTagStart) {
|
||||
token.type = "Punctuator";
|
||||
token.value = "<";
|
||||
} else if (type === tt.jsxTagEnd) {
|
||||
token.type = "Punctuator";
|
||||
token.value = ">";
|
||||
} else if (type === tt.jsxName) {
|
||||
token.type = "JSXIdentifier";
|
||||
} else if (type === tt.jsxText) {
|
||||
token.type = "JSXText";
|
||||
} else if (type.keyword === "null") {
|
||||
token.type = "Null";
|
||||
} else if (type.keyword === "false" || type.keyword === "true") {
|
||||
token.type = "Boolean";
|
||||
} else if (type.keyword) {
|
||||
token.type = "Keyword";
|
||||
} else if (type === tt.num) {
|
||||
token.type = "Numeric";
|
||||
token.value = source.slice(token.start, token.end);
|
||||
} else if (type === tt.string) {
|
||||
token.type = "String";
|
||||
token.value = source.slice(token.start, token.end);
|
||||
} else if (type === tt.regexp) {
|
||||
token.type = "RegularExpression";
|
||||
const value = token.value;
|
||||
token.regex = {
|
||||
pattern: value.pattern,
|
||||
flags: value.flags,
|
||||
};
|
||||
token.value = `/${value.pattern}/${value.flags}`;
|
||||
}
|
||||
|
||||
return token;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
const convertTemplateType = require("./convertTemplateType");
|
||||
const convertToken = require("./convertToken");
|
||||
|
||||
module.exports = function(tokens, tt, code) {
|
||||
return convertTemplateType(tokens, tt)
|
||||
.filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock")
|
||||
.map(t => convertToken(t, tt, code));
|
||||
};
|
||||
11
eslint/babel-eslint-parser/src/babylon-to-espree/index.js
Normal file
11
eslint/babel-eslint-parser/src/babylon-to-espree/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
const convertTokens = require("./convertTokens");
|
||||
const convertComments = require("./convertComments");
|
||||
const convertAST = require("./convertAST");
|
||||
|
||||
module.exports = function(ast, traverse, tt, code) {
|
||||
ast.tokens = convertTokens(ast.tokens, tt, code);
|
||||
convertComments(ast.comments);
|
||||
convertAST(ast, traverse, code);
|
||||
};
|
||||
33
eslint/babel-eslint-parser/src/index.js
Normal file
33
eslint/babel-eslint-parser/src/index.js
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
const semver = require("semver");
|
||||
const babelCore = require("@babel/core");
|
||||
const packageJson = require("../package.json");
|
||||
|
||||
const CURRENT_BABEL_VERSION = babelCore.version;
|
||||
const SUPPORTED_BABEL_VERSION_RANGE =
|
||||
packageJson.peerDependencies["@babel/core"];
|
||||
const IS_RUNNING_SUPPORTED_VERSION = semver.satisfies(
|
||||
semver.coerce(CURRENT_BABEL_VERSION).raw,
|
||||
SUPPORTED_BABEL_VERSION_RANGE,
|
||||
);
|
||||
|
||||
exports.parse = function(code, options) {
|
||||
return exports.parseForESLint(code, options).ast;
|
||||
};
|
||||
|
||||
exports.parseForESLint = function(code, options = {}) {
|
||||
if (!IS_RUNNING_SUPPORTED_VERSION) {
|
||||
throw new Error(
|
||||
`babel-eslint@${packageJson.version} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}`,
|
||||
);
|
||||
}
|
||||
|
||||
options.babelOptions = options.babelOptions || {};
|
||||
options.ecmaVersion = options.ecmaVersion || 2018;
|
||||
options.sourceType = options.sourceType || "module";
|
||||
options.allowImportExportEverywhere =
|
||||
options.allowImportExportEverywhere || false;
|
||||
|
||||
return require("./parse-with-scope")(code, options);
|
||||
};
|
||||
12
eslint/babel-eslint-parser/src/parse-with-scope.js
Normal file
12
eslint/babel-eslint-parser/src/parse-with-scope.js
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
const visitorKeys = require("./visitor-keys");
|
||||
const analyzeScope = require("./analyze-scope");
|
||||
const parse = require("./parse");
|
||||
|
||||
module.exports = function(code, options) {
|
||||
const ast = parse(code, options);
|
||||
const scopeManager = analyzeScope(ast, options);
|
||||
|
||||
return { ast, scopeManager, visitorKeys };
|
||||
};
|
||||
73
eslint/babel-eslint-parser/src/parse.js
Normal file
73
eslint/babel-eslint-parser/src/parse.js
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
|
||||
const babylonToEspree = require("./babylon-to-espree");
|
||||
const {
|
||||
parseSync: parse,
|
||||
tokTypes: tt,
|
||||
traverse,
|
||||
loadPartialConfig,
|
||||
} = require("@babel/core");
|
||||
|
||||
module.exports = function(code, options) {
|
||||
let opts = {
|
||||
sourceType: options.sourceType,
|
||||
filename: options.filePath,
|
||||
cwd: options.babelOptions.cwd,
|
||||
root: options.babelOptions.root,
|
||||
rootMode: options.babelOptions.rootMode,
|
||||
envName: options.babelOptions.envName,
|
||||
configFile: options.babelOptions.configFile,
|
||||
babelrc: options.babelOptions.babelrc,
|
||||
babelrcRoots: options.babelOptions.babelrcRoots,
|
||||
extends: options.babelOptions.extends,
|
||||
env: options.babelOptions.env,
|
||||
overrides: options.babelOptions.overrides,
|
||||
test: options.babelOptions.test,
|
||||
include: options.babelOptions.include,
|
||||
exclude: options.babelOptions.exclude,
|
||||
ignore: options.babelOptions.ignore,
|
||||
only: options.babelOptions.only,
|
||||
parserOpts: {
|
||||
allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree
|
||||
allowReturnOutsideFunction: true,
|
||||
allowSuperOutsideMethod: true,
|
||||
ranges: true,
|
||||
tokens: true,
|
||||
plugins: ["estree"],
|
||||
},
|
||||
caller: {
|
||||
name: "babel-eslint",
|
||||
},
|
||||
};
|
||||
|
||||
if (options.requireConfigFile !== false) {
|
||||
const config = loadPartialConfig(opts);
|
||||
|
||||
if (config !== null) {
|
||||
if (!config.hasFilesystemConfig()) {
|
||||
throw new Error(
|
||||
`No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`,
|
||||
);
|
||||
}
|
||||
|
||||
opts = config.options;
|
||||
}
|
||||
}
|
||||
|
||||
let ast;
|
||||
|
||||
try {
|
||||
ast = parse(code, opts);
|
||||
} catch (err) {
|
||||
if (err instanceof SyntaxError) {
|
||||
err.lineNumber = err.loc.line;
|
||||
err.column = err.loc.column;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
babylonToEspree(ast, traverse, tt, code);
|
||||
|
||||
return ast;
|
||||
};
|
||||
15
eslint/babel-eslint-parser/src/visitor-keys.js
Normal file
15
eslint/babel-eslint-parser/src/visitor-keys.js
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
const BABEL_VISITOR_KEYS = require("@babel/core").types.VISITOR_KEYS;
|
||||
const ESLINT_VISITOR_KEYS = require("eslint-visitor-keys").KEYS;
|
||||
|
||||
module.exports = Object.assign(
|
||||
{
|
||||
Literal: ESLINT_VISITOR_KEYS.Literal,
|
||||
MethodDefinition: ["decorators"].concat(
|
||||
ESLINT_VISITOR_KEYS.MethodDefinition,
|
||||
),
|
||||
Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property),
|
||||
},
|
||||
BABEL_VISITOR_KEYS,
|
||||
);
|
||||
527
eslint/babel-eslint-parser/test/babel-eslint.js
Normal file
527
eslint/babel-eslint-parser/test/babel-eslint.js
Normal file
@@ -0,0 +1,527 @@
|
||||
"use strict";
|
||||
|
||||
const assert = require("assert");
|
||||
const path = require("path");
|
||||
const babelEslint = require("../");
|
||||
const espree = require("espree");
|
||||
const escope = require("eslint-scope");
|
||||
const unpad = require("dedent");
|
||||
const assertImplementsAST = require("./helpers/assert-implements-ast");
|
||||
|
||||
const babelOptions = {
|
||||
configFile: path.resolve(
|
||||
__dirname,
|
||||
"./fixtures/config/babel.config.js"
|
||||
),
|
||||
}
|
||||
|
||||
function parseAndAssertSame(code) {
|
||||
code = unpad(code);
|
||||
const esAST = espree.parse(code, {
|
||||
ecmaFeatures: {
|
||||
// enable JSX parsing
|
||||
jsx: true,
|
||||
// enable return in global scope
|
||||
globalReturn: true,
|
||||
// enable implied strict mode (if ecmaVersion >= 5)
|
||||
impliedStrict: true,
|
||||
// allow experimental object rest/spread
|
||||
experimentalObjectRestSpread: true,
|
||||
},
|
||||
tokens: true,
|
||||
loc: true,
|
||||
range: true,
|
||||
comment: true,
|
||||
ecmaVersion: 2018,
|
||||
sourceType: "module",
|
||||
});
|
||||
const babylonAST = babelEslint.parseForESLint(code, {
|
||||
eslintVisitorKeys: true,
|
||||
eslintScopeManager: true,
|
||||
babelOptions,
|
||||
}).ast;
|
||||
assertImplementsAST(esAST, babylonAST);
|
||||
}
|
||||
|
||||
describe("babylon-to-espree", () => {
|
||||
describe("compatibility", () => {
|
||||
it("should allow ast.analyze to be called without options", function() {
|
||||
const esAST = babelEslint.parseForESLint("`test`", {
|
||||
eslintScopeManager: true,
|
||||
eslintVisitorKeys: true,
|
||||
babelOptions,
|
||||
}).ast;
|
||||
expect(() => {
|
||||
escope.analyze(esAST)
|
||||
}).not.toThrow(new TypeError('Should allow no options argument.'));
|
||||
});
|
||||
});
|
||||
|
||||
describe("templates", () => {
|
||||
it("empty template string", () => {
|
||||
parseAndAssertSame("``");
|
||||
});
|
||||
|
||||
it("template string", () => {
|
||||
parseAndAssertSame("`test`");
|
||||
});
|
||||
|
||||
it("template string using $", () => {
|
||||
parseAndAssertSame("`$`");
|
||||
});
|
||||
|
||||
it("template string with expression", () => {
|
||||
parseAndAssertSame("`${a}`");
|
||||
});
|
||||
|
||||
it("template string with multiple expressions", () => {
|
||||
parseAndAssertSame("`${a}${b}${c}`");
|
||||
});
|
||||
|
||||
it("template string with expression and strings", () => {
|
||||
parseAndAssertSame("`a${a}a`");
|
||||
});
|
||||
|
||||
it("template string with binary expression", () => {
|
||||
parseAndAssertSame("`a${a + b}a`");
|
||||
});
|
||||
|
||||
it("tagged template", () => {
|
||||
parseAndAssertSame("jsx`<Button>Click</Button>`");
|
||||
});
|
||||
|
||||
it("tagged template with expression", () => {
|
||||
parseAndAssertSame("jsx`<Button>Hi ${name}</Button>`");
|
||||
});
|
||||
|
||||
it("tagged template with new operator", () => {
|
||||
parseAndAssertSame("new raw`42`");
|
||||
});
|
||||
|
||||
it("template with nested function/object", () => {
|
||||
parseAndAssertSame(
|
||||
"`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`"
|
||||
);
|
||||
});
|
||||
|
||||
it("template with braces inside and outside of template string #96", () => {
|
||||
parseAndAssertSame(
|
||||
"if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }"
|
||||
);
|
||||
});
|
||||
|
||||
it("template also with braces #96", () => {
|
||||
parseAndAssertSame(`
|
||||
export default function f1() {
|
||||
function f2(foo) {
|
||||
const bar = 3;
|
||||
return \`\${foo} \${bar}\`;
|
||||
}
|
||||
return f2;
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it("template with destructuring #31", () => {
|
||||
parseAndAssertSame(`
|
||||
module.exports = {
|
||||
render() {
|
||||
var {name} = this.props;
|
||||
return Math.max(null, \`Name: \${name}, Name: \${name}\`);
|
||||
}
|
||||
};
|
||||
`);
|
||||
});
|
||||
|
||||
it("template with arrow returning template #603", () => {
|
||||
parseAndAssertSame(`
|
||||
var a = \`\${() => {
|
||||
\`\${''}\`
|
||||
}}\`;
|
||||
`);
|
||||
});
|
||||
|
||||
it("template string with object with template string inside", () => {
|
||||
parseAndAssertSame("`${ { a:`${2}` } }`");
|
||||
});
|
||||
});
|
||||
|
||||
it("simple expression", () => {
|
||||
parseAndAssertSame("a = 1");
|
||||
});
|
||||
|
||||
it("logical NOT", () => {
|
||||
parseAndAssertSame("!0");
|
||||
});
|
||||
|
||||
it("bitwise NOT", () => {
|
||||
parseAndAssertSame("~0");
|
||||
});
|
||||
|
||||
it("class declaration", () => {
|
||||
parseAndAssertSame("class Foo {}");
|
||||
});
|
||||
|
||||
it("class expression", () => {
|
||||
parseAndAssertSame("var a = class Foo {}");
|
||||
});
|
||||
|
||||
it("jsx expression", () => {
|
||||
parseAndAssertSame("<App />");
|
||||
});
|
||||
|
||||
it("jsx expression with 'this' as identifier", () => {
|
||||
parseAndAssertSame("<this />");
|
||||
});
|
||||
|
||||
it("jsx expression with a dynamic attribute", () => {
|
||||
parseAndAssertSame("<App foo={bar} />");
|
||||
});
|
||||
|
||||
it("jsx expression with a member expression as identifier", () => {
|
||||
parseAndAssertSame("<foo.bar />");
|
||||
});
|
||||
|
||||
it("jsx expression with spread", () => {
|
||||
parseAndAssertSame("var myDivElement = <div {...this.props} />;");
|
||||
});
|
||||
|
||||
it("empty jsx text", () => {
|
||||
parseAndAssertSame("<a></a>");
|
||||
});
|
||||
|
||||
it("jsx text with content", () => {
|
||||
parseAndAssertSame("<a>Hello, world!</a>");
|
||||
});
|
||||
|
||||
it("nested jsx", () => {
|
||||
parseAndAssertSame("<div>\n<h1>Wat</h1>\n</div>");
|
||||
});
|
||||
|
||||
it("default import", () => {
|
||||
parseAndAssertSame('import foo from "foo";');
|
||||
});
|
||||
|
||||
it("import specifier", () => {
|
||||
parseAndAssertSame('import { foo } from "foo";');
|
||||
});
|
||||
|
||||
it("import specifier with name", () => {
|
||||
parseAndAssertSame('import { foo as bar } from "foo";');
|
||||
});
|
||||
|
||||
it("import bare", () => {
|
||||
parseAndAssertSame('import "foo";');
|
||||
});
|
||||
|
||||
it("export default class declaration", () => {
|
||||
parseAndAssertSame("export default class Foo {}");
|
||||
});
|
||||
|
||||
it("export default class expression", () => {
|
||||
parseAndAssertSame("export default class {}");
|
||||
});
|
||||
|
||||
it("export default function declaration", () => {
|
||||
parseAndAssertSame("export default function Foo() {}");
|
||||
});
|
||||
|
||||
it("export default function expression", () => {
|
||||
parseAndAssertSame("export default function () {}");
|
||||
});
|
||||
|
||||
it("export all", () => {
|
||||
parseAndAssertSame('export * from "foo";');
|
||||
});
|
||||
|
||||
it("export named", () => {
|
||||
parseAndAssertSame("var foo = 1;export { foo };");
|
||||
});
|
||||
|
||||
it("export named alias", () => {
|
||||
parseAndAssertSame("var foo = 1;export { foo as bar };");
|
||||
});
|
||||
|
||||
// Espree doesn't support the optional chaining operator yet
|
||||
it("optional chaining operator (token)", () => {
|
||||
const code = "foo?.bar";
|
||||
const babylonAST = babelEslint.parseForESLint(code, {
|
||||
eslintVisitorKeys: true,
|
||||
eslintScopeManager: true,
|
||||
babelOptions,
|
||||
}).ast;
|
||||
assert.strictEqual(babylonAST.tokens[1].type, "Punctuator");
|
||||
});
|
||||
|
||||
// Espree doesn't support the nullish coalescing operator yet
|
||||
it("nullish coalescing operator (token)", () => {
|
||||
const code = "foo ?? bar";
|
||||
const babylonAST = babelEslint.parseForESLint(code, {
|
||||
eslintVisitorKeys: true,
|
||||
eslintScopeManager: true,
|
||||
babelOptions,
|
||||
}).ast;
|
||||
assert.strictEqual(babylonAST.tokens[1].type, "Punctuator");
|
||||
});
|
||||
|
||||
// Espree doesn't support the pipeline operator yet
|
||||
it("pipeline operator (token)", () => {
|
||||
const code = "foo |> bar";
|
||||
const babylonAST = babelEslint.parseForESLint(code, {
|
||||
eslintVisitorKeys: true,
|
||||
eslintScopeManager: true,
|
||||
babelOptions,
|
||||
}).ast;
|
||||
assert.strictEqual(babylonAST.tokens[1].type, "Punctuator");
|
||||
});
|
||||
|
||||
// Espree doesn't support the private fields yet
|
||||
it("hash (token)", () => {
|
||||
const code = "class A { #x }";
|
||||
const babylonAST = babelEslint.parseForESLint(code, {
|
||||
eslintVisitorKeys: true,
|
||||
eslintScopeManager: true,
|
||||
babelOptions,
|
||||
}).ast;
|
||||
assert.strictEqual(babylonAST.tokens[3].type, "Punctuator");
|
||||
assert.strictEqual(babylonAST.tokens[3].value, "#");
|
||||
});
|
||||
|
||||
it.skip("empty program with line comment", () => {
|
||||
parseAndAssertSame("// single comment");
|
||||
});
|
||||
|
||||
it.skip("empty program with block comment", () => {
|
||||
parseAndAssertSame(" /* multiline\n * comment\n*/");
|
||||
});
|
||||
|
||||
it("line comments", () => {
|
||||
parseAndAssertSame(`
|
||||
// single comment
|
||||
var foo = 15; // comment next to statement
|
||||
// second comment after statement
|
||||
`);
|
||||
});
|
||||
|
||||
it("block comments", () => {
|
||||
parseAndAssertSame(`
|
||||
/* single comment */
|
||||
var foo = 15; /* comment next to statement */
|
||||
/*
|
||||
* multiline
|
||||
* comment
|
||||
*/
|
||||
`);
|
||||
});
|
||||
|
||||
it("block comments #124", () => {
|
||||
parseAndAssertSame(`
|
||||
React.createClass({
|
||||
render() {
|
||||
// return (
|
||||
// <div />
|
||||
// ); // <-- this is the line that is reported
|
||||
}
|
||||
});
|
||||
`);
|
||||
});
|
||||
|
||||
it("null", () => {
|
||||
parseAndAssertSame("null");
|
||||
});
|
||||
|
||||
it("boolean", () => {
|
||||
parseAndAssertSame("if (true) {} else if (false) {}");
|
||||
});
|
||||
|
||||
it("regexp", () => {
|
||||
parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/");
|
||||
});
|
||||
|
||||
it("regexp", () => {
|
||||
parseAndAssertSame("const foo = /foo/;");
|
||||
});
|
||||
|
||||
it("regexp y flag", () => {
|
||||
parseAndAssertSame("const foo = /foo/y;");
|
||||
});
|
||||
|
||||
it("regexp u flag", () => {
|
||||
parseAndAssertSame("const foo = /foo/u;");
|
||||
});
|
||||
|
||||
it("regexp in a template string", () => {
|
||||
parseAndAssertSame('`${/\\d/.exec("1")[0]}`');
|
||||
});
|
||||
|
||||
it("first line is empty", () => {
|
||||
parseAndAssertSame('\nimport Immutable from "immutable";');
|
||||
});
|
||||
|
||||
it("empty", () => {
|
||||
parseAndAssertSame("");
|
||||
});
|
||||
|
||||
it("jsdoc", () => {
|
||||
parseAndAssertSame(`
|
||||
/**
|
||||
* @param {object} options
|
||||
* @return {number}
|
||||
*/
|
||||
const test = function({ a, b, c }) {
|
||||
return a + b + c;
|
||||
};
|
||||
module.exports = test;
|
||||
`);
|
||||
});
|
||||
|
||||
it("empty block with comment", () => {
|
||||
parseAndAssertSame(`
|
||||
function a () {
|
||||
try {
|
||||
b();
|
||||
} catch (e) {
|
||||
// asdf
|
||||
}
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
describe("babel tests", () => {
|
||||
it("MethodDefinition", () => {
|
||||
parseAndAssertSame(`
|
||||
export default class A {
|
||||
a() {}
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it("MethodDefinition 2", () => {
|
||||
parseAndAssertSame(
|
||||
"export default class Bar { get bar() { return 42; }}"
|
||||
);
|
||||
});
|
||||
|
||||
it("ClassMethod", () => {
|
||||
parseAndAssertSame(`
|
||||
class A {
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it("ClassMethod multiple params", () => {
|
||||
parseAndAssertSame(`
|
||||
class A {
|
||||
constructor(a, b, c) {
|
||||
}
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it("ClassMethod multiline", () => {
|
||||
parseAndAssertSame(`
|
||||
class A {
|
||||
constructor (
|
||||
a,
|
||||
b,
|
||||
c
|
||||
)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it("ClassMethod oneline", () => {
|
||||
parseAndAssertSame("class A { constructor(a, b, c) {} }");
|
||||
});
|
||||
|
||||
it("ObjectMethod", () => {
|
||||
parseAndAssertSame(`
|
||||
var a = {
|
||||
b(c) {
|
||||
}
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it("do not allow import export everywhere", () => {
|
||||
assert.throws(() => {
|
||||
parseAndAssertSame('function F() { import a from "a"; }');
|
||||
}, /SyntaxError: 'import' and 'export' may only appear at the top level/);
|
||||
});
|
||||
|
||||
it("return outside function", () => {
|
||||
parseAndAssertSame("return;");
|
||||
});
|
||||
|
||||
it("super outside method", () => {
|
||||
assert.throws(() => {
|
||||
parseAndAssertSame("function F() { super(); }");
|
||||
}, /SyntaxError: 'super' keyword outside a method/);
|
||||
});
|
||||
|
||||
it("StringLiteral", () => {
|
||||
parseAndAssertSame("");
|
||||
parseAndAssertSame("");
|
||||
parseAndAssertSame("a");
|
||||
});
|
||||
|
||||
it("getters and setters", () => {
|
||||
parseAndAssertSame("class A { get x ( ) { ; } }");
|
||||
parseAndAssertSame(`
|
||||
class A {
|
||||
get x(
|
||||
)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
`);
|
||||
parseAndAssertSame("class A { set x (a) { ; } }");
|
||||
parseAndAssertSame(`
|
||||
class A {
|
||||
set x(a
|
||||
)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
`);
|
||||
parseAndAssertSame(`
|
||||
var B = {
|
||||
get x () {
|
||||
return this.ecks;
|
||||
},
|
||||
set x (ecks) {
|
||||
this.ecks = ecks;
|
||||
}
|
||||
};
|
||||
`);
|
||||
});
|
||||
|
||||
it("RestOperator", () => {
|
||||
parseAndAssertSame("var { a, ...b } = c");
|
||||
parseAndAssertSame("var [ a, ...b ] = c");
|
||||
parseAndAssertSame("var a = function (...b) {}");
|
||||
});
|
||||
|
||||
it("SpreadOperator", () => {
|
||||
parseAndAssertSame("var a = { b, ...c }");
|
||||
parseAndAssertSame("var a = [ a, ...b ]");
|
||||
parseAndAssertSame("var a = sum(...b)");
|
||||
});
|
||||
|
||||
it("Async/Await", () => {
|
||||
parseAndAssertSame(`
|
||||
async function a() {
|
||||
await 1;
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
||||
});
|
||||
6
eslint/babel-eslint-parser/test/fixtures/config/babel.config.decorators-legacy.js
vendored
Normal file
6
eslint/babel-eslint-parser/test/fixtures/config/babel.config.decorators-legacy.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
presets: [["@babel/preset-env", { forceAllTransforms: true }]],
|
||||
plugins: [["@babel/plugin-proposal-decorators", { legacy: true }]],
|
||||
};
|
||||
21
eslint/babel-eslint-parser/test/fixtures/config/babel.config.js
vendored
Normal file
21
eslint/babel-eslint-parser/test/fixtures/config/babel.config.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
["@babel/preset-env", { forceAllTransforms: true }],
|
||||
["@babel/preset-flow", { all: true }],
|
||||
"@babel/preset-react",
|
||||
],
|
||||
plugins: [
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
"@babel/plugin-syntax-export-default-from",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
"@babel/plugin-syntax-numeric-separator",
|
||||
"@babel/plugin-syntax-export-namespace-from",
|
||||
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: false }],
|
||||
["@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" }],
|
||||
],
|
||||
};
|
||||
11
eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml
vendored
Normal file
11
eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/.eslintrc.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
root: true
|
||||
|
||||
# babel-eslint
|
||||
parser: ../../../lib/index.js
|
||||
|
||||
# use eslint-plugin-import
|
||||
plugins:
|
||||
- import
|
||||
rules:
|
||||
import/no-named-as-default: error
|
||||
no-unused-vars: error
|
||||
1
eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js
vendored
Normal file
1
eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/a.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function foo() { }
|
||||
1
eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js
vendored
Normal file
1
eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/b.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import foo from './a.js';
|
||||
4
eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js
vendored
Normal file
4
eslint/babel-eslint-parser/test/fixtures/eslint-plugin-import/c.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
// @flow
|
||||
type Foo = {};
|
||||
|
||||
const FlowTypeButton = ({ }: Foo) => { };
|
||||
3
eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js
vendored
Normal file
3
eslint/babel-eslint-parser/test/fixtures/rules/strict/function-with.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
function x () {
|
||||
"use strict";
|
||||
}
|
||||
1
eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js
vendored
Normal file
1
eslint/babel-eslint-parser/test/fixtures/rules/strict/function-without.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function x () {}
|
||||
5
eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js
vendored
Normal file
5
eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-with.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
function x () {
|
||||
"use strict";
|
||||
}
|
||||
3
eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js
vendored
Normal file
3
eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with-function-without.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
function x () {}
|
||||
6
eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js
vendored
Normal file
6
eslint/babel-eslint-parser/test/fixtures/rules/strict/global-with.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
/*
|
||||
The empty statement is intentional. As of now, ESLint won't enforce
|
||||
string: [2, "global"] on a program with an empty body. A test for that without
|
||||
massaging the AST to ESlint's input format should fail.
|
||||
*/
|
||||
1
eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js
vendored
Normal file
1
eslint/babel-eslint-parser/test/fixtures/rules/strict/none.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"no use strict anywhere";
|
||||
6
eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js
vendored
Normal file
6
eslint/babel-eslint-parser/test/fixtures/rules/syntax-error.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
class ClassName {
|
||||
constructor() {
|
||||
|
||||
},
|
||||
aMethod() {}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
// Checks if the source ast implements the target ast. Ignores extra keys on source ast
|
||||
module.exports = function assertImplementsAST(target, source, path) {
|
||||
if (!path) {
|
||||
path = [];
|
||||
}
|
||||
|
||||
function error(text) {
|
||||
const err = new Error(`At ${path.join(".")}: ${text}:`);
|
||||
err.depth = path.length + 1;
|
||||
throw err;
|
||||
}
|
||||
|
||||
const typeA = target === null ? "null" : typeof target;
|
||||
const typeB = source === null ? "null" : typeof source;
|
||||
if (typeA !== typeB) {
|
||||
error(
|
||||
`have different types (${typeA} !== ${typeB}) (${target} !== ${source})`
|
||||
);
|
||||
} else if (
|
||||
typeA === "object" &&
|
||||
["RegExp"].indexOf(target.constructor.name) !== -1 &&
|
||||
target.constructor.name !== source.constructor.name
|
||||
) {
|
||||
error(
|
||||
`object have different constructors (${target.constructor.name} !== ${source.constructor.name}`
|
||||
);
|
||||
} else if (typeA === "object") {
|
||||
const keysTarget = Object.keys(target);
|
||||
for (const i in keysTarget) {
|
||||
const key = keysTarget[i];
|
||||
path.push(key);
|
||||
assertImplementsAST(target[key], source[key], path);
|
||||
path.pop();
|
||||
}
|
||||
} else if (target !== source) {
|
||||
error(
|
||||
`are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})`
|
||||
);
|
||||
}
|
||||
};
|
||||
238
eslint/babel-eslint-parser/test/integration.js
Normal file
238
eslint/babel-eslint-parser/test/integration.js
Normal file
@@ -0,0 +1,238 @@
|
||||
"use strict";
|
||||
|
||||
const eslint = require("eslint");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const parser = require("../");
|
||||
|
||||
eslint.linter.defineParser("current-babel-eslint", parser);
|
||||
|
||||
const paths = {
|
||||
fixtures: path.join(__dirname, "fixtures", "rules"),
|
||||
};
|
||||
|
||||
const encoding = "utf8";
|
||||
const errorLevel = 2;
|
||||
|
||||
const baseEslintOpts = {
|
||||
parser: "current-babel-eslint",
|
||||
parserOptions: {
|
||||
sourceType: "script",
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Load a fixture and run eslint.linter.verify() on it.
|
||||
* Pass the return value to done().
|
||||
* @param object opts
|
||||
* @param function done
|
||||
*/
|
||||
function lint(opts, done) {
|
||||
readFixture(opts.fixture, (err, src) => {
|
||||
if (err) return done(err);
|
||||
done(null, eslint.linter.verify(src, opts.eslint));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a fixture file, passing the content to done().
|
||||
* @param string|array id
|
||||
* @param function done
|
||||
*/
|
||||
function readFixture(id, done) {
|
||||
if (Array.isArray(id)) id = path.join.apply(path, id);
|
||||
if (!path.extname(id)) id += ".js";
|
||||
fs.readFile(path.join(paths.fixtures, id), encoding, done);
|
||||
}
|
||||
// readFixture
|
||||
|
||||
describe("Rules:", () => {
|
||||
describe("`strict`", strictSuite);
|
||||
});
|
||||
// describe
|
||||
|
||||
function strictSuite() {
|
||||
const ruleId = "strict";
|
||||
|
||||
describe("when set to 'never'", () => {
|
||||
const eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||
rules: {},
|
||||
});
|
||||
eslintOpts.rules[ruleId] = [errorLevel, "never"];
|
||||
|
||||
["global-with", "function-with"].forEach(fixture => {
|
||||
it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", fixture],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
expect(report[0].ruleId).toBe(ruleId);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
});
|
||||
});
|
||||
// describe
|
||||
|
||||
describe("when set to 'global'", () => {
|
||||
const eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||
rules: {},
|
||||
});
|
||||
eslintOpts.rules[ruleId] = [errorLevel, "global"];
|
||||
|
||||
it("shouldn't error on single global directive", done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", "global-with"],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
expect(report.length).toBe(0);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error twice on global directive: no and function directive: yes", done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", "function-with"],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
[0, 1].forEach(i => {
|
||||
expect(report[0].ruleId).toBe(ruleId);
|
||||
});
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error on function directive", done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", "global-with-function-with"],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
expect(report[0].ruleId).toBe(ruleId);
|
||||
// This is to make sure the test fails prior to adapting Babel AST
|
||||
// directive representation to ESLint format. Otherwise it reports an
|
||||
// error for missing global directive that masquerades as the expected
|
||||
// result of the previous assertion.
|
||||
expect(report[0].nodeType).not.toBe("Program");
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error on no directive", done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", "none"],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
expect(report[0].ruleId).toBe(ruleId);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
});
|
||||
// describe
|
||||
|
||||
describe("when set to 'function'", () => {
|
||||
const eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||
rules: {},
|
||||
});
|
||||
eslintOpts.rules[ruleId] = [errorLevel, "function"];
|
||||
|
||||
it("shouldn't error on single function directive", done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", "function-with"],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
expect(report.length).toBe(0);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error twice on function directive: no and global directive: yes", done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", "global-with-function-without"],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
[0, 1].forEach(i => {
|
||||
expect(report[i].ruleId).toBe(ruleId);
|
||||
});
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error on only global directive", done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", "global-with"],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
expect(report[0].ruleId).toBe(ruleId);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error on extraneous global directive", done => {
|
||||
lint(
|
||||
{
|
||||
fixture: ["strict", "global-with-function-with"],
|
||||
eslint: eslintOpts,
|
||||
},
|
||||
(err, report) => {
|
||||
if (err) return done(err);
|
||||
expect(report[0].ruleId).toBe(ruleId);
|
||||
expect(report[0].nodeType.indexOf("Function")).toBe(-1);
|
||||
done();
|
||||
}
|
||||
);
|
||||
});
|
||||
// it
|
||||
});
|
||||
}
|
||||
|
||||
describe("https://github.com/babel/babel-eslint/issues/558", () => {
|
||||
it("doesn't crash with eslint-plugin-import", () => {
|
||||
const engine = new eslint.CLIEngine({ ignore: false });
|
||||
const files = ['a.js', 'b.js', 'c.js'];
|
||||
let fileWithPath = files.map(file =>
|
||||
path.resolve(__dirname, `./fixtures/eslint-plugin-import/${file}`));
|
||||
engine.executeOnFiles(fileWithPath);
|
||||
});
|
||||
});
|
||||
|
||||
1879
eslint/babel-eslint-parser/test/non-regression.js
Normal file
1879
eslint/babel-eslint-parser/test/non-regression.js
Normal file
File diff suppressed because it is too large
Load Diff
4
eslint/babel-eslint-plugin-development/.npmignore
Normal file
4
eslint/babel-eslint-plugin-development/.npmignore
Normal file
@@ -0,0 +1,4 @@
|
||||
src
|
||||
test
|
||||
.*
|
||||
*.log
|
||||
38
eslint/babel-eslint-plugin-development/README.md
Normal file
38
eslint/babel-eslint-plugin-development/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# @babel/eslint-plugin-development
|
||||
|
||||
A set of eslint rules to enforce best practices in the development of Babel plugins.
|
||||
|
||||
## Installation
|
||||
|
||||
You'll first need to install [ESLint](http://eslint.org):
|
||||
|
||||
```
|
||||
$ npm install --save-dev eslint
|
||||
```
|
||||
|
||||
Next, install `@babel/eslint-plugin-development`:
|
||||
|
||||
```
|
||||
$ npm install --save-dev @babel/eslint-plugin-development
|
||||
```
|
||||
|
||||
Then, load the plugin in your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/development"]
|
||||
}
|
||||
```
|
||||
|
||||
## Supported Rules
|
||||
|
||||
> Note: Rules marked with :wrench: are autofixable.
|
||||
|
||||
* `@babel/development/no-deprecated-clone` (:wrench:): Disallows using the deprecated
|
||||
`t.clone(node)` and `t.cloneDeep(node)` methods from `@babel/types`. Those
|
||||
calls are replaced with `t.cloneNode(node)` when using `eslint --fix`.
|
||||
* `@babel/development/no-undefined-identifier`: Disallows using
|
||||
`t.identifier("undefined")` to create a node which represents an `undefined`
|
||||
value, since it might cause problem if `undefined` is redeclared.
|
||||
* `@babel/development/plugin-name`: Requires plugins to have a `name` property, which
|
||||
can be useful for debugging purposes.
|
||||
31
eslint/babel-eslint-plugin-development/package.json
Normal file
31
eslint/babel-eslint-plugin-development/package.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@babel/eslint-plugin-development",
|
||||
"version": "1.0.1",
|
||||
"description": "A set of eslint rules to enforce best practices in the development of Babel plugins.",
|
||||
"private": true,
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"eslintplugin",
|
||||
"eslint-plugin"
|
||||
],
|
||||
"author": {
|
||||
"name": "Nicolò Ribaudo",
|
||||
"email": "nicolo.ribaudo@gmail.com",
|
||||
"url": "https://github.com/nicolo-ribaudo"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"devDependencies": {
|
||||
"eslint": "^5.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/eslint-plugin-babel-plugin.git"
|
||||
}
|
||||
}
|
||||
9
eslint/babel-eslint-plugin-development/src/index.js
Normal file
9
eslint/babel-eslint-plugin-development/src/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
"no-deprecated-clone": require("./rules/no-deprecated-clone"),
|
||||
"no-undefined-identifier": require("./rules/no-undefined-identifier"),
|
||||
"plugin-name": require("./rules/plugin-name"),
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
const getReferenceOrigin = require("../utils/get-reference-origin");
|
||||
const isFromBabelTypes = require("../utils/is-from-babel-types");
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
schema: [],
|
||||
fixable: "code",
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
CallExpression(node) {
|
||||
const { callee } = node;
|
||||
const scope = context.getScope();
|
||||
|
||||
const origin = getReferenceOrigin(callee, scope);
|
||||
if (!origin) return;
|
||||
|
||||
const { name } = origin;
|
||||
if (
|
||||
(name === "clone" || name === "cloneDeep") &&
|
||||
isFromBabelTypes(origin, scope)
|
||||
) {
|
||||
const isMemberExpression = callee.type === "MemberExpression";
|
||||
const id = isMemberExpression ? callee.property : callee;
|
||||
|
||||
context.report({
|
||||
node: id,
|
||||
message: `t.${name}() is deprecated. Use t.cloneNode() instead.`,
|
||||
fix(fixer) {
|
||||
if (isMemberExpression) {
|
||||
return fixer.replaceText(id, "cloneNode");
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
const getReferenceOrigin = require("../utils/get-reference-origin");
|
||||
const isFromBabelTypes = require("../utils/is-from-babel-types");
|
||||
|
||||
function firstArgumentIsUndefinedString(argumentsArray) {
|
||||
return (
|
||||
argumentsArray.length > 0 &&
|
||||
argumentsArray[0].type === "Literal" &&
|
||||
argumentsArray[0].value === "undefined"
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
schema: [],
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
CallExpression(node) {
|
||||
const { callee } = node;
|
||||
const scope = context.getScope();
|
||||
|
||||
const origin = getReferenceOrigin(callee, scope);
|
||||
if (!origin) return;
|
||||
|
||||
const { name } = origin;
|
||||
if (
|
||||
(name === "identifier" || name === "Identifier") &&
|
||||
firstArgumentIsUndefinedString(node.arguments) &&
|
||||
isFromBabelTypes(origin, scope)
|
||||
) {
|
||||
context.report(
|
||||
node,
|
||||
"Use path.scope.buildUndefinedNode() to create an undefined identifier directly.",
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
const isBabelPluginFactory = require("../utils/is-babel-plugin-factory");
|
||||
|
||||
function getReturnValue(node) {
|
||||
const { body } = node;
|
||||
|
||||
if (body.type === "BlockStatement") {
|
||||
const returnNode = body.body.find(n => n.type === "ReturnStatement");
|
||||
return returnNode && returnNode.argument;
|
||||
}
|
||||
|
||||
// Arrow functions with implicit return
|
||||
return body;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
schema: [],
|
||||
},
|
||||
create(context /*: Context */) {
|
||||
let pluginFound = false;
|
||||
|
||||
return {
|
||||
FunctionDeclaration: functionVisitor,
|
||||
FunctionExpression: functionVisitor,
|
||||
ArrowFunctionExpression: functionVisitor,
|
||||
|
||||
"Program:exit"(node) {
|
||||
if (!pluginFound) {
|
||||
context.report(node, "This file does not export a Babel plugin.");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function functionVisitor(node) {
|
||||
if (!isBabelPluginFactory(node, context.getScope())) return;
|
||||
|
||||
const returnValue = getReturnValue(node);
|
||||
if (!returnValue || returnValue.type !== "ObjectExpression") return;
|
||||
|
||||
pluginFound = true;
|
||||
|
||||
if (!returnValue.properties.some(p => p.key.name === "name")) {
|
||||
context.report(
|
||||
returnValue,
|
||||
"This Babel plugin doesn't have a 'name' property.",
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function getExportName(node) {
|
||||
const { parent } = node;
|
||||
|
||||
if (parent.type === "ExportDefaultDeclaration") {
|
||||
return "default";
|
||||
}
|
||||
|
||||
if (parent.type === "ExportNamedDeclaration") {
|
||||
return node.id.name;
|
||||
}
|
||||
|
||||
if (
|
||||
parent.type === "AssignmentExpression" &&
|
||||
parent.left.type === "MemberExpression" &&
|
||||
parent.left.object.type === "Identifier" &&
|
||||
parent.left.object.name === "module" &&
|
||||
parent.left.property.type === "Identifier" &&
|
||||
parent.left.property.name === "exports"
|
||||
) {
|
||||
return "module.exports";
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,142 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = getReferenceOrigin;
|
||||
|
||||
/*::
|
||||
type ReferenceOriginImport = { kind: "import", source: string, name: string };
|
||||
type ReferenceOriginParam = {
|
||||
kind: "param",
|
||||
index: number,
|
||||
functionNode: Node,
|
||||
};
|
||||
|
||||
type ReferenceOrigin =
|
||||
| ReferenceOriginImport
|
||||
| ReferenceOriginParam
|
||||
| { kind: "import *", source: string }
|
||||
| {
|
||||
kind: "property",
|
||||
base: ReferenceOriginImport | ReferenceOriginParam,
|
||||
path: string,
|
||||
name: string,
|
||||
};
|
||||
*/
|
||||
|
||||
// Given a node and a context, returns a description of where its value comes
|
||||
// from.
|
||||
// It resolves imports, parameters of exported functions and property accesses.
|
||||
// See the ReferenceOrigin type for more informations.
|
||||
function getReferenceOrigin(node, scope) /*: ?ReferenceOrigin */ {
|
||||
if (node.type === "Identifier") {
|
||||
const variable = getVariableDefinition(node.name, scope);
|
||||
if (!variable) return null;
|
||||
|
||||
const definition = variable.definition;
|
||||
const defNode = definition.node;
|
||||
|
||||
if (definition.type === "ImportBinding") {
|
||||
if (defNode.type === "ImportSpecifier") {
|
||||
return {
|
||||
kind: "import",
|
||||
source: definition.parent.source.value,
|
||||
name: defNode.imported.name,
|
||||
};
|
||||
}
|
||||
if (defNode.type === "ImportNamespaceSpecifier") {
|
||||
return {
|
||||
kind: "import *",
|
||||
source: definition.parent.source.value,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (definition.type === "Variable" && defNode.init) {
|
||||
const origin = getReferenceOrigin(defNode.init, variable.scope);
|
||||
return origin && patternToProperty(definition.name, origin);
|
||||
}
|
||||
|
||||
if (definition.type === "Parameter") {
|
||||
return patternToProperty(definition.name, {
|
||||
kind: "param",
|
||||
index: definition.index,
|
||||
functionNode: definition.node,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (node.type === "MemberExpression" && !node.computed) {
|
||||
const origin = getReferenceOrigin(node.object, scope);
|
||||
return origin && addProperty(origin, node.property.name);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getVariableDefinition(name, scope) {
|
||||
let currentScope = scope;
|
||||
do {
|
||||
const variable = currentScope.set.get(name);
|
||||
if (variable && variable.defs[0]) {
|
||||
return { scope: currentScope, definition: variable.defs[0] };
|
||||
}
|
||||
} while ((currentScope = currentScope.upper));
|
||||
}
|
||||
|
||||
function patternToProperty(id, base) {
|
||||
const path = getPatternPath(id);
|
||||
return path && path.reduce(addProperty, base);
|
||||
}
|
||||
|
||||
// Adds a property to a given origin. If it was a namespace import it becomes
|
||||
// a named import, so that `import * as x from "foo"; x.bar` and
|
||||
// `import { bar } from "foo"` have the same origin.
|
||||
function addProperty(origin, name) {
|
||||
if (origin.kind === "import *") {
|
||||
return {
|
||||
kind: "import",
|
||||
source: origin.source,
|
||||
name,
|
||||
};
|
||||
}
|
||||
if (origin.kind === "property") {
|
||||
return {
|
||||
kind: "property",
|
||||
base: origin.base,
|
||||
path: origin.path + "." + name,
|
||||
name,
|
||||
};
|
||||
}
|
||||
return {
|
||||
kind: "property",
|
||||
base: origin,
|
||||
path: name,
|
||||
name,
|
||||
};
|
||||
}
|
||||
|
||||
// if "node" is c of { a: { b: c } }, the result is ["a","b"]
|
||||
function getPatternPath(node) {
|
||||
let current = node;
|
||||
const path = [];
|
||||
|
||||
// Unshift keys to path while going up
|
||||
do {
|
||||
const property = current.parent;
|
||||
if (
|
||||
property.type === "ArrayPattern" ||
|
||||
property.type === "AssignmentPattern" ||
|
||||
property.computed
|
||||
) {
|
||||
// These nodes are not supported.
|
||||
return null;
|
||||
}
|
||||
if (property.type === "Property") {
|
||||
path.unshift(property.key.name);
|
||||
} else {
|
||||
// The destructuring pattern is finished
|
||||
break;
|
||||
}
|
||||
} while ((current = current.parent.parent));
|
||||
|
||||
return path;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
const getReferenceOrigin = require("./get-reference-origin");
|
||||
const getExportName = require("./get-export-name");
|
||||
|
||||
module.exports = function isBabelPluginFactory(node, scope) {
|
||||
const { parent } = node;
|
||||
|
||||
if (parent.type === "CallExpression") {
|
||||
const calleeOrigin = getReferenceOrigin(parent.callee, scope);
|
||||
|
||||
// Using "declare" from "@babel/helper-plugin-utils"
|
||||
return !!(
|
||||
calleeOrigin &&
|
||||
calleeOrigin.kind === "import" &&
|
||||
calleeOrigin.name === "declare" &&
|
||||
calleeOrigin.source === "@babel/helper-plugin-utils"
|
||||
);
|
||||
}
|
||||
|
||||
const exportName = getExportName(node);
|
||||
|
||||
// export default function ({ types: t }) {}
|
||||
// module.exports = function ({ types: t }) {}
|
||||
return exportName === "default" || exportName === "module.exports";
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
const isBabelPluginFactory = require("./is-babel-plugin-factory");
|
||||
|
||||
// Check if a ReferenceOrigin (returned by ./get-reference-origin.js)
|
||||
// is a reference to a @babel/types export.
|
||||
module.exports = function isFromBabelTypes(
|
||||
origin /*: ReferenceOrigin */,
|
||||
scope /*: Scope */,
|
||||
) {
|
||||
if (origin.kind === "import" && origin.source === "@babel/types") {
|
||||
// imported from @babel/types
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
origin.kind === "property" &&
|
||||
origin.base.kind === "import" &&
|
||||
origin.base.name === "types" &&
|
||||
origin.base.source === "@babel/core"
|
||||
) {
|
||||
// imported from @babel/core
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
origin.kind === "property" &&
|
||||
origin.base.kind === "param" &&
|
||||
origin.base.index === 0
|
||||
) {
|
||||
return isBabelPluginFactory(origin.base.functionNode, scope);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
@@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
|
||||
const rule = require("../../src/rules/no-deprecated-clone");
|
||||
const { RuleTester } = require("eslint");
|
||||
|
||||
const cloneError = "t.clone() is deprecated. Use t.cloneNode() instead.";
|
||||
const cloneDeepError =
|
||||
"t.cloneDeep() is deprecated. Use t.cloneNode() instead.";
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: { sourceType: "module" },
|
||||
});
|
||||
|
||||
ruleTester.run("no-deprecated-clone", rule, {
|
||||
valid: [
|
||||
`_.clone(obj)`,
|
||||
`_.cloneDeep(obj)`,
|
||||
`import * as t from "lib"; t.clone();`,
|
||||
`import * as t from "lib"; t.cloneDeep();`,
|
||||
`function f(_) { _.types.clone(); }`,
|
||||
`function f(_) { _.types.cloneDeep(); }`,
|
||||
`import * as t from "@babel/types"; t.cloneNode();`,
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
code: `import { clone } from "@babel/types"; clone();`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import { cloneDeep } from "@babel/types"; cloneDeep();`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `import { clone } from "@babel/types"; var clone2 = clone; clone2();`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import { cloneDeep } from "@babel/types"; var cloneDeep2 = cloneDeep; cloneDeep2();`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `import * as t from "@babel/types"; t.clone();`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import * as t from "@babel/types"; t.cloneDeep();`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `import * as t from "@babel/types"; var { clone } = t; clone();`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import * as t from "@babel/types"; var { cloneDeep } = t; cloneDeep();`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `import { clone as c } from "@babel/types"; c();`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import { cloneDeep as cD } from "@babel/types"; cD();`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `import * as babel from "@babel/core"; babel.types.clone();`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import * as babel from "@babel/core"; babel.types.cloneDeep();`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `import { types } from "@babel/core"; types.clone();`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import { types } from "@babel/core"; types.cloneDeep();`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `import { types as t } from "@babel/core"; t.clone();`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import { types as t } from "@babel/core"; t.cloneDeep();`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin(babel) { babel.types.clone() }`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin(babel) { babel.types.cloneDeep() }`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin({ types }) { types.clone() }`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin({ types }) { types.cloneDeep() }`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin({ types: t }) { t.clone() }`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin({ types: t }) { t.cloneDeep() }`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `export default ({ types }) => { types.clone() }`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `export default ({ types }) => { types.cloneDeep() }`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `module.exports = function plugin({ types }) { types.clone() }`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `module.exports = function plugin({ types }) { types.cloneDeep() }`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
{
|
||||
code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.clone() });`,
|
||||
errors: [cloneError],
|
||||
},
|
||||
{
|
||||
code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.cloneDeep() });`,
|
||||
errors: [cloneDeepError],
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
|
||||
const rule = require("../../src/rules/no-undefined-identifier");
|
||||
const { RuleTester } = require("eslint");
|
||||
|
||||
const error =
|
||||
"Use path.scope.buildUndefinedNode() to create an undefined identifier directly.";
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: { sourceType: "module" },
|
||||
});
|
||||
|
||||
ruleTester.run("no-undefined-identifier", rule, {
|
||||
valid: [
|
||||
`_.identifier("undefined")`,
|
||||
`_.Identifier("undefined")`,
|
||||
`import * as t from "lib"; t.identifier("undefined");`,
|
||||
`function f(_) { _.types.identifier("undefined"); }`,
|
||||
`import * as t from "@babel/types"; t.identifier("not_undefined");`,
|
||||
`path.scope.buildUndefinedNode();`,
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
code: `import { identifier } from "@babel/types"; identifier("undefined");`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `import { Identifier } from "@babel/types"; Identifier("undefined");`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `import * as t from "@babel/types"; t.identifier("undefined");`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `import * as t from "@babel/types"; var { identifier } = t; identifier("undefined");`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `import { identifier as id } from "@babel/types"; id("undefined");`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `import * as babel from "@babel/core"; babel.types.identifier("undefined");`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `import { types } from "@babel/core"; types.identifier("undefined");`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `import { types as t } from "@babel/core"; t.identifier("undefined");`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin(babel) { babel.types.identifier("undefined") }`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin({ types }) { types.identifier("undefined") }`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `export default function plugin({ types: t }) { t.identifier("undefined") }`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `export default ({ types }) => { types.identifier("undefined") }`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `module.exports = function plugin({ types }) { types.identifier("undefined") }`,
|
||||
errors: [error],
|
||||
},
|
||||
{
|
||||
code: `import { declare } from "@babel/helper-plugin-utils"; declare(({ types }) => { types.identifier("undefined") });`,
|
||||
errors: [error],
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
const rule = require("../../src/rules/plugin-name");
|
||||
const { RuleTester } = require("eslint");
|
||||
|
||||
const missingPluginError = "This file does not export a Babel plugin.";
|
||||
const missingNameError = "This Babel plugin doesn't have a 'name' property.";
|
||||
|
||||
const ruleTester = new RuleTester({
|
||||
parserOptions: { sourceType: "module" },
|
||||
});
|
||||
|
||||
ruleTester.run("plugin-name", rule, {
|
||||
valid: [
|
||||
`export default function () { return { name: "test-plugin" } }`,
|
||||
`import { declare } from "@babel/helper-plugin-utils"; declare(() => { return { name: "test-plugin" } })`,
|
||||
`import { declare } from "@babel/helper-plugin-utils"; declare(() => ({ name: "test-plugin" }))`,
|
||||
`module.exports = function () { return { name: "foo" }; }`,
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
code: `function fn() { return { name: "foo" } }`,
|
||||
errors: [missingPluginError],
|
||||
},
|
||||
{
|
||||
code: `export function fn() { return { name: "foo" } }`,
|
||||
errors: [missingPluginError],
|
||||
},
|
||||
{
|
||||
code: `(function fn() { return { name: "foo" } })`,
|
||||
errors: [missingPluginError],
|
||||
},
|
||||
{
|
||||
code: `() => { return { name: "foo" } }`,
|
||||
errors: [missingPluginError],
|
||||
},
|
||||
{
|
||||
code: `export default function fn() {}`,
|
||||
errors: [missingPluginError],
|
||||
},
|
||||
{
|
||||
code: `export default function fn() { return {} }`,
|
||||
errors: [missingNameError],
|
||||
},
|
||||
{
|
||||
code: `import { declare } from "@babel/helper-plugin-utils"; declare(() => ({}))`,
|
||||
errors: [missingNameError],
|
||||
},
|
||||
{
|
||||
code: `module.exports = function () { return {} }`,
|
||||
errors: [missingNameError],
|
||||
},
|
||||
],
|
||||
});
|
||||
4
eslint/babel-eslint-plugin/.npmignore
Normal file
4
eslint/babel-eslint-plugin/.npmignore
Normal file
@@ -0,0 +1,4 @@
|
||||
src
|
||||
test
|
||||
.*
|
||||
*.log
|
||||
23
eslint/babel-eslint-plugin/LICENSE
Normal file
23
eslint/babel-eslint-plugin/LICENSE
Normal file
@@ -0,0 +1,23 @@
|
||||
Copyright (c) 2014-2015 Jason Quense <jason@quense.me>
|
||||
Original work by respective rule authors; copywrites noted in files.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
67
eslint/babel-eslint-plugin/README.md
Normal file
67
eslint/babel-eslint-plugin/README.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# eslint-plugin-babel
|
||||
|
||||
An `eslint` plugin companion to `babel-eslint`. `babel-eslint` does a great job at adapting `eslint`
|
||||
for use with Babel, but it can't change the built in rules to support experimental features.
|
||||
`eslint-plugin-babel` re-implements problematic rules so they do not give false positives or negatives.
|
||||
|
||||
> Requires Node 4 or greater
|
||||
|
||||
### Install
|
||||
|
||||
```sh
|
||||
npm install eslint-plugin-babel --save-dev
|
||||
```
|
||||
|
||||
Load the plugin in your `.eslintrc` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": [
|
||||
"babel"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Finally enable all the rules you would like to use (remember to disable the
|
||||
original ones as well!).
|
||||
|
||||
```json
|
||||
{
|
||||
"rules": {
|
||||
"babel/new-cap": 1,
|
||||
"babel/camelcase": 1,
|
||||
"babel/no-invalid-this": 1,
|
||||
"babel/object-curly-spacing": 1,
|
||||
"babel/quotes": 1,
|
||||
"babel/semi": 1,
|
||||
"babel/no-unused-expressions": 1,
|
||||
"babel/valid-typeof": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
### Rules
|
||||
|
||||
Each rule corresponds to a core `eslint` rule, and has the same options.
|
||||
|
||||
🛠: means it's autofixable with `--fix`.
|
||||
|
||||
- `babel/new-cap`: Ignores capitalized decorators (`@Decorator`)
|
||||
- `babel/camelcase: doesn't complain about optional chaining (`var foo = bar?.a_b;`)
|
||||
- `babel/no-invalid-this`: doesn't fail when inside class properties (`class A { a = this.b; }`)
|
||||
- `babel/object-curly-spacing`: doesn't complain about `export x from "mod";` or `export * as x from "mod";` (🛠)
|
||||
- `babel/quotes`: doesn't complain about JSX fragment shorthand syntax (`<>foo</>;`)
|
||||
- `babel/semi`: doesn't fail when using `for await (let something of {})`. Includes class properties (🛠)
|
||||
- `babel/no-unused-expressions`: doesn't fail when using `do` expressions or [optional chaining](https://github.com/tc39/proposal-optional-chaining) (`a?.b()`).
|
||||
- `babel/valid-typeof`: doesn't complain when used with [BigInt](https://github.com/tc39/proposal-bigint) (`typeof BigInt(9007199254740991) === 'bigint'`).
|
||||
|
||||
#### Deprecated
|
||||
|
||||
| Rule | Notes |
|
||||
|:---------------------------------|:-----------------------------------|
|
||||
| `babel/generator-star-spacing` | Use [`generator-star-spacing`](http://eslint.org/docs/rules/generator-star-spacing) since eslint@3.6.0 |
|
||||
| `babel/object-shorthand` | Use [`object-shorthand`](http://eslint.org/docs/rules/object-shorthand) since eslint@0.20.0 |
|
||||
| `babel/arrow-parens` | Use [`arrow-parens`](http://eslint.org/docs/rules/arrow-parens) since eslint@3.10.0 |
|
||||
| `babel/func-params-comma-dangle` | Use [`comma-dangle`](http://eslint.org/docs/rules/comma-dangle) since eslint@3.8.0 |
|
||||
| `babel/array-bracket-spacing` | Use [`array-bracket-spacing`](http://eslint.org/docs/rules/array-bracket-spacing) since eslint@3.9.0 |
|
||||
| `babel/flow-object-type` | Use [`flowtype/object-type-delimiter`](https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter) since eslint-plugin-flowtype@2.23.0 |
|
||||
| `babel/no-await-in-loop` | Use [`no-await-in-loop`](http://eslint.org/docs/rules/no-await-in-loop) since eslint@3.12.0 |
|
||||
38
eslint/babel-eslint-plugin/package.json
Normal file
38
eslint/babel-eslint-plugin/package.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "eslint-plugin-babel",
|
||||
"version": "5.3.0",
|
||||
"description": "an eslint rule plugin companion to babel-eslint",
|
||||
"main": "lib/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/eslint-plugin-babel.git"
|
||||
},
|
||||
"keywords": [
|
||||
"babel",
|
||||
"eslint",
|
||||
"eslintplugin",
|
||||
"eslint-plugin",
|
||||
"babel-eslint"
|
||||
],
|
||||
"author": "Jason Quense @monasticpanic",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/eslint-plugin-babel/issues"
|
||||
},
|
||||
"homepage": "https://github.com/babel/eslint-plugin-babel#readme",
|
||||
"peerDependencies": {
|
||||
"eslint": ">=4.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"eslint-rule-composer": "^0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-eslint": "^8.2.2",
|
||||
"eslint": "^4.19.1",
|
||||
"lodash.clonedeep": "^4.5.0"
|
||||
}
|
||||
}
|
||||
38
eslint/babel-eslint-plugin/src/index.js
Normal file
38
eslint/babel-eslint-plugin/src/index.js
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
rules: {
|
||||
"array-bracket-spacing": require("./rules/array-bracket-spacing"),
|
||||
"arrow-parens": require("./rules/arrow-parens"),
|
||||
"flow-object-type": require("./rules/flow-object-type"),
|
||||
"func-params-comma-dangle": require("./rules/func-params-comma-dangle"),
|
||||
"generator-star-spacing": require("./rules/generator-star-spacing"),
|
||||
"new-cap": require("./rules/new-cap"),
|
||||
camelcase: require("./rules/camelcase"),
|
||||
"no-await-in-loop": require("./rules/no-await-in-loop"),
|
||||
"no-invalid-this": require("./rules/no-invalid-this"),
|
||||
"no-unused-expressions": require("./rules/no-unused-expressions"),
|
||||
"object-curly-spacing": require("./rules/object-curly-spacing"),
|
||||
"object-shorthand": require("./rules/object-shorthand"),
|
||||
quotes: require("./rules/quotes"),
|
||||
semi: require("./rules/semi"),
|
||||
"valid-typeof": require("./rules/valid-typeof"),
|
||||
},
|
||||
rulesConfig: {
|
||||
"array-bracket-spacing": 0,
|
||||
"arrow-parens": 0,
|
||||
camelcase: 0,
|
||||
"flow-object-type": 0,
|
||||
"func-params-comma-dangle": 0,
|
||||
"generator-star-spacing": 0,
|
||||
"new-cap": 0,
|
||||
"no-await-in-loop": 0,
|
||||
"no-invalid-this": 0,
|
||||
"no-unused-expressions": 0,
|
||||
"object-curly-spacing": 0,
|
||||
"object-shorthand": 0,
|
||||
quotes: 0,
|
||||
semi: 0,
|
||||
"valid-typeof": 0,
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
let isWarnedForDeprecation = false;
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: true,
|
||||
schema: [
|
||||
{
|
||||
enum: ["always", "never"],
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
singleValue: {
|
||||
type: "boolean",
|
||||
},
|
||||
objectsInArrays: {
|
||||
type: "boolean",
|
||||
},
|
||||
arraysInArrays: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
create: function() {
|
||||
return {
|
||||
Program: function() {
|
||||
if (
|
||||
isWarnedForDeprecation ||
|
||||
/=-(f|-format)=/.test(process.argv.join("="))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
"The babel/array-bracket-spacing rule is deprecated. Please " +
|
||||
"use the built in array-bracket-spacing rule instead.",
|
||||
);
|
||||
isWarnedForDeprecation = true;
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
31
eslint/babel-eslint-plugin/src/rules/arrow-parens.js
Normal file
31
eslint/babel-eslint-plugin/src/rules/arrow-parens.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
let isWarnedForDeprecation = false;
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: true,
|
||||
schema: [
|
||||
{
|
||||
enum: ["always", "as-needed"],
|
||||
},
|
||||
],
|
||||
},
|
||||
create: function() {
|
||||
return {
|
||||
Program: function() {
|
||||
if (
|
||||
isWarnedForDeprecation ||
|
||||
/=-(f|-format)=/.test(process.argv.join("="))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
"The babel/arrow-parens rule is deprecated. Please " +
|
||||
"use the built in arrow-parens rule instead.",
|
||||
);
|
||||
isWarnedForDeprecation = true;
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
231
eslint/babel-eslint-plugin/src/rules/camelcase.js
Normal file
231
eslint/babel-eslint-plugin/src/rules/camelcase.js
Normal file
@@ -0,0 +1,231 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag non-camelcased identifiers
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
docs: {
|
||||
description: "enforce camelcase naming convention",
|
||||
category: "Stylistic Issues",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/camelcase",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
ignoreDestructuring: {
|
||||
type: "boolean",
|
||||
},
|
||||
properties: {
|
||||
enum: ["always", "never"],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
notCamelCase: "Identifier '{{name}}' is not in camel case.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
//--------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
// contains reported nodes to avoid reporting twice on destructuring with shorthand notation
|
||||
const reported = [];
|
||||
const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]);
|
||||
const MEMBER_EXPRESSIONS = ["MemberExpression", "OptionalMemberExpression"];
|
||||
|
||||
/**
|
||||
* Checks if expression is supported member expression.
|
||||
*
|
||||
* @param {string} expression - An expression to check.
|
||||
* @returns {boolean} `true` if the expression type is supported
|
||||
*/
|
||||
function isMemberExpression(expression) {
|
||||
return MEMBER_EXPRESSIONS.indexOf(expression) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a string contains an underscore and isn't all upper-case
|
||||
* @param {string} name The string to check.
|
||||
* @returns {boolean} if the string is underscored
|
||||
* @private
|
||||
*/
|
||||
function isUnderscored(name) {
|
||||
// if there's an underscore, it might be A_CONSTANT, which is okay
|
||||
return name.indexOf("_") > -1 && name !== name.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a parent of a node is an ObjectPattern.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {boolean} if the node is inside an ObjectPattern
|
||||
* @private
|
||||
*/
|
||||
function isInsideObjectPattern(node) {
|
||||
let { parent } = node;
|
||||
|
||||
while (parent) {
|
||||
if (parent.type === "ObjectPattern") {
|
||||
return true;
|
||||
}
|
||||
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an AST node as a rule violation.
|
||||
* @param {ASTNode} node The node to report.
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function report(node) {
|
||||
if (reported.indexOf(node.parent) < 0) {
|
||||
reported.push(node.parent);
|
||||
context.report({
|
||||
node,
|
||||
messageId: "notCamelCase",
|
||||
data: { name: node.name },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const options = context.options[0] || {};
|
||||
let properties = options.properties || "";
|
||||
const ignoreDestructuring = options.ignoreDestructuring || false;
|
||||
|
||||
if (properties !== "always" && properties !== "never") {
|
||||
properties = "always";
|
||||
}
|
||||
|
||||
return {
|
||||
Identifier(node) {
|
||||
/*
|
||||
* Leading and trailing underscores are commonly used to flag
|
||||
* private/protected identifiers, strip them
|
||||
*/
|
||||
const name = node.name.replace(/^_+|_+$/g, ""),
|
||||
effectiveParent = isMemberExpression(node.parent.type)
|
||||
? node.parent.parent
|
||||
: node.parent;
|
||||
|
||||
// MemberExpressions get special rules
|
||||
if (isMemberExpression(node.parent.type)) {
|
||||
// "never" check properties
|
||||
if (properties === "never") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Always report underscored object names
|
||||
if (
|
||||
node.parent.object.type === "Identifier" &&
|
||||
node.parent.object.name === node.name &&
|
||||
isUnderscored(name)
|
||||
) {
|
||||
report(node);
|
||||
|
||||
// Report AssignmentExpressions only if they are the left side of the assignment
|
||||
} else if (
|
||||
effectiveParent.type === "AssignmentExpression" &&
|
||||
isUnderscored(name) &&
|
||||
(!isMemberExpression(effectiveParent.right.type) ||
|
||||
(isMemberExpression(effectiveParent.left.type) &&
|
||||
effectiveParent.left.property.name === node.name))
|
||||
) {
|
||||
report(node);
|
||||
}
|
||||
|
||||
/*
|
||||
* Properties have their own rules, and
|
||||
* AssignmentPattern nodes can be treated like Properties:
|
||||
* e.g.: const { no_camelcased = false } = bar;
|
||||
*/
|
||||
} else if (
|
||||
node.parent.type === "Property" ||
|
||||
node.parent.type === "AssignmentPattern"
|
||||
) {
|
||||
if (
|
||||
node.parent.parent &&
|
||||
node.parent.parent.type === "ObjectPattern"
|
||||
) {
|
||||
const assignmentKeyEqualsValue =
|
||||
node.parent.key.name === node.parent.value.name;
|
||||
|
||||
// prevent checking righthand side of destructured object
|
||||
if (node.parent.key === node && node.parent.value !== node) {
|
||||
return;
|
||||
}
|
||||
|
||||
const valueIsUnderscored =
|
||||
node.parent.value.name && isUnderscored(name);
|
||||
|
||||
// ignore destructuring if the option is set, unless a new identifier is created
|
||||
if (
|
||||
valueIsUnderscored &&
|
||||
!(assignmentKeyEqualsValue && ignoreDestructuring)
|
||||
) {
|
||||
report(node);
|
||||
}
|
||||
}
|
||||
|
||||
// "never" check properties or always ignore destructuring
|
||||
if (
|
||||
properties === "never" ||
|
||||
(ignoreDestructuring && isInsideObjectPattern(node))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't check right hand side of AssignmentExpression to prevent duplicate warnings
|
||||
if (
|
||||
isUnderscored(name) &&
|
||||
!ALLOWED_PARENT_TYPES.has(effectiveParent.type) &&
|
||||
!(node.parent.right === node)
|
||||
) {
|
||||
report(node);
|
||||
}
|
||||
|
||||
// Check if it's an import specifier
|
||||
} else if (
|
||||
[
|
||||
"ImportSpecifier",
|
||||
"ImportNamespaceSpecifier",
|
||||
"ImportDefaultSpecifier",
|
||||
].indexOf(node.parent.type) >= 0
|
||||
) {
|
||||
// Report only if the local imported identifier is underscored
|
||||
if (
|
||||
node.parent.local &&
|
||||
node.parent.local.name === node.name &&
|
||||
isUnderscored(name)
|
||||
) {
|
||||
report(node);
|
||||
}
|
||||
|
||||
// Report anything that is underscored that isn't a CallExpression
|
||||
} else if (
|
||||
isUnderscored(name) &&
|
||||
!ALLOWED_PARENT_TYPES.has(effectiveParent.type)
|
||||
) {
|
||||
report(node);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
34
eslint/babel-eslint-plugin/src/rules/flow-object-type.js
Normal file
34
eslint/babel-eslint-plugin/src/rules/flow-object-type.js
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
let isWarnedForDeprecation = false;
|
||||
module.exports = {
|
||||
meta: {
|
||||
deprecated: true,
|
||||
schema: [
|
||||
{
|
||||
enum: ["semicolon", "comma"],
|
||||
},
|
||||
],
|
||||
},
|
||||
create: function() {
|
||||
return {
|
||||
Program: function() {
|
||||
if (
|
||||
isWarnedForDeprecation ||
|
||||
/=-(f|-format)=/.test(process.argv.join("="))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
"The babel/flow-object-type rule is deprecated. Please " +
|
||||
"use the flowtype/object-type-delimiter rule instead.\n" +
|
||||
// eslint-disable-next-line
|
||||
"Check out https://github.com/gajus/eslint-plugin-flowtype#eslint-plugin-flowtype-rules-object-type-delimiter"
|
||||
);
|
||||
|
||||
isWarnedForDeprecation = true;
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user