210 Commits

Author SHA1 Message Date
Vivek Nayyar
b02e35c19a Fix parenthesis for nullish coalescing (#10269)
* ♻️ added condition to check for left and right of nullish coalescing operator and if any is a logical expression without a paren then throw an error

* 🐛 bugs fixed and test cases updated for babel parser

* ♻️ code comments added

* 🐛 spell error rectified

* ♻️ failing test updated

* 🐛 push tests after make build

* Skip nullish-coalescing flow precedence tests

They're now incorrect

* ♻️ error message updated, binop priority of other logical operators +1 from ?? and

* ♻️ increaed the binOp for in and instanceOf, added logic to print the brackets in an ?? && || expression, test cases added

* 🐛 failing test fixed and comments updated

* ♻️ new lines added between tests

* ♻️ basic tests for checking the binOp of instanceOf, in and relational operators to be equal added

* ♻️ new lines added in between tests
2019-09-06 17:35:44 +02:00
Daniel Tschinder
4f0840ab88
Update dev dependencies and fix linting errors (#10228)
* chore: Uppate dev dependencies

* chore: Fix lint errors

* chore: Format options.json files

* chore: Fix stupid flow errors

* Update test262 whitelist

Seems test262-stream was updated and now these tests work.
2019-07-27 15:09:30 +02:00
Tan Li Hau
f588e4ec47 BigInt type for Flow (#10091)
* flow BigIntLiteralTypeAnnotation

* numericSeparator for flow test plugins

* fix flow tuple

* fix code review
2019-07-03 16:48:46 +02:00
Nicolò Ribaudo
8bf9714d69
[legacy decorators] Allow decorating generator methods (#9912)
* [legacy decorators] Allow decorating generator methods

The old proposal used LeftHandSideExpression (instead of
AssignmentExpression) to satisfy this usecase:
e240cbc91a

* Update flow whitelist
2019-06-30 11:32:16 +02:00
Tan Li Hau
fdbbb743b6 flow - allow type parameter defaults in function declarations (#10084)
* flow - allow type parameter defaults in function declarations

* fix flow test

* add intern_comments option

* fix flow parser test

* remove allowdefault from flowParseTypeParameterDeclaration

* rename test cases
2019-06-15 12:31:12 +02:00
Daniel Tschinder
491b0a8e33
Update test262 (#9806) 2019-04-01 21:47:07 -07:00
Daniel Tschinder
c7587c016e
Don't accept '\08' or '\09' in strict mode (#9769) 2019-04-01 19:41:50 -07:00
Daniel Tschinder
6bc9e7ebda
Correctly check for-in and for-of loop for invalid left-hand side (#9768)
* Correctly check for-in and for-of loop for invalid left-hand side

* Overwrite with env variable
2019-03-26 15:32:14 -07:00
Daniel Tschinder
7f4427432c
Parse right-hand-side of for/of as an assignment expression (#9767) 2019-03-25 18:14:56 -07:00
Daniel Tschinder
b2b96e0b15
Add WarningsToErrorsPlugin to webpack to avoid missing build problems on CI (#9647) 2019-03-07 15:44:36 -08:00
Daniel Tschinder
fb81e8f8b4
Make babel-standalone an ESModule and enable flow (#9025)
* Make babel-standalone an ESModule and enable flow

* autogenerate plugin list

* Make config an array
2019-03-06 14:30:43 -08:00
Daniel Tschinder
29999007f6
Disallow escape sequences in contextual keywords (#9618)
* Disallow escape sequences in async

* Disallow escape sequences in get, set and async in class

* invalid escape tests

* Update whitelist

* tests for async in parens

* Add test for invalid newline between params and arrow

* Move canInsertSemilcolon() into shouldPArseAsyncArrow
2019-03-05 17:20:36 -08:00
Daniel Tschinder
98ab1b6428
Refactor parsing object members (#9607)
* Refactor parsing object members

* Ensure decorators on rest don’t swallow decorators silently

* Use hasPrecedingLineBreak

* Add test for async with linebreak

* Update flow whitelist
2019-02-28 11:42:12 -08:00
Daniel Tschinder
208195f425
Disallow duplicate params in methods (#9599)
* Disallow duplicate params in methods

* Fix plugins
2019-02-27 15:54:07 -08:00
Daniel Tschinder
43eed1ac92
Check exported bindings are defined (#9589)
* Check exported bindings are defined

* Add tests

* Update flow whitelist

* Add tests for builtins
2019-02-26 13:28:10 -08:00
Daniel Tschinder
d0e196d210
Treat for loop body as part of loop scope (#9586) 2019-02-25 18:30:51 -08:00
Daniel Tschinder
45c96908e9
Update test262 (#9587)
* Update test262

* Also remove unrecognized tests from the whitelist
2019-02-25 15:10:48 -08:00
Daniel Tschinder
a7391144b3
Introduce scope tracking in the parser (#9493)
* Introduce scope tracking

* Fix tests

* Add new tests

* Remove constructor-super check from transform as it is now in parser

* Correctly handle class properties and class scope

* Fix duplicate name check

* Convert scope identifier storage to array

* Enter a new scope in typescript module blocks

* Add test for duplicate declaration

* Rename error for duplicate exports

* Treat class declarations as lexical declaration

* Update whitelist

* Add tests

* Fix scope tracking for function declarations

* Migrate try-catch duplicate error

* Fix test

* More tests

* One more test

* Make scope a separate class and fix review comments

* Do not allow new.target in top scope arrow function

* Correctly enter new scope for declare module and treat type aliases as lexical declarations

* Tests for typescript scope tracking to not mark type aliases as duplicate

* Fix flow scope tracking

* Remove ident from test names as redundant

* Add test case for var and function

* Improve error messages

* Improve literal regex
2019-02-25 11:04:52 -08:00
Nicolò Ribaudo
d86b831364
Add duplicate-package-checker-webpack-plugin (#9517)
We are duplicating semver. It's such a small package that I don't think that it is worth spending much time trying to understand why.
2019-02-15 12:28:00 +01:00
Daniel Tschinder
2817844e89
Fix regression with let (#9477)
* Fix corner cases with let

* Handle generators correctly

* Fix flow plugin

* Fix typescript plugin
2019-02-08 13:36:37 -08:00
Galymzhan Abdugalimov
7e9029e337 Switched gutil.log to fancyLog due to deprecation (#9432) 2019-01-30 08:23:02 -06:00
Galymzhan Abdugalimov
00c3e3c8e0 Fixed link to @babel/parser's issues in README (#9427) 2019-01-30 08:18:43 -06:00
Nicolò Ribaudo
4c4c22a316 Run prettier 2019-01-30 11:30:31 +01:00
Rizky
56044c7851 install polyfill & runtime to dependency instead of devDependency [skip ci] (#9409) 2019-01-29 08:09:08 -06:00
Daniel Tschinder
46ba5940c2
Make yield a contextual keyword (#9400) 2019-01-23 14:33:23 -08:00
Daniel Tschinder
42c5d3fc4b
Correctly fail for invalid yield in for (#9398) 2019-01-23 13:39:30 -08:00
Daniel Tschinder
4f69699b71 Fix parsing in non-declaration places 2019-01-22 13:12:03 -08:00
Daniel Tschinder
f4f5ca2aaa Parse class name in strict mode
The specification defines that the whole class declaration is parsed in strict mode
2019-01-22 13:12:03 -08:00
Daniel Tschinder
8071dca9ad Disallow const let or let let 2019-01-22 13:12:02 -08:00
Daniel Tschinder
96a7343142
Merge pull request #9348 from danez/perf
Parser Performance Collection
2019-01-21 02:27:42 -08:00
Nicolò Ribaudo
4ce37b7aca
Update test262 sha (#9365) 2019-01-19 18:10:28 +01:00
Daniel Tschinder
2d6231fd3d Update flow whitelist 2019-01-17 16:16:32 -08:00
Nicolò Ribaudo
0a88230ec4 Disallow async functions as loop bodies (#9314) 2019-01-17 17:07:48 -05:00
Nicolò Ribaudo
3e4b608a80
Parse class heritage as strict mode code (#9315) 2019-01-12 14:54:23 +01:00
Nicolò Ribaudo
5889620a6a
Disallow new import(x) and import(x,) (#9313)
* Disallow "new import(...)"

* Disallow trailing comma inside dynamic import

* Rename test

* Update error message
2019-01-11 18:59:51 +01:00
Nicolò Ribaudo
9764718c32
Disallow trailing comma after rest (#9311)
* Add new tests

* Use state instead of param and disallow comma in [...a,]=[]

* Unify error messages

* Object destructuring

* Update whitelist
2019-01-11 13:08:38 +01:00
Cameron Martin
778a61a3c2 [@babel/types] Moved generators related to babel-types into the babel-types package directory. (#9245) 2019-01-09 00:14:31 +01:00
Brian Ng
a55382e4ad
Test262 update (#9288) 2019-01-07 08:52:36 -06:00
Cameron Martin
9e95da4eaa Added type-level mapping between aliases and nodes that have that alias. (#9110) 2018-12-19 10:57:27 +01:00
Nicolò Ribaudo
911c2d0bf4
Use @babel/eslint-plugin-developement (#9206) 2018-12-18 22:59:43 +01:00
Daniel Tschinder
5cb38995c0
Allow keywords to be used in type annotations (#9184) 2018-12-15 12:51:24 -08:00
Vikram Rangaraj
72471aff63 Handle flow comments with leading spaces (#9168)
* check for spaces and tabs before a flow comment

* fix issue with using string index and shift interchangably

* update tests

* Use update charcodes version

* Disallow flow-comments in flow-comments and check for unterminated comments
2018-12-13 22:10:01 -08:00
Daniel Tschinder
559d649994
Skip minifying standalone (#9094)
Also remove unused dependency on uglify js. gulp-uglify uses its own version.
2018-11-28 12:36:24 -08:00
Nicolò Ribaudo
61f2aed5b0
Disallow await inside arrow functions (#9074)
* Disallow await inside arrow functions

* Update test262 whitelist
2018-11-26 12:43:04 +01:00
Nicolò Ribaudo
8c7d4b55c9
Add plugins name (#8769)
* Add plugins name

* Add missing names found by the plugin

* Add eslint plugin
2018-11-18 23:02:58 +01:00
Daniel Tschinder
1af57e6f71
Fix test262 tests again! 2018-11-14 23:29:17 -08:00
Remi Liu
4dfd801887 [Types] fix generated TS/Flow comment types (#9007) 2018-11-09 09:03:53 -06:00
Nicolò Ribaudo
2fa1984635
Fix await in function name and parameters (#7727)
* Disallow await in function parameters

* Fix await as function name

* Update test whitelists
2018-11-06 08:30:06 +01:00
Daniel Tschinder
e3b2c1afff
fix: Do not allow TypeCastExpressions w/o parens (#8956) 2018-11-05 15:34:24 -08:00
James Garbutt
b95cbc4a8e output aliased types in typescript declarations (#8629) 2018-11-05 23:58:57 +01:00