592 Commits

Author SHA1 Message Date
Huáng Jùnliàng
facfd4d8a1 Enable no-process-exit ESLint rule (#11025) 2020-01-20 00:48:47 +01:00
Vedant Roy
341964bd4e fix: properly parse member expression after property initializ… (#11031)
Fixes issue 10989 where the only the identifier in a member expression that is the value of an object property would be parsed. Removing checkExpressionErrors in parseExprSubscripts results in the subscript also being parsed.
2020-01-20 00:33:09 +01:00
Sven Sauleau
34a9653281 add AST for the module attribute proposal (#11015)
Introduce a `ImportAttribute` structure and add an `attributes` key on
the `ImportDeclaration` node.

[skip ci]
2020-01-17 20:58:30 +01:00
Huáng Jùnliàng
45301c5304 Update coalesce precedence (#11017)
* refactor: reimplement nullish coalescing precedence tracking

Co-authored-by: Toru Nagashima <public@mysticatea.dev>

* fix: Coalesce has same precedence with LogicalOR

* fix flow errors

Co-authored-by: Toru Nagashima <public@mysticatea.dev>
2020-01-17 20:57:07 +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
a1063d2583
fix: triple __proto__ in object patterns should be allowed (#11009) 2020-01-16 09:34:47 -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
Nicolò Ribaudo
a7620bd266 v7.8.3 2020-01-13 22:36:19 +01:00
Nicolò Ribaudo
8fce431d88
Revert "chore: specify package type (#10849)" (#11003)
This reverts commit e8dac621de9dba27b47646169562c0a0c2e02c96.

Fixes installs when using npm <= 3.9.5 (Node.js <= 6.2.2)
2020-01-13 21:18:42 +01:00
Nicolò Ribaudo
2486615a74 v7.8.0 2020-01-12 01:09:29 +01: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
Huáng Jùnliàng
e8dac621de
chore: specify package type (#10849) 2020-01-09 21:40:15 -05:00
jack
5f807ae45b Enable optional chaining by default in @babel/parser (#10817) 2020-01-10 03:09:39 +01:00
Oleksandr Fediashov
c3388ea42f Enable nullish coalescing by default in @babel/parser (#10819)
* move files, remove hasPlugin() & expectPlugin()

* restore permissions
2020-01-10 02:52:53 +01:00
Abdul Ali
5b907e9bb7 [parser] enable dynamic import by default (#10843)
* [parser] enable dynamic import by default

* chore: add back babel-core api test
2020-01-10 02:28:52 +01:00
Nicolò Ribaudo
771c730fda
[parser] Disallow duplicate and undeclared private names (#10456)
* [parser] Add private names tracking to Scope

- Disallow duplicate private names
- Disallow undeclared private names

* Update tests

* Test all possible duplications

* Test undeclared private names

* Better error message for top-level private names

* Fix flow

* Update test262 whitelist

* Update fixtures

* Update flow whitelist

* Remove old output.json

* Move ClassScopeHandler to a separate class

* Make the code readable
2020-01-10 02:22:05 +01:00
Huáng Jùnliàng
8fd532db39
LiteralPropertyName should allow BigIntLiteral (#10955)
* fix: property name should allow BigIntLiteral

* test: add non decimal test case

* add bigintIndex to whitelist
2020-01-07 10:23:50 -05:00
Huáng Jùnliàng
455d782ef0 test: add invalid-lone-import test (#10950)
* test: add lone import test

* polish: raise recoverable error
2020-01-03 23:08:59 +01:00
Huáng Jùnliàng
a28353703f fix: check await when parsing AsyncArrowBindingIdentifier (#10953) 2020-01-03 23:08:28 +01:00
Huáng Jùnliàng
467667af88 When reading a new string, U+2028/2029 should correctly set th… (#10944)
* test: add test on template

* fix: update lineStart when string contains U+2028/U+2029
2020-01-03 23:07:54 +01:00
Huáng Jùnliàng
6ee8c97e6a Fix: TopLevelAwait should respect await identifiers defined in… (#10947) 2020-01-03 23:07:11 +01:00
Huáng Jùnliàng
26eb891870
fix: Class Field Initializer should not allow await expression as immediate child (#10946)
* fix: scope.inAsync should exclude reference in class property initializers

* chore: add test on await in computed class property

* fix flow error :(
2019-12-31 09:36:03 -05:00
Huáng Jùnliàng
0238244268
refactor: remove unecessary checkYieldAwaitInDefaultParams (#10936) 2019-12-30 16:12:09 -05:00
Huáng Jùnliàng
2f3f77926d
refactor: remove unused invalidTemplateEscapePosition tokenizer state (#10935)
* refactor: remove unused invalidTemplateEscapePosition tokenizer state

* fix flow error
2019-12-30 16:11:56 -05:00
Huáng Jùnliàng
30449fe05d
Refactor parseSubscript (#10937)
* refactor: unify optionalMemberExpression generation

* test: add optional calls invalid typecasts

* fix: do not parse async arrow when call is optional

* test: update test fixtures
2019-12-30 16:11:39 -05: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
Huáng Jùnliàng
a18166d2a9 refactor: remove inClassProperty parser state (#10906) 2019-12-24 11:43:39 +01:00
Barthélémy Ledoux
f651f22f96 fix: lost leading comment after named import (#10901)
* create test for 10892

* update expected output

* fixed #10892

* add colon to restart build

* remove colon as it makes tests fail
2019-12-22 10:22:28 +01:00
Nicolò Ribaudo
12da0941c8 v7.7.7 2019-12-19 01:33:19 +01:00
Nicolò Ribaudo
0b3f883ed1 Properly serialize non-json values in parser tests (#10858) 2019-12-12 10:22:17 +01: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
Nicolò Ribaudo
5156d3ea06
Restore @babel/parser tests (#10854)
* Make parser tests work again

* Update failing fixtures

* Fix serialization of BigInt

* Fix
2019-12-11 11:09:13 +01:00
Bowei Han
20e43ad103 validate parentheses in the left-hand side of assignment expressions (#10576)
* invalid left-hand assignments based on parenthesis

* validate against nested ParenthesizedExpressions
2019-12-09 20:29:02 -05: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
Nicolò Ribaudo
d04508e510 v7.7.5 2019-12-06 14:12:41 +01:00
Huáng Jùnliàng
c6e966cac9 [parser] Use scope flags to check arguments (#10801)
* chore: add test case

Co-authored-by: Jens Maier<jens@elberet.de>

* use scope flags to check arguments
2019-12-05 08:23:53 +01:00
Alex Lewis
bb6cc61979 fix(optional chaining): Optional delete returns true with nullish base (#10806)
Per issue 10805, the return value when using delete on a nullish base is
currently undefined. The correct return type should be true.
2019-12-04 12:56:25 +01:00
YeonJuan
d18afbd7c3 Allow tuple rest trailing comma (#10800) 2019-12-03 18:32:36 +01:00
Nicolò Ribaudo
5440ae1cae
Correctly disambiguate / after async fuctions (#10475)
* Correctly disambiguate / after async fuctions
2019-12-02 22:41:39 +01:00
Nicolò Ribaudo
75767d87cb v7.7.4 2019-11-23 00:05:58 +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
gr
10213655bc [parser] Allow optional async methods (#10582)
* Add parsePostMemberNameModifiers to aync method

* Add test
2019-11-18 19:18:36 +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
Kai Cataldo
a6d134804a Unify build step for ESLint packages (#10723) 2019-11-16 10:15:15 +01: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
e315d65a7a v7.7.3 2019-11-08 23:45:00 +03:00
Nicolò Ribaudo
0287c0f02f
Don't recover from "adjacent jsx elements" parser error (#10682) 2019-11-08 23:23:04 +03:00