592 Commits

Author SHA1 Message Date
Nicolò Ribaudo
2f755ef052 v7.12.17 2021-02-18 15:58:43 +01:00
Federico Ciardi
8e9143f06f
fix(ts): parse multiline declarations correctly (#12776)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-16 23:51:24 +01:00
Ikko Ashimine
4819ce70e4
refactor: fix typo in error.js (#12808)
postion -> position
2021-02-16 12:35:58 -05:00
Sosuke Suzuki
c22e72eb24
Raise recoverable error for type members with invalid modifiers (#12785) 2021-02-12 17:20:06 +01:00
Babel Bot
dd5c9f958c v7.12.16 2021-02-11 22:36:24 +00:00
Nicolò Ribaudo
c07185207c
[parser] Fix scope handling of Flow declared functions (#12735) 2021-02-10 21:07:14 +01:00
Sosuke Suzuki
f1a327506e
ts: Throw recoverable for duplicates access modifier (#12775)
* Support parsing for duplicates access modifiers

Support parsing for duplicates access modifiers

* Fix lint problems

* Address reviews
2021-02-09 09:59:06 +01:00
Sosuke Suzuki
d242ea04c8
babel-parser(ts): Raise recoverable error for abstract interface (#12771)
* Support parsing abstract interface

* Address review

Address reviews

Address reviews

* Fix types

* Add hasFollowingLineBreak
2021-02-09 09:56:18 +01:00
Nicolò Ribaudo
e735266dee
Avoid importing .json files (#12759)
* Avoid importing `.json` files

* Use ESold in babel.config.json

* Use `import/extensions` eslint plugin
2021-02-05 23:34:36 +01:00
Federico Ciardi
bf523da0b0
fix(ts): include asserts in TSTypePredicate location (#12763) 2021-02-05 20:02:41 +01:00
Federico Ciardi
eccbcca948
[TS] Create TSUnionType or TSIntersectionType when typealias has a leading operator (#12758)
* Create `TSUnionType` or `TSIntersectionType` when typealias has a leading operator

* Apply code review suggestions

* Test `TSIntersectionType`
2021-02-05 20:00:27 +01:00
Babel Bot
b1921d2d9b v7.12.15 2021-02-04 21:27:03 +00:00
Federico Ciardi
d1cf66e8c1
fix(ts): include leading operator in TSUnionType and TSIntersectionType locations (#12757) 2021-02-04 19:24:35 +01:00
Nicolò Ribaudo
dd18d87152 v7.12.14 2021-02-03 15:58:57 +01:00
Federico Ciardi
94ba66c89b
fix(ts): allow abstract methods with export default abstract class (#12748) 2021-02-03 09:48:41 -05:00
Nicolò Ribaudo
d291edbdf1 v7.12.13 2021-02-03 01:59:31 +01:00
Stuart Cook
20664a430e
Permit %%placeholder%% in left-hand-side of a let declaration (#12725)
* Permit %%placeholder%% in left-hand-side of a let declaration

* Test that "let" followed by modulo is still treated as an identifier

* More tests for edge-case handling of "let" with placeholders enabled
2021-02-01 20:00:21 -05:00
Huáng Jùnliàng
ecfe20395b
spec: disable await binding identifier within static block (#12661) 2021-02-01 21:55:43 +01:00
Huáng Jùnliàng
108564fdad
refactor: raise AwaitNotInAsyncContext when an AwaitExpression will be parsed (#12716)
* refactor: raise AwaitNotInAsyncContext when an AwaitExpression will be parsed

* tweak logic

* early exit when errors are before thrown error position

* fix: always return true in assert.throws callback

See https://nodejs.org/api/assert.html#assert_assert_throws_fn_error_message

* update test fixtures

* fix flow error
2021-02-01 10:46:43 -05:00
Nicolò Ribaudo
8cf0a757d5
Recover from "missing semicolon" errors (#12437)
* Recover from "missing semicolon" errors

* Update other tests

* Fix flow

* Fix windows test

* Add back deleted test
2021-02-01 10:08:43 +01:00
Sosuke Suzuki
45fdde0ce2
(ts) Throw for abstract methods in a non-abstract class (#12686) 2021-01-27 18:56:55 +01:00
Federico Ciardi
fbfd1b2aa6
fix(parser): throw error with wrong typescript 'export declare' (#12684) 2021-01-26 22:51:12 -06:00
Sosuke Suzuki
8fcba6eb55
Raise recoverable error for await expressions in sync functions (#12520) 2021-01-24 01:45:27 +01:00
Huáng Jùnliàng
568679e301
fix: start TypePredicate node after returnToken (#12678) 2021-01-23 11:06:54 -06:00
Huáng Jùnliàng
62290aa1ba
[babel 8] Don't create TSParenthesizedType nodes by default (#12608)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Sergey Melyukov <s.melukov@gmail.com>
2021-01-13 01:13:09 +01:00
Zen
6c9a481e83
@babel/preset-typescript: fix tsx assigment issue (#12599) 2021-01-10 09:21:39 -06:00
Sosuke Suzuki
c1473e30b2
[ts]Add optional property to OptionalCallExpression node that has type arguments (#12562) 2021-01-06 08:41:45 -06:00
Daniel Arthur Gallagher
e8b08523f4
docs: add package-specific documentation links (#12531)
[skip ci]
2021-01-06 14:11:53 +01:00
Nicolò Ribaudo
fbef603c43
Report a SyntaxError for } and > in JSX text (#12451)
cherry-pick  #11046

Co-Authored-By: Kai Cataldo <kai@kaicataldo.com>
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

Co-authored-by: Brad Zacher <brad.zacher@gmail.com>
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
2020-12-28 19:04:54 +01:00
Zach Panzarino
0dbc3dd4a0
Add errorRecovery option to type definitions in babel-parser (#12564)
* Fix options types for babel-parser

* I love editing files on gh.com
2020-12-27 13:25:48 +01:00
Nicolò Ribaudo
a1acfba387 v7.12.11 2020-12-16 00:55:11 +01:00
Huáng Jùnliàng
a0c1a9a9e4
Disallow non octal decimal escape before use strict (#12366) 2020-12-15 12:24:32 +01:00
Nicolò Ribaudo
e901454096 v7.12.10 2020-12-09 23:44:59 +01:00
Nicolò Ribaudo
b422c7f0ef
[babel 8] Disallow sequence expressions in JSX expression containers (#12447)
* jsx: fix sequence expression at JSXAttributeValue (#8787)

* jsx: fix sequence expression at JSXAttributeValue

* Change logic for detecting unparenthesized expressions

* use parseMaybeAssign instead of custom error handling

Co-authored-by: Daniel Tschinder <daniel@tschinder.de>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* I'm not good at booleans

* Format

* Throw a recoverable error

Co-authored-by: Bruno Macabeus <macabeus@users.noreply.github.com>
Co-authored-by: Daniel Tschinder <daniel@tschinder.de>
2020-12-08 10:15:03 +01:00
Sosuke Suzuki
2ba9265198
Add missing semicolon in AST spec (#12454)
[skip ci]
2020-12-07 19:32:35 +01:00
Sosuke Suzuki
285402d82f
Add StaticBlock to Table of Contents in AST spec (#12449) 2020-12-05 14:12:42 +01:00
Huáng Jùnliàng
3bd6a3d781
Make sure estree test should not throw if babel parser does not throw (#12443)
* test: run estree on tests that does not expect an errors

* fix: record the directive expression value to extra AST properties
2020-12-04 13:58:01 -05:00
Huáng Jùnliàng
8478027d1a
Make sure babel parser throws exactly same recoverable errors when estree plugin is enabled (#12375)
* refactor: introduce isPrivateName and getPrivateNameSV

* feat: check recoverable errors on estree-throw

* fix: pass through all params of parseBlockBody

* fix: set bigInt to null when invalid bigInt value is parsed

e.g. 0.1n

* fix: use string literal value in error message

When estree plugin is enabled, stringLiteral#extra.raw is not accessible. Use StringLiteral#value instead.

* refactor: introduce hasPropertyAsPrivateName

* fix: adapt to ChainExpression

* fix: port checkLVal early return for method in object pattern

* fix: throw new a?.() on estree

* fix: early return for __proto__ in accessors

* fix: test record element via isObjectProperty

* fix: pass through isLHS in toAssignable

* refactor: introduce isObjectMethod methods
2020-12-03 08:36:54 +00:00
Huáng Jùnliàng
89f3247e32
refactor: simplify isAwaitAllowed (#12398) 2020-11-25 13:49:35 -05:00
Nicolò Ribaudo
23226d93d4 v7.12.7 2020-11-20 22:02:43 +01:00
Sosuke Suzuki
94d116052f
[ts] Allow modifiers as names of methods with type parameters (#12356) 2020-11-18 15:29:02 +01:00
Huáng Jùnliàng
b564368d6e
refactor: reorder checkLVal parameters (#12346)
* refactor: reorder checkLVal parameters

* update allow list

* Apply suggestions from code review
2020-11-17 09:07:32 -05:00
Sosuke Suzuki
a4e4aede14
[ts]Set false to default value of TsTypePredicate.asserts (#12352) 2020-11-16 09:51:27 -06:00
Huáng Jùnliàng
5bbad8936b
fix: disallow all parenthesized pattern except parsing LHS (#12327)
* fix: disallow all parenthesized pattern except parsing LHS

* fix: forStatement requires LHS

* simplify toAssignable

* add more test cases

* fix: pass through isLHS on object property and assignment expression

* fix: record parenthesized identifier error for LHS

* remove duplicated skipped tests

* fix: do not record errors on ancestry arrow head

* Update packages/babel-parser/src/util/expression-scope.js

Co-authored-by: Brian Ng <bng412@gmail.com>

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-11-10 14:42:37 -05:00
Huáng Jùnliàng
d7e32d8c3d
Add typings for recordAndTuple parser plugin (#12326) 2020-11-09 23:57:41 +01:00
Nicolò Ribaudo
f80478c06d Prepare repository for gradual flow->ts migration (#12317)
Co-authored-by: Bogdan Savluk <savluk.bogdan@gmail.com>
2020-11-09 23:17:24 +01:00
Sosuke Suzuki
ad8a4d62fd
Fix syntax error for getter and setter with ts and estree plugin (#12333) 2020-11-09 08:36:39 +01:00
Nicolò Ribaudo
a41da05ce9 v7.12.5 2020-11-03 23:30:17 +01:00
Álvaro Mondéjar
b649f8d192
Fix packages documentation README links. (#12289) 2020-10-30 21:19:21 +01:00
Huáng Jùnliàng
766df9c369
fix: support string assertion key in assert entries (#12281)
* fix: support string assertion key in assert entries

* Update packages/babel-parser/src/parser/statement.js

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
2020-10-29 15:10:20 -04:00