13582 Commits

Author SHA1 Message Date
Taym Haddadi
286aaeadd9
Add cloneDeepWithoutLoc (#10680)
* feat: add cloneDeepWithoutLoc

* fix: sort functions alphabetically

* doc: add documentation for the withoutLoc parameter

* test: add a test for  shallow cloneWithoutLoc

* test: add loc object to node and fix test

* fix: set loc object on deeper node

* test: check loc on deeper node is null

* doc: adjust withoutLoc documentation

* fix: add withoutLoc param to deep clones

* fix: apply cloneIfNodeOrArray for leadingComments, innerComments and trailingComments

* test: add test for leadingComments, innerComments and trailingComments

* Cleanup PR

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-03-16 23:07:01 +01:00
Siddhant N Trivedi
f232d4d109
Added jsescOptions to Numeric Literals (#11028)
* Added jsescOptions to Numeric Literals

* Added tests and hexadecimal opts to NumericLiterals

* Fixed the bug of every numeric literal being coverted to hex

* Added conditions when jsesc should be applied

* Removed numbers and lowercaseHex from format object

* Added newline to test of jsonEscape (to exclude the change)

* Modified conditions to apply jsesc

* Made the required changes.

* Using node.value instead of value
2020-03-16 23:06:32 +01:00
Brian Ng
4f394e30d2
Add support for flow's SymbolTypeAnnotation (#11077) 2020-03-16 23:00:17 +01:00
Nicolò Ribaudo
2bce1e5e20
Parse BigInts by default (#11117) 2020-03-16 22:59:45 +01:00
Moti Zilberman
1971b7e87d
feat(react-jsx-source): add columnNumber property (#11139)
* feat(react-jsx-source): add column property

This will be useful to tools that consume the injected `__source` prop, allowing precise source locations to be displayed.

* Rename column -> columnNumber, make 1-based
2020-03-16 22:59:22 +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
4a4845585c
feat: align ID_Start/ID_Continue regex to Unicode 13.0.0 (#11246) 2020-03-16 22:52:08 +01:00
Arun Kumar Mohan
84a9ea455b
Allow await when it is not in AsyncArrowHead (#11148) 2020-03-16 22:26:48 +01:00
Nicolò Ribaudo
1ba41f2084
Throw better errors for non-iterables when Symbol doesn't exist (#11264) 2020-03-16 16:34:33 +01:00
Justin Ridgewell
10058901d0
Update Purish aliases (#11267)
* Update Purish aliases

- Adds `Purish` to `RegexLiteral`, since it can't cause any side-effects.
- Removes `Purish` from `ClassExpression` and `ClassDeclaration`, since they can be impure with static class fields.

* Update types
2020-03-16 16:30:38 +01:00
Carlos Lopez
7b9bc7c28b
fix(rest-spread): Do not require Symbol.iterator for strings (#9794) 2020-03-15 14:54:44 +01:00
Justin Ridgewell
661ffbd830
Support more node types in generateUidBasedOnNode (#11260)
* Support more node types in generateUidBasedOnNode

* More nodes
2020-03-14 16:24:50 +01:00
Brian Ng
b85d9f57f6
Remove unused gulp-rename (#11259) 2020-03-14 12:02:00 +01:00
Justin Ridgewell
b1a589f0aa
Fix printing edge cases in Nullish Coalescing and Optional Ch… (#11255)
This is a mix of changes, most importantly:

- Always print parens when mixing nullish coalescing and another logical
- Fixes assignment in the callee of an optional chain, which now blocks #11248

Also, cleans up a bit of code, and removes an unnecessary parens around `class A extends new B {}`
2020-03-13 16:35:28 +01:00
Babel Bot
420f2ee69a Add v7.8.8 to CHANGELOG.md [skip ci] 2020-03-12 18:51:08 +00:00
Nicolò Ribaudo
c831a2450d v7.8.8 2020-03-12 19:44:17 +01:00
Huáng Jùnliàng
565ab9a3fc
fix: preserve shadowed for-loop declarators (#11242)
* fix: do not remove for-loop declarators

* fix: do not remove uninitialized var declarators in for init
2020-03-12 14:07:59 -04:00
Huáng Jùnliàng
dadd22e161
chore: update caniuse fixtrues (#11253) 2020-03-12 12:27:40 -04:00
Nicolò Ribaudo
d030793248
Add support for Unicode 13 in regexps (update regexpu-core) (#11244)
* Update regexpu-core

* Add tests
2020-03-11 23:24:02 +01:00
Nicolò Ribaudo
cbbf0bc6ac
Archive @babel/plugin-syntax-export-namespace-from (#11236)
* Archive @babel/plugin-syntax-export-namespace-from

Enabled by default in https://github.com/babel/babel/pull/10521

5ccc77e287

* Fix tests
2020-03-11 21:50:23 +01:00
Huáng Jùnliàng
f9d4b799b7
chore: pin @rollup/plugin-json to 4.0.1 (#11235) 2020-03-11 01:21:27 +01:00
Brian Ng
0616f06b00
Bump kind-of for audit (#11232) 2020-03-10 17:40:20 -04:00
Brian Ng
a82e7399ed
Bump rollup deps (#11233) 2020-03-10 17:40:08 -04:00
Huáng Jùnliàng
3cc833da14
chore: update acorn to latest patch (#11230) 2020-03-10 17:39:49 -04:00
Brian Ng
5ee1433c2a
Bump ESLint-related deps (#11228) 2020-03-10 15:48:03 -04:00
Sergey Melyukov
cb9d28c42c
Force parentheses around array and conditional infer (#11227) 2020-03-10 12:27:52 -04:00
Brian Ng
eb65195f09
Update @babel deps (#11225)
* Update @babel deps

* fixture
2020-03-10 12:27:13 -04:00
Kai Cataldo
2057d2b159
fix: non-directive "use strict" should not enable parsing in strict mode (#11188)
* fix: non-directive "use strict" should not enable parsing in strict mode

* Remove dead code

* Add stricter type annotations

* set oldStrict explicitly to null

* Fix error

* label callback argument

* update comment

* Address feedback

* Remove this.state.octalPosition

* Add additional tests

* Revert "Remove this.state.octalPosition"

This reverts commit bcc78c9530f8c840f85e86053b75efce662f34d1.

* Remove containsOctal

* Report multiple octal literals in single token

* Fix comments

* remove Array.prototype.flat()
2020-03-05 17:34:27 -05:00
Huáng Jùnliàng
e297e406ce
refactor: remove redundant contextDescription empty check (#11219) 2020-03-05 16:17:01 -05:00
Gerald
8cafd8f820 fix(transform-destructuring): update scope info after replacing 2020-03-05 21:23:50 +01:00
Huáng Jùnliàng
1011e58c6c
update: preset-env-fixtures (#11218)
Co-authored-by: Kai Cataldo <kai@kaicataldo.com>
2020-03-05 15:01:29 -05:00
Babel Bot
1e7ab24bb3 Add v7.8.7 to CHANGELOG.md [skip ci] 2020-03-05 01:56:31 +00:00
Nicolò Ribaudo
595f65f33b v7.8.7 2020-03-05 02:52:13 +01:00
Nicolò Ribaudo
7127330f02
Allow using preset-env with newer versions of compat-data (#11201)
* Use ~ for preset-env's @babel/compat-data dependency

* Revert "Use ~ for preset-env's @babel/compat-data dependency"

This reverts commit e7d57c7894095d381670cddfbbce06bd2a480a32.

* Allow using `preset-env` with newer versions of `compat-data`
2020-03-05 02:35:31 +01:00
Nicolò Ribaudo
a12001a0f9
chore: bump browserslist to version 4.9.1 (#11207) 2020-03-05 00:46:10 +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
Nicolò Ribaudo
114f6726a7
Pass URLs to import() rather than paths (#11193)
* Pass URLs to import() rather than paths

* Make tests pass

* (╯°□°)╯︵ ┻━┻

* (╯°□°)╯︵ ┻━┻           (╯°□°)╯︵ ┻━┻             (╯°□°)╯︵ ┻━┻
2020-03-03 19:54:01 +01: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
8f281f578d
Bump regenerator (#11191) 2020-03-02 17:54:13 +01:00
Daryl Tan
9015fda3c1
Fix scope of function body when var redeclares param (#11158)
* Fix scope of function body when var redeclares param

* Fix empty var declarations

* Apply suggestions
2020-03-01 16:26:22 +01:00
Sagiv ben giat
a39beda58b
print parenthesis around forced calls of optional chains (#11190) 2020-02-28 18:43:43 -05:00
George Zahariev
9c261aeafe
Add "Statement" as alias to Flow enum declaration (#11184) 2020-02-28 09:24:25 +01:00
Nicolò Ribaudo
d13fd7c7bd Add .yarn/install-state.gz to .gitignore [skip ci] 2020-02-27 22:05:39 +01:00
Nicolò Ribaudo
9b16bf3bd2
Set correct version for @babel/eslint-plugin-development (#11181)
[skip ci]
2020-02-27 21:45:57 +01:00
James C. Davis
a5f63299eb
TypeScript: Preserve decorated definite class properties (#11129)
* test: update fixture with decorated definite class property

* fix: don't remove decorated definite class properties
2020-02-27 21:31:23 +01:00
Babel Bot
bb97823abd Add v7.8.6 to CHANGELOG.md [skip ci] 2020-02-27 12:21:40 +00:00
Nicolò Ribaudo
750d3dde3b v7.8.6 2020-02-27 13:17:19 +01:00
Huáng Jùnliàng
e9ea523c5b
replace gulp-watch by gulp.watch (#11175)
* chore: remove gulp-watch

* chore: update lock file
2020-02-26 18:08:28 -05:00
Nicolò Ribaudo
0018881f9d
Add missing dependencies (#11170) 2020-02-25 23:40:48 +01:00