592 Commits

Author SHA1 Message Date
Sosuke Suzuki
963537d5f5
[ts] Make ImportDeclaration always have importKind (#12170) 2020-10-29 20:07:10 +01:00
Sosuke Suzuki
ff6c3792bb
Make assertions optional and update AST spec (#12280) 2020-10-29 10:21:52 -05:00
Huáng Jùnliàng
b7754d3c82
fix: disallow import assertionts in export without from (#12264) 2020-10-28 07:07:20 +01:00
Huáng Jùnliàng
a8c66f4680
Handle exprAllowed before ObjectLike is parsed (#12267)
* fix: disallow expression after `}` is consumed in parseObjectLike

* refactor: avoid accessing this.prodParam in context update
2020-10-27 20:25:50 -04:00
Huáng Jùnliàng
ea2892fefc
add declare to class properties type annotations (#12257)
* add declare to class properties type annotations

* chore: use preset-flow
2020-10-27 10:05:01 -04:00
Huáng Jùnliàng
5b48f40a08
Polish parser errors (#12258)
* polish: update AwaitNotInAsyncFunction message

* polish: update YieldInParameter error message

* Apply suggestions from code review

Co-authored-by: Brian Ng <bng412@gmail.com>

* update test fixtures

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-26 20:55:04 -04:00
Huáng Jùnliàng
2782a549e9
Refactor yield await classification (#12230)
* fix: incomplete ParamKind declaration

* refactor: add expression scope handler

* test: update test262 allowlist

* chore: cleanup

* fix: push expression scope for function body

* fix: push new expression scope for initializer and static block

* test: add more test cases

* fix flow error

* refactor: remove unecessary expression scope

* fix: parameter initializer error should not cross expression scope boundary

* chore: cleanup outdated comments

* fix: do not record async arrow error on ParameterDeclaration

* Update packages/babel-parser/src/util/expression-scope.js

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>

* polish: clear ancestry declaration error on validate

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-10-26 11:42:02 -04:00
Sosuke Suzuki
faaebfe91f
Support Import Assertions for re-export statement (#12249) 2020-10-26 15:18:45 +01:00
Sosuke Suzuki
f5bd9f2013
Allows the interface to be used as an Identifier for flow plugin (#12254) 2020-10-26 08:50:57 -05:00
Brian Ng
c00bb14f79
[ts] Error on invalid type casts in JSX (#12221) 2020-10-23 08:09:35 -05:00
Brian Ng
d51aa6d761
[ts] Allow optional binding pattern parameters within types/interfaces (#12227) 2020-10-21 08:16:43 -05:00
Sosuke Suzuki
f1bc314c79
Fix parsing of imports with module string name in flow plugin (#12224) 2020-10-20 23:46:12 +02:00
Nicolò Ribaudo
2562c8d8fa v7.12.3 2020-10-16 23:11:14 +02:00
Mongkii
7870465b62
[ts] Add parser test: destructuring-with-annotation-newline (#12203) 2020-10-16 16:45:11 +02:00
Brian Ng
47250ffa65
[ts] Disallow invalid type annotations in ExpressionStatements (#12185)
* Fix regression with invalid type annotations in ExpressionStatements
2020-10-16 10:20:53 +02:00
Nicolò Ribaudo
a534d8746e v7.12.2 2020-10-16 08:47:05 +02:00
Nicolò Ribaudo
4fe8c3acc5
Revert "Fix: check if param is assignable when parsing arrow return type annotation" (#12198)
This reverts commit 84987a00e632e65bdafdf7f70df46ded7fb083c8.
2020-10-16 08:16:37 +02:00
Nicolò Ribaudo
7f4b83833f v7.12.1 2020-10-16 00:36:30 +02:00
Huáng Jùnliàng
eec01fe078
chore: use workspace:* for dev deps (#12186) 2020-10-15 14:03:50 -04:00
Nicolò Ribaudo
84987a00e6
Reland "Fix: check if param is assignable when parsing arrow return type annotation" (#12183)
* Reland "Fix: check if param is assignable when parsing arrow return type annotation"

This reverts commit 91a7a64b4b0c30ab1fdfbb12f77522afa2285ec4.

* Mark `RestElement` as assignable
2020-10-15 11:32:37 -04:00
Nicolò Ribaudo
726154c78e v7.12.0 2020-10-14 21:48:45 +02:00
Nicolò Ribaudo
91a7a64b4b
Revert "Fix: check if param is assignable when parsing arrow return type annotation" (#12173)
This reverts commit 136e6301cbfa9448cfb20396f82f93f0d3e10c12.
2020-10-14 21:42:05 +02:00
Sven Sauleau
af8e0facc1
Parse import-assertions (#12139)
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-10-14 21:18:16 +02:00
iamfotx
59d97d9bca
[parser] Better error message for missing number exponent (#12072)
* fix(babel-parser) better error message for missing number exponent after 'e'

* fix(babel-parser) requested changes

* msg

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 21:17:38 +02:00
Huáng Jùnliàng
3ccca88178 Parse class static block (#12079)
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 21:16:24 +02:00
Brian Ng
6830c90ac9
Support TypeScript mapped type 'as' clauses (#12129) 2020-10-14 20:16:22 +02:00
Nicolò Ribaudo
3fd963fdc8
[ts] Add support for template interpolations in types (#12131)
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 20:15:42 +02:00
Nicolò Ribaudo
9f40d6fcd0
[ts] Add support for the "intrinsic" keyword (#12147) 2020-10-14 20:15:17 +02:00
Huáng Jùnliàng
136e6301cb
Check if param is assignable when parsing arrow return type (#11992) 2020-10-14 20:09:48 +02:00
Huáng Jùnliàng
21d7ee2610 String import/export specifier (#12091)
* feat: parse moduleExportName
* feat: add validators
* Support string specifier name in commonjs transform
* Support string specifier name in export-ns-from
* test: add loose testcases
* test: add testcases for amd and umd
* feat: support systemjs
* test: update fixtures fixed in #12110
* add plugin name typings
* test: rename test layout
* feat: implement under moduleStringNames flag
* chore: add plugin syntax module string names
* feat: support ModuleExportName as ModuleExportName
* test: update test fixtures
* fix flow errors
* docs: update AST spec
* feat: support { "some imports" as "some exports" }
* feat: support { "some imports" as "some exports" } in systemjs
* test: add test on `import { "foo" }`
* Address review comments
* add moduleStringNames to missing plugin helpers
* Apply suggestions from code review
* update test fixtures
* Update packages/babel-parser/src/parser/error-message.js
* update test fixtures

Co-Authored-By: Kai Cataldo <kai@kaicataldo.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 20:01:37 +02:00
Sosuke Suzuki
a5bed04f55
Make asserts property boolean, not undefined (#12167) 2020-10-13 23:56:08 +02:00
Brian Ng
13a1cfd396
Move check for TSTypeCastExpression to catch another case (#12161) 2020-10-11 13:03:57 +02:00
Sosuke Suzuki
45f0cc2ed9
Recover from error for missing initializer in const declaration (#12120) 2020-09-29 18:40:51 +02:00
Sosuke Suzuki
39a12674b4
Improve syntax error for class fields in ambient context (#12108)
* Improve error messages for ambient context class fields

* Modify switching state.isDeclareContext for class fields with declare
2020-09-26 15:52:12 -04:00
Sosuke Suzuki
434b65bc2a
[ts] Throw a syntax error for index signature with declare (#12111) 2020-09-26 18:06:13 +02:00
Sosuke Suzuki
0d32e3fc36
Add missing tests for TypeScript syntax errors (#12103)
* Add missing tests for index signatures with modifiers

* Add missing test for import type
2020-09-24 14:38:11 -04:00
Sosuke Suzuki
a4a14caee7
Throw a syntax error for empty type parameter/argument (#12088) 2020-09-22 08:26:30 -05:00
Sosuke Suzuki
cb4e436018
Throw an error for a declare class field that have an initializer (#12093) 2020-09-22 08:23:58 -05:00
Sosuke Suzuki
3628c52867
Do not throw an error for optional binding pattern params in function declaration (#12085) 2020-09-21 09:14:13 -05:00
fisker Cheung
18d13d0032
Fix invalid setter parse (#12076)
* Fix invalid `setter` parse

* estree

Co-authored-by: Brian Ng <bng412@gmail.com>
2020-09-19 10:03:35 +02:00
Sosuke Suzuki
ae18f9c0d9
Throw a syntax error for a declare function with a body (#12054) 2020-09-19 00:35:37 +02:00
Sosuke Suzuki
7028a14c7f
fix: throw for constructors with type parameters (#12065)
* Throw a syntax error for a constructor with type parameters

* Modify to match error location with TypeScript

* Update typescript parser tests

Update allowlist.txt
2020-09-17 13:03:33 -04:00
Sosuke Suzuki
bbe0cf09fc
Throw a syntax error for a parameter properties in not constructor (#12061) 2020-09-14 16:28:06 -05:00
Huáng Jùnliàng
af64ccb2b0 v7.11.5 2020-08-31 15:54:06 -04:00
Huáng Jùnliàng
2c60595342
fix: ExpressionBody should respect [In] parameter (#11931) 2020-08-26 13:24:44 -04:00
Huáng Jùnliàng
3fad7eab9b
Use Yarn 2 (#11962)
* chore: use yarn 2

* chore: remove redundant yarn locks

* chore: remove publishEslintPkg

* chore: remove redundant make bootstrap

* Update .yarnrc.yml

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>

* chore: use workspace protocol for eslint packages in the root

Co-Authored-By: merceyz <merceyz@users.noreply.github.com>

* chore: pin caniuse-lite versions

Testcases in packages/babel-preset-env/test/fixtures/debug/browserslists-defaults-not-ie
depends on specific caniuse-lite versions. We pinned the version here
so we don't have to deal with fixture different in e2e-tests
where all deps will be updated and tested.

* chore: resolve yarn install warnings

* chore: update yarn cache path on circle/travis

* chore: add yarn deduplicate plugin

* chore: deduplicate lock files

* chore: move devDependencies to leaf packages

* chore: remove @yarnpkg/plugin-constraints

* chore: remove unused dedupe options

* test: fix unwanted self reference

* chore: remove output-file-sync dependency

* chore: update browserify to 16.5.2

Co-authored-by: Kristoffer K. <merceyz@users.noreply.github.com>
2020-08-25 14:37:30 -04:00
Brian Ng
941f610275
Set generator to true during error recovery of accessor (#11987) 2020-08-21 14:37:52 -05:00
Huáng Jùnliàng
90b1989569 v7.11.4 2020-08-20 14:51:38 -04:00
Brian Ng
84ea6e4501
Throw error on invalid flow async generic arrow syntax (#11979) 2020-08-19 16:11:17 -05:00
Brian Ng
96cc8292b7
Fix parsing type casted generic flow arrow exprs (#11955) 2020-08-19 14:15:01 -05:00