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
vages
2603c2e227
fix(babel-parser): chain off optionally chained keys named cla… ( #11198 )
...
* fix(babel-parser): chain off optionally chained keys named class and function
Fixes #11197
* Extract override as variable to satisfy typechecker
Flow did not trust that curContext.override would be defined
2020-03-03 18:27:41 +01:00
Nicolò Ribaudo
750d3dde3b
v7.8.6
2020-02-27 13:17:19 +01: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
Nicolò Ribaudo
8ab27c8ffe
Wrap type-only class fields in flow comments ( #11096 )
...
* Wrap type-only class fields in flow comments
* Fix
2020-02-09 11:45:42 +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
Nicolò Ribaudo
5c2e6bc07f
v7.8.4
2020-01-30 13:18:09 +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
Chunpeng Huo
9bc04baeb5
fix(babel-parser): avoid state.clone() to clone the whole token store ( #11029 )
...
* fix(babel-parser): avoid state.clone() to clone the whole token store
Fixed the performance issue on large input when turned on option {tokens: true} and typescript plugin which uses quite a few state.clone().
* test(babel-parser): turn on 2 typescript tests with tokens:true
The output.json is generated by old master to make sure no regression.
* fix(babel-parser): avoid duplicated tokens trapped by mainly typescript/flow plugins
* test(babel-parser): update output.json to latest master result
* chore(babel-parser): improve performance by storing tokensLength in state
2020-01-19 22:38:33 -05:00
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