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
Kai Cataldo
7ca814489a
fix: parse value imports named type as values ( #11296 )
...
* fix: parse value imports named type as values
* Address feedback
* Add plugin tests
* Add isContextual() check
* Remove importKind: value from extraneous nodes
* Ensure importKind is correct for more nodes
* Add additional test
* Address feedback
* Revert formatting
* Fix tests
2020-03-21 01:38:07 +01:00
Huáng Jùnliàng
841f4428e8
Rephrase parser error message ( #11208 )
...
* refactor: rephrase some parser error messages
* update test fixtures
* Update packages/babel-parser/src/parser/location.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* address review comments
* Update packages/babel-parser/src/parser/location.js
Co-Authored-By: Brian Ng <bng412@gmail.com>
* update test fixtures
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-03-16 21:48:32 -04:00
Nicolò Ribaudo
5c1a8210da
Implement support for declare on class fields with Flow ( #11178 )
...
* Add parser support for Flow declare fields
* Add generator test
* Add "allowDeclareFields" option to flow-strip-types
* Add test
* Update error messages
* More tests
2020-03-16 23:08:26 +01:00
Brian Ng
4f394e30d2
Add support for flow's SymbolTypeAnnotation ( #11077 )
2020-03-16 23:00:17 +01:00
Nicolò Ribaudo
740260b236
Add import type and export type support to TypeScript ( #11171 )
...
* Add support for type only imports in TS (#11053 )
* Implement "export type {}" (#11122 )
* Add "exportKind: type" when needed with TS (#11157 )
* Add `onlyRemoveTypeImports` option to `transform-typescript` (#11173 )
* Add onlyRemoveTypeImports to preset-typescript (#11179 )
Co-authored-by: Brian Ng <bng412@gmail.com>
Co-authored-by: Raja Sekar <rajasekarm.dev@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Henry Zhu <smiley.we@gmail.com>
Co-authored-by: Siddhant N Trivedi <sidntrivedi012@gmail.com>
2020-03-16 22:58:51 +01:00
Brian Ng
20d9a10186
Add estree parsing support for export * as A ( #11254 )
2020-03-16 22:52:33 +01:00
Huáng Jùnliàng
21c9141872
Refactor: add parser message template ( #11192 )
...
* refactor: add raiseWithData method
* refactor: error message template
* fix missing plugin error structure
* fix flow errors
* refactor: use error message template in eslint plugin
* refacotr: use error message template in flow plugin
* refactor: use error message template in typescript plugin
* refactor: use error message template in jsx plugin
* address review comments
* Update packages/babel-parser/src/parser/location.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-03-03 14:06:05 -05:00
Huáng Jùnliàng
afb0f489de
Enable more eslint recommended rules ( #11168 )
...
* chore: enable no-constant-condition
* chore: enable no-empty rule
* chore: enable no-unreachable
* chore: enable no-cond-assign
* chore: enable no-inner-declarations
* chore: remove disabled rules that are not in eslint:recommended
* fix: oops
2020-02-24 19:04:25 -05:00
Huáng Jùnliàng
223cee7246
Parse declare modifier around accessibility modifiers ( #11146 )
...
* fix: parse declare modifiers around accessibility modifiers
* test: add tests
* fix: check duplicate modifiers in modified nodes
* fix flow error
2020-02-20 23:29:47 -05:00
Huáng Jùnliàng
38529699d6
Refactor await/yield production parameter tracking ( #10956 )
...
* test: add test fixtures
* refactor: track AWAIT and YIELD in separate handler
* fix flow errors
* add flow type annotation to production-parameter
* address review comments
* refactor: track [Return] parameter
2020-02-09 15:31:29 +01:00
Huáng Jùnliàng
0b3dea8f54
Turn on no-fallthrough rule ( #11093 )
...
* chore: turn on no-fallthrough
* chore: fix no-fallthrough errors
2020-02-07 22:05:19 +01:00
Liam Doran
11d9826e77
Fix Async Generic After Await Parsing Error ( #11092 )
...
* test: add test case
* fix: reset awaitPos before parsing generic arrow fn
* fix: maybeInArrowParameters reset to true
2020-02-04 23:06:04 +01:00
Huáng Jùnliàng
43b23e0869
refactor: simplify toAssignable routine ( #11032 )
...
* refactor: remove isBinding parameter
* remove unused contextDescription
* refactor: remove unnecessary nullish check
* refactor: simplify toAssignable on ParenthesizedExpression
* tests: categorize createParenthesizedExpression tests
2020-01-20 21:04:16 +01:00
Huáng Jùnliàng
6648d62f40
chore: use @babel/eslint-config-internal ( #11026 )
2020-01-17 07:57:25 -05:00
Huáng Jùnliàng
9df70b4505
Duplicate __proto__ key should be allowed in object patterns ( #10987 )
...
* refactor: replace refShorthandDefaultPos by refExpressionErrors
* fix: duplicate __proto__ keys should be allowed in patterns
* docs: add comments for ExpressionErrors.doubleProto [ci-skip]
* test: add more test for coverage
2020-01-14 22:53:45 -05:00
Huáng Jùnliàng
81c5f1f22d
Disallow private name in object elements and TS type elements ( #10980 )
...
* fix: disallow private name in object member and TS type elements
* chore: update test262 whitelist
* chore: make flow happy
* Update packages/babel-parser/src/parser/expression.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* chore: update test fixtures
* Update packages/babel-parser/src/parser/expression.js
Co-Authored-By: Brian Ng <bng412@gmail.com>
* chore: update test fixtures
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-01-11 11:26:10 -05:00
jack
5f807ae45b
Enable optional chaining by default in @babel/parser ( #10817 )
2020-01-10 03:09:39 +01:00
Huáng Jùnliàng
86245a83a2
TSTypeCastExpression should not be inside call parameters ( #10939 )
2019-12-30 16:10:19 -05:00
Huáng Jùnliàng
197a8da04d
Remove unused parser methods ( #10942 )
...
* chore: remove unused isStrictBody
* chore: remove unused eatRelational
2019-12-30 16:09:50 -05:00
Kai Cataldo
7b54a94389
@babel/eslint-parser: fix ImportExpression node to match ESTree spec ( #10828 )
...
* @babel/eslint-parser: fix ImportExpression node to match ESTree spec
* Update caller name for @babel/core.parseSync
* Move logic into estree plugin
* Add estree plugin tests
* Fix Flow error
* Fix flow
* Remove extra properties on ImportExpression node
* Incorporate review feedback
2019-12-11 11:13:57 +01:00
Kai Cataldo
fb100eee41
@babel/eslint-parser: fix BigIntLiteral node to match ESTree spec ( #10827 )
...
* @babel/eslint-parser: fix BigIntLiteral node to match ESTree spec
* Move token conversion to @babel/eslint-parser
* Add estree plugin tests
* Update test helpers to handle BigInt serializing
* Update Literal union type to include BigIntLiteral
* Add FlowIgnore comment for BigInt
2019-12-08 02:59:18 +01:00
YeonJuan
d18afbd7c3
Allow tuple rest trailing comma ( #10800 )
2019-12-03 18:32:36 +01:00
George Zahariev
01d6d6dd3b
Flow enums: fix enum body location ( #10737 )
2019-11-19 22:46:08 -06:00
Brian Ng
a502d88043
Fix some incorrect typeof parsing in flow ( #10657 )
2019-11-18 19:22:27 +01:00
Huáng Jùnliàng
cfd26fdbf2
register ImportEqualsSpecifier to scope ( #10710 )
...
Co-authored-by: <jaejoon.choi>
2019-11-18 13:04:34 -05:00
Huáng Jùnliàng
d413a3078c
Add asserts this [is type] parsing support ( #10677 )
2019-11-11 16:36:10 -06:00
Sakibul Mowla
4cb5e0a013
Allow TypeScript type assertions in array destructuring ( #10592 )
...
* Add test
* Add fix
* Fix test, destructure with as assertion
* Add angle-bracket assertion case
* Use isBinding to make typeCastToParameter decision
2019-11-11 22:38:13 +01:00
Nicolò Ribaudo
0287c0f02f
Don't recover from "adjacent jsx elements" parser error ( #10682 )
2019-11-08 23:23:04 +03:00