13476 Commits

Author SHA1 Message Date
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
Erlend Tobiassen
740064ced7 Fix missing ClassDeclaration references after scope#crawl (#11011)
* Bug replication test

* Simplify test

* Fixes #10896

* Merge path.crawl `ClassDeclaration` and `Declaration` visitors

Merged to avoid subtle assumption that `Declaration` is called before `ClassDeclaration`

* Move registartion of class id in crawl to BlockScoped

* Add some assertions to crawl test
2020-01-19 21:32:05 -05:00
Nicolò Ribaudo
2b23c283dd
Check that generated compat-data is up to date on CI (#11024) 2020-01-20 01:42:47 +01:00
Huáng Jùnliàng
de75dbf2a0 update compat-data related docs/config [skip ci] (#11030)
* ignore compat-data build

* ignore CONTRIBUTING.md when publishing preset-env

* docs: update preset-env CONTRIBUTING.md
2020-01-20 01:00:38 +01: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
Benoît Zugmeyer
85ddc297c2 Fix rest parameters indexing with TypeScript 'this parameter' (#9714)
* Fix rest parameters indexing with TypeScript 'this parameter'

The TypeScript [this parameter][0] is a fake parameter and should not be
taken into account when counting the function parameters.  This patch
skips it by using the condition taken from the `transform-typescript`
plugin.

Note: since the `transform-typescript` plugin is removing this kind of
parameter, including it before the `transform-parameters` plugin solves
the issue.  This patch fixes the issue in other cases.

[0]: https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters

* nit: improve the 'this parameter' detection condition

* improve performance by checking the parameter list length before
accessing it
* simplify the test a bit by using the `isIdentifier` second
parameter
2020-01-17 21:00:37 +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
1a1454328b
chore: replace yarn-upgrade by bump-babel-dependencies in e2e tests (#11021)
* chore: pin yarn version in e2e vue tests

* fix: replace yarn-upgrade by bump-babel-dependencies

* chore: update e2e-cra test
2020-01-17 07:55:29 -05:00
Huáng Jùnliàng
06dace1cdb fix: for-of transform should skip for-await-of (#11023) 2020-01-17 00:15:31 +01:00
Nicolò Ribaudo
3daab41e61 Re-generate preset-env fixtures (#11016)
* Fix plugin ordering in preset-env

* Update stdout fixtures

* Comments [skip ci]
2020-01-16 10:49:30 -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
Nicolò Ribaudo
6363b594cc Re-generate plugins compat data
They are now alphabetically ordered, but the data is the same
2020-01-16 01:45:02 +01:00
Nicolò Ribaudo
d75652eb5e
Exclude import() tests from pubilsh build (#10995)
I really don't like this commit, but import() is currently breaking
our publish script.
When "normal" tests we are transpiling import() so that it works
with Jest. We can't do it while publishing because we need to
publish the untranspiled import() so that it can load real .mjs files.

Follow up to #10903
2020-01-15 23:38:18 +01:00
Siddhant N Trivedi
6ad7e19a27 Fix parentheses removal in nullish-coalescing operation (#11014)
* Added precedence for nullish-coalescing-operator

* Made precedence equal to logical OR

* Renamed the folders made for testing

* Fixed the output test file of nullish-coalescing op
2020-01-15 23:30:28 +01:00
Huáng Jùnliàng
e7961a08a8
fix: supply ‘.’ subpath for node.js < 13.2 (#11006) 2020-01-14 22:54:41 -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
Huáng Jùnliàng
a0a9c64a47
chore: test against babel-preset-app (#11004) 2020-01-13 18:30:37 -05:00
Babel Bot
b138b5a62e Add v7.8.3 to CHANGELOG.md [skip ci] 2020-01-13 21:44:41 +00:00
Nicolò Ribaudo
a7620bd266 v7.8.3 2020-01-13 22:36:19 +01:00
Huáng Jùnliàng
6874c244ab fix: generated builder parameter should respect builder keys (#11002) 2020-01-13 22:30:24 +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
d0a8982c12 Ignore .map files in standalone packages (#10994) 2020-01-12 19:43:10 -05:00
Nicolò Ribaudo
a677d59a63
Archive syntax plugins enabled by default (#10820)
* Remove syntax plugins enabled by default

Moved to babel-archive: babel/babel-archive@8f23ddce03

- `@babel/plugin-syntax-async-generators`
- `@babel/plugin-syntax-bigint`
- `@babel/plugin-syntax-dynamic-import`
- `@babel/plugin-syntax-json-strings`
- `@babel/plugin-syntax-nullish-coalescing-operator`
- `@babel/plugin-syntax-object-rest-spread`
- `@babel/plugin-syntax-optional-catch-binding`
- `@babel/plugin-syntax-optional-chaining`

* Fix build script

* Fix jest config

* Remove archived plugins from tests
2020-01-13 00:31:48 +01:00
Babel Bot
c7f7f9b8b5 Add v7.8.2 to CHANGELOG.md [skip ci] 2020-01-12 22:50:23 +00:00
Nicolò Ribaudo
61d01f1114 v7.8.2 2020-01-12 23:44:39 +01:00
Haoqun Jiang
f995f8e02c fix: isPluginRequired returns the opposite result in v7.8.0 (#10992) 2020-01-12 23:43:03 +01:00
Babel Bot
2ccc451e96 Add v7.8.1 to CHANGELOG.md [skip ci] 2020-01-12 13:04:04 +00:00
Nicolò Ribaudo
575eeb370e v7.8.1 2020-01-12 13:58:53 +01:00
Nicolò Ribaudo
27668377b5
Downgrade semver for compatibility with Node 6 (#10991) 2020-01-12 13:56:09 +01:00
Nicolò Ribaudo
d1c93e7e3e
Remove ESLint packages from the changelog
They are not published
2020-01-12 01:54:11 +01:00
Babel Bot
9647560dd6 Add v7.8.0 to CHANGELOG.md [skip ci] 2020-01-12 00:27:36 +00:00
Nicolò Ribaudo
2486615a74 v7.8.0 2020-01-12 01:09:29 +01:00
Kai Cataldo
d8e6219ad9 @babel/eslint-plugin: Update rules/tests to use @babel/eslint-parser (#10977)
* Use @babel/eslint-parser for tests

* Update rules/tests

* Update docs

* add @babel/eslint-shared-fixtures to package.json

* remove bug fix

* convert RuleTester to ESM

* Update devDep versions
2020-01-11 20:42:21 +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
Nicolò Ribaudo
e7b80a2cb9
Improve @babel/types with env.BABEL_TYPES_8_BREAKING (#10917)
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
2020-01-11 10:34:30 +01:00
Huáng Jùnliàng
405c1aaad8 Merge env-standalone to babel-standalone (#10821)
* feat: add babel-preset-env to babel-standalone

* chore: copy preset-env-standalone test

* polish: tune warning message when babel-preset-env-standalone is loaded
2020-01-11 10:31:29 +01:00
Huáng Jùnliàng
a1310333f7 chore: update corejs fixtures (#10983) 2020-01-11 09:23:58 +01:00
Huáng Jùnliàng
903ad6160d
Filename detection should respect short flags (#10763)
* chore: add test files

# Conflicts:
#	packages/babel-node/package.json

* fix: respect short flags when finding filename index

* fix: use attributeName for kebab-case
2020-01-10 20:46:19 -05:00
Anders Kaseorg
5a3e97073e CONTRIBUTING: Update link to plugin-features.js [skip ci] (#10982)
It was moved in #10899.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2020-01-10 20:43:10 -05:00
Yordis Prieto
4c28f54152 Add babelrc.json support (#10783)
* Add babelrc.json support

* Add tests

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-01-10 23:41:42 +01:00
Nicolò Ribaudo
ae06baf22f
Add support for babel.config.mjs and .babelrc.mjs (#10903)
* Add support for babel.config.mjs and .babelrc.mjs

* Use path.extname
2020-01-10 23:14:29 +01:00
Nicolò Ribaudo
282f81bd67
Prepare @babel/core for asynchronicity (#10507)
* Prepare @babel/core for asynchronicity

* Include regenerator-runtime in standalone build

* Fix rollup build
2020-01-10 22:44:13 +01:00
Huáng Jùnliàng
9fec528016 Reduce false negative cases of typescript parser tests (#10979)
* tests: read baesline errors for typescript parsing error

* chore: add error codes

* chore: tune the regex
2020-01-10 22:11:10 +01:00
James Beavers
80aa7dc3c6 Add optional-chaining and nullish-coalescing to preset-env (#10811)
* Add support for optional-chaining (stage 4) in present-env

* revert babel-preset-env built-in-modules.json

* add shipped proposal syntax map entry, optional chaining

* update remaining syntax plugin references, proposal description

* Add support for nullish coalescing operator in preset-env

* selectively enable sort-keys rule

* enforce sort-keys on shipped-proposals

* don't use Object.entries()

* Update fixtures
2020-01-10 22:07:43 +01:00
Kai Cataldo
4cb2148273 @babel/eslint-plugin: remove deprecated rules (#10975) 2020-01-10 20:22:39 +01:00
Siddhant N Trivedi
3dcb8ca99e Added instructions to fork the repo in order to setup. (#10973)
* Added instructions to fork the repo to setup

* Capitalized Github and Indented the guidelines

[skip ci]
2020-01-10 20:05:58 +01:00