Sosuke Suzuki
b62fc3d44f
babel-parser(flow): Set this property to null for FunctionTypeAnnotation without parens ( #12930 )
...
* Add null property to FunctionTypeAnnotation without parens
* Update tests
* Update tests
2021-03-01 09:15:43 -05:00
Nicolò Ribaudo
c30039029a
Don't enable class features by default in estree ( #12867 )
...
* Don't enable class features by default in `estree`
* Flow
* Reduce breakage
2021-02-23 11:30:01 +01:00
Huáng Jùnliàng
03d7911be6
Implement class features in estree ( #12370 )
...
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
2021-02-21 20:12:12 +01:00
Sosuke Suzuki
e4588bed22
Support TypeScript 4.2 abstract constructor signatures ( #12628 )
...
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 20:07:55 +01:00
George Zahariev
5b99b8f221
Flow Enums with unknown members support ( #12193 )
...
* Flow Enums with unknown members parsing
* Updates after rebase
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2021-02-21 18:42:23 +01:00
Daniel Sainati
16e9f1c8e5
Support Flow this parameter annotations ( #12234 )
2021-02-21 17:44:27 +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
Sosuke Suzuki
c22e72eb24
Raise recoverable error for type members with invalid modifiers ( #12785 )
2021-02-12 17:20:06 +01: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
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
Federico Ciardi
d1cf66e8c1
fix(ts): include leading operator in TSUnionType and TSIntersectionType locations ( #12757 )
2021-02-04 19:24:35 +01:00
Federico Ciardi
94ba66c89b
fix(ts): allow abstract methods with export default abstract class ( #12748 )
2021-02-03 09:48:41 -05: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
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
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
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
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
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
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
Sosuke Suzuki
ad8a4d62fd
Fix syntax error for getter and setter with ts and estree plugin ( #12333 )
2020-11-09 08:36:39 +01:00
Sosuke Suzuki
963537d5f5
[ts] Make ImportDeclaration always have importKind ( #12170 )
2020-10-29 20:07:10 +01:00
Huáng Jùnliàng
2782a549e9
Refactor yield await classification ( #12230 )
...
* fix: incomplete ParamKind declaration
* refactor: add expression scope handler
* test: update test262 allowlist
* chore: cleanup
* fix: push expression scope for function body
* fix: push new expression scope for initializer and static block
* test: add more test cases
* fix flow error
* refactor: remove unecessary expression scope
* fix: parameter initializer error should not cross expression scope boundary
* chore: cleanup outdated comments
* fix: do not record async arrow error on ParameterDeclaration
* Update packages/babel-parser/src/util/expression-scope.js
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* polish: clear ancestry declaration error on validate
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-10-26 11:42:02 -04:00
Sosuke Suzuki
f5bd9f2013
Allows the interface to be used as an Identifier for flow plugin ( #12254 )
2020-10-26 08:50:57 -05:00
Brian Ng
c00bb14f79
[ts] Error on invalid type casts in JSX ( #12221 )
2020-10-23 08:09:35 -05:00
Brian Ng
d51aa6d761
[ts] Allow optional binding pattern parameters within types/interfaces ( #12227 )
2020-10-21 08:16:43 -05:00
Sosuke Suzuki
f1bc314c79
Fix parsing of imports with module string name in flow plugin ( #12224 )
2020-10-20 23:46:12 +02:00
Brian Ng
47250ffa65
[ts] Disallow invalid type annotations in ExpressionStatements ( #12185 )
...
* Fix regression with invalid type annotations in ExpressionStatements
2020-10-16 10:20:53 +02:00
Nicolò Ribaudo
4fe8c3acc5
Revert "Fix: check if param is assignable when parsing arrow return type annotation" ( #12198 )
...
This reverts commit 84987a00e632e65bdafdf7f70df46ded7fb083c8.
2020-10-16 08:16:37 +02:00
Nicolò Ribaudo
84987a00e6
Reland "Fix: check if param is assignable when parsing arrow return type annotation" ( #12183 )
...
* Reland "Fix: check if param is assignable when parsing arrow return type annotation"
This reverts commit 91a7a64b4b0c30ab1fdfbb12f77522afa2285ec4.
* Mark `RestElement` as assignable
2020-10-15 11:32:37 -04:00
Nicolò Ribaudo
91a7a64b4b
Revert "Fix: check if param is assignable when parsing arrow return type annotation" ( #12173 )
...
This reverts commit 136e6301cbfa9448cfb20396f82f93f0d3e10c12.
2020-10-14 21:42:05 +02:00
Huáng Jùnliàng
3ccca88178
Parse class static block ( #12079 )
...
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 21:16:24 +02:00
Brian Ng
6830c90ac9
Support TypeScript mapped type 'as' clauses ( #12129 )
2020-10-14 20:16:22 +02:00
Nicolò Ribaudo
3fd963fdc8
[ts] Add support for template interpolations in types ( #12131 )
...
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 20:15:42 +02:00
Nicolò Ribaudo
9f40d6fcd0
[ts] Add support for the "intrinsic" keyword ( #12147 )
2020-10-14 20:15:17 +02:00
Huáng Jùnliàng
136e6301cb
Check if param is assignable when parsing arrow return type ( #11992 )
2020-10-14 20:09:48 +02:00
Sosuke Suzuki
a5bed04f55
Make asserts property boolean, not undefined ( #12167 )
2020-10-13 23:56:08 +02:00
Brian Ng
13a1cfd396
Move check for TSTypeCastExpression to catch another case ( #12161 )
2020-10-11 13:03:57 +02:00
Sosuke Suzuki
39a12674b4
Improve syntax error for class fields in ambient context ( #12108 )
...
* Improve error messages for ambient context class fields
* Modify switching state.isDeclareContext for class fields with declare
2020-09-26 15:52:12 -04:00
Sosuke Suzuki
434b65bc2a
[ts] Throw a syntax error for index signature with declare ( #12111 )
2020-09-26 18:06:13 +02:00