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
Sosuke Suzuki
a4a14caee7
Throw a syntax error for empty type parameter/argument ( #12088 )
2020-09-22 08:26:30 -05:00
Sosuke Suzuki
cb4e436018
Throw an error for a declare class field that have an initializer ( #12093 )
2020-09-22 08:23:58 -05:00
Sosuke Suzuki
3628c52867
Do not throw an error for optional binding pattern params in function declaration ( #12085 )
2020-09-21 09:14:13 -05:00
fisker Cheung
18d13d0032
Fix invalid setter parse ( #12076 )
...
* Fix invalid `setter` parse
* estree
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-09-19 10:03:35 +02:00
Sosuke Suzuki
ae18f9c0d9
Throw a syntax error for a declare function with a body ( #12054 )
2020-09-19 00:35:37 +02:00
Sosuke Suzuki
7028a14c7f
fix: throw for constructors with type parameters ( #12065 )
...
* Throw a syntax error for a constructor with type parameters
* Modify to match error location with TypeScript
* Update typescript parser tests
Update allowlist.txt
2020-09-17 13:03:33 -04:00
Sosuke Suzuki
bbe0cf09fc
Throw a syntax error for a parameter properties in not constructor ( #12061 )
2020-09-14 16:28:06 -05:00
Brian Ng
84ea6e4501
Throw error on invalid flow async generic arrow syntax ( #11979 )
2020-08-19 16:11:17 -05:00
Brian Ng
96cc8292b7
Fix parsing type casted generic flow arrow exprs ( #11955 )
2020-08-19 14:15:01 -05:00
Huáng Jùnliàng
008fe25ae2
fix: reset EndLocation for catch param ( #11943 )
2020-08-10 17:06:34 -04:00
Huáng Jùnliàng
a3893129ec
chore: enable flowcheck on CI ( #11945 )
...
* chore: enable flowcheck on CI
* fix: flow errors
2020-08-10 16:57:29 -04:00
Huáng Jùnliàng
4bb1e164da
Refactor [In] production parameter tracking ( #11930 )
...
* refactor: track [In] parameter in prodParam
* Apply suggestions from code review
2020-08-10 07:32:38 -04:00
Huáng Jùnliàng
76f033f8c7
simplify isLookaheadRelational method ( #11922 )
...
* refactor: move isLookaheadRelational to flow plugins
* refactor: simplify isLookaheadRelational to isLookaheadToken_lt
2020-08-05 20:21:35 -04:00
Huáng Jùnliàng
a1eabb84ea
rescan gt/lt token after TsAsExpression is parsed ( #11912 )
...
* refactor: move inType checks to flow plugin
* polish: replace hardcoded char codes
* fix: rescan greater/less token after asExpression is parsed
2020-08-04 17:00:21 -04:00
Huáng Jùnliàng
a4ebe29b3f
Parser refactoring ( #11871 )
...
* refactor: parseMaybeUnary => parseUnary
* refactor: extract shouldExitDescending method
* refactor: add parseUpdate
* refactor: avoid comparing with hardcoded token value
* refactor: add ParseNewOrNewTarget
* refactor: add parseCoverCallAndAsyncArrowHead
* add parseBind
* refactor: polish parseTaggedTemplateExpression interface
* refactor: add parseMember method
* refactor: add parseSuper method
* refactor: add parseAsyncArrowUnaryFunction method
* fix: disallow line break before async binding arrow
* refactor: simplify tt.name logic
* refactor: add parseDo method
* refactor: misc
* refactor: rename parseObjectMember by parsePropertyDefinition
* refactor: unify set/get/async keyword parsing in ObjectMethod
* refactor: misc
* refactor: add parseArrayLike method
* refactor: move fsharp epilogure and prologue inside parseObjectLike
* fixup
* refactor: rename parseFunctionExpression to parseFunctionOrFunctionSent
* refactor: remove redundant logic
* refactor: rename parseClassPropertyName by parseClassElementName
* refactor: avoid unecessary lookahead when parsing tt._export
* fix: export-default-from should support escaped async as export binding
* address review comments
* parseUnary -> parseMaybeUnary
2020-07-31 20:36:04 -04:00
Nicolò Ribaudo
eba4c3b6ed
TypeScript 4.0: Support labeled tuple elements ( #11754 )
...
* TypeScript 4.0: Support labeled tuple elements
* More tests
* Disallow mixing labeled and unlabeled elements
* Update AST shape
* Enable test after rebase
* Allow labeled spread types
* Fix flow
* Add types and generator suport
* Update packages/babel-parser/src/plugins/typescript/index.js
* Prettier
2020-07-29 16:51:48 -04:00
Huáng Jùnliàng
9e6663f125
Follow-up on initial TS4 catch param support ( #11767 )
...
* refactor: align with AST shape convention
* feat: print catch param type annotations
* test: add test case on transform
2020-07-29 16:51:48 -04:00
Brian Ng
8a1d7e41f2
Allow unknown/any in TS catch clause param ( #11755 )
2020-07-29 16:51:48 -04:00
Nicolò Ribaudo
5b4b3a3e4a
TypeScript 4.0: Allow spread in the middle of tuples ( #11753 )
2020-07-29 16:51:48 -04:00
Huáng Jùnliàng
d7347fb8bd
eslint-parser: ES2020 features ( #11815 )
...
* chore: update espree test on nullish coalescing
* feat: add optional chaining support
* fix: adapt to estree AST shape
* chore: update lockfile
* add estree optional-chaining test fixtures
* address review comments
* chore: simplify smoke test
* export * support
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-07-29 16:46:29 -04:00
Huáng Jùnliàng
059e9124ff
Add decimal parsing support ( #11640 )
...
* docs: add DecimalLiteral to AST spec
* add decimal support
* fix: throw invalid decimal on start
* add DecimalLiteral type definitions
* update parser typings
* add generator support
* add syntax-decimal plugin
* Add syntax-decimal to babel-standalone
* add syntax-decimal to missing plugin helpers
* fix incorrect test macro
2020-07-29 16:43:15 -04:00
Huáng Jùnliàng
8f191ead92
chore: fix typo in codebase ( #11846 )
2020-07-16 16:01:20 -05:00
Kai Cataldo
75c2300c28
Add @babel/eslint-plugin-development-internal ( #11376 )
...
* Add @babel/eslint-plugin-internal
* Add dry-error-messages rule
* Address feedback
* Enable new rule
* fix author field
* Fix errors
* Add readme
* Add example configuration
* Handle directories
* run make bootstrap
* More updates!
* Fix errors
* Update tests
* Fix CI race condition
2020-06-22 19:43:29 -04:00
Huáng Jùnliàng
30835f14db
fix: implement early errors for record and tuple ( #11652 )
2020-06-20 02:35:27 +02:00
Huáng Jùnliàng
b27abd39a8
fix: add optional: false to MemberExpression ( #11709 )
2020-06-12 00:26:26 +02:00
Bogdan Savluk
4108524856
Update prettier to v2 ( #11579 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-07 22:21:33 +02:00
Huáng Jùnliàng
71d3527ef5
Properly parse export default from when exportDefaultFrom is not enabled ( #11676 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-05 09:08:21 -05:00
Huáng Jùnliàng
b5c4a46a69
refactor: split locationParser into ParserErrors and error message ( #11653 )
2020-05-30 15:05:42 -04:00
Huáng Jùnliàng
2f31ecf85d
fix: allow bigInt in method name and TSLiteralType ( #11547 )
...
* refactor: add isLiteralPropertyName to parser utils
* address review comments [skip-ci]
* refactor: keyword is valid identifierName
* fix: allow bigint in TSLiteralType
* update typescript test whitelist
2020-05-14 18:40:52 -04:00
Nicolò Ribaudo
31b361b736
Use ?. where it represents the intended semantics ( #11512 )
2020-05-09 23:31:50 +02:00
Nicolò Ribaudo
90a9103e55
Update Flow to 0.123.0 ( #11500 )
2020-04-30 15:26:03 +02:00
Huáng Jùnliàng
fba64d439d
fix: disallow expression after binding identifier of ( #11355 )
2020-04-21 15:12:23 -04:00
Vedant Roy
0e5c1da659
fix: async arrow functions should not be allowed after binary… ( #11284 )
...
* Forbid async arrow functions after binary operator.
This commit makes Babel throw an error when parsing
code like "3 + async() => 2".
* Make atPossibleAsync more accurate
* Change atPossibleAsync to atPossibleAsyncArrow
Add an extra test to atPossibleAsync and refactor it to
atPossibleAsyncArrow. This also fixes a bug in the Typescript plugin,
so a new test has been added.
* Add test for async arrow after unary operator
2020-03-21 19:38:36 +01:00