253 Commits

Author SHA1 Message Date
Nicolò Ribaudo
2c31587aa1
Fix createSuper in Babel <7.5.5 (#11341)
* Fix createSuper in Babel <7.5.5

In Babel <7.5.5, addHelper only throws when called for the first time.
This was fixed by babel/babel#10208, but since we are already adding
a workaround for <7.9.0, we may as well fix <7.5.5

* Use 7.0.0 in "babel-old-version" test
2020-04-02 17:52:50 +02:00
Nicolò Ribaudo
548cb3ee89
Fix e2e publish test when branching from an older version (#11347)
* Fix e2e publish test when branching from an older version

* Fix

* Fix

* Fix
2020-03-30 12:55:52 -04:00
Nicolò Ribaudo
9b976b2164
Test Babel compiled using an old version of @babel/core (#11319)
* Test Babel compiled using an old version of @babel/core

This should catch regressions where we use a new helper without a fallback
for older versions, or when we use a new @babel/traverse method.

* Enable the test
2020-03-23 22:42:40 +01: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
a0a9c64a47
chore: test against babel-preset-app (#11004) 2020-01-13 18:30:37 -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
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
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
Nicolò Ribaudo
bfc56ebbab Update Test262, Flow and TS parser tests (#10976)
* Update Test262, Flow and TS parser tests

* Updates
2020-01-10 09:50:11 -05: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
a7dac49518 chore: workaround yarn issue (#10958) 2020-01-04 11:35:24 +01:00
Huáng Jùnliàng
e5048053aa Add integration test: e2e-vue-cli (#10919)
* chore: add e2e-vue-cli test

* chore: add node-browsers-executor

* chore: state why node-browsers-executor is required
2020-01-03 23:06:13 +01:00
Huáng Jùnliàng
314513374d
chore: update test262 (#10943)
* chore: update test262

* chore: ignore untoggleable features
2019-12-29 21:35:19 -05:00
Huáng Jùnliàng
875e9619b7
chore: refine e2e test scripts (#10918) 2019-12-24 12:25:23 -05:00
Nicolò Ribaudo
4f77a5aaad
e2e test: create-react-app (#10704)
* e2e test: create-react-app

* Fix

* Fix

* Fix

* Fix
2019-12-16 22:13:23 +01:00
Huáng Jùnliàng
a0bed42aec
Bundle standalone using rollup (#10779)
* chore: bundle babel-standalone via rollup

Co-authored-by: Daniel Tschinder <daniel.tschinder@researchgate.net>

* chore: build babel-preset-env-standalone via Rollup

# Conflicts:
#	yarn.lock

* chore: add babelEnvName

* chore: farewell webpack

* chore: add terser minification

* chore: dedupe some popular dependencies

* chore: remove unused devDependencies

* chore: move plugin-babel-source to scripts/

* make prettier happy

* fix: rewrite available-plugins into esm

* chore: add extra unambiguous sources when env is rollup/standalone
2019-12-04 23:09:52 -05:00
Huáng Jùnliàng
2b472912e4
Tune makefile scripts (#10781)
* chore: replace node by `yarn node`

* chore: fix tsc command

* chore: use `yarn` to wrap node

* chore: supress yarn run output

* chore: disable silent mode for builtin yarn command
2019-12-04 22:28:25 -05:00
Nicolò Ribaudo
e74efd2c0a Run parser tests from the official TypeScript parser (#10444) 2019-12-03 01:09:54 +01:00
Nicolò Ribaudo
7195f0d8cf Unify logic for running parser tests from external suites (#10444) 2019-12-03 01:09:54 +01:00
Huáng Jùnliàng
683adcbb70 Reduce standalone build size (#10668)
* infra: build standalone against src

* infra: add absoluteRuntime

# Conflicts:
#	babel.config.js

* chore: remove `process.env` replace

* add $ to signify exact match

credits to Nicolò
2019-11-21 14:31:38 +01:00
Raja Sekar
f087cf842f Mocha to jest migration for eslint packages (#10716)
* migrated mocha to jest

* migrated mocha to jest - 2

* migrated mocha to jest - removed preversion hook from script

* migrated mocha to jest - 3

* migrated mocha to jest - 4

* cleanup

* review

* review
2019-11-16 12:32:19 +01:00
Nicolò Ribaudo
5ca8acdb38
Do not automatically publish eslint packages (#10722)
* Do not automatically publish eslint packages

* Fix

* Fix

* Fix

* Fix

* Fix
2019-11-16 11:09:18 +01:00
Nicolò Ribaudo
d56911b88d
Reorganize meta files for ESLint packages (#10714)
* Move COC and CONTRIBUTING

* Add changelog links

* Reorganize gitignore and licenses
2019-11-16 01:10:26 +01:00
Nicolò Ribaudo
f71338baf9
E2E test Babel with itself before publishing (#10569)
* Add e2e test using Babel itself

* Make checks run again
2019-11-12 23:55:36 +01:00
Nicolò Ribaudo
143d159982
Create parser plugin "topLevelAwait" (#10449)
* Create parser plugin "topLevelAwait"

* Update test262 whitelist

* Update ts typings

* Fix "sourceType: unambiguous" with TLA

* Ambiguous tokens after await

* Update await %x(0)

* typo [skip ci]

* Typo [skip ci]

Co-Authored-By: Brian Ng <bng412@gmail.com>
2019-10-29 22:18:39 +01:00
Alejandro Sánchez
06313a6288 Allow duplicate __proto__ keys in patterns, simple case (#6705) (#10532)
* Allow duplicate __proto__ keys in patterns, simple case (#6705)

* Update test262 whitelist

* Rename checkDuplicatedProto's parameter and adjust type

* Store first __proto__ redefinition's position
2019-10-15 00:18:33 +02:00
Nicolò Ribaudo
34937f13d5
Trailing comma after rest - The final fix (#10491)
* [parser] Track trailing commas in extras instead of state

* Update existing tests

* Update test262 whitelist

* Improve error message and location

* nit

* Use lookaheadCharCode
2019-10-08 23:08:50 +02:00
Nicolò Ribaudo
25b35261ca
Update test262 [skip ci] 2019-10-08 20:39:07 +02:00
Nicolò Ribaudo
a219b6de7a
Disallow await inside async arrow params (#10469)
* Disallow await inside async arrow params

* Use -1 as default for awaitPos/yieldPos
2019-10-02 07:37:40 +02:00
Huáng Jùnliàng
94fcabc4e3 Update test262 whitelist 2019-09-30 11:37:09 -04:00
Nicolò Ribaudo
d0f093e716
Update test262 whitelist 2019-09-25 02:03:58 +02:00
Gonzalo Rodríguez
490798a26d [parser] Disallow numeric separators in legacy octal like inte… (#10493)
* Disallow numeric separators in lols

* Update whitelist

* Rename test

* Better syntax when checking
2019-09-25 01:32:50 +02:00
Gonzalo Rodríguez
69d00dc5b0 [parser] Invalid NonOctal Decimal (#10467)
* Add test

* Add nonOctalDecimal verification

* Update regex and code style

* Refactor non octal detection

* Add numeric separator test

* Disallow numeric separators in non octals

* Update whitelist

* Better test naming

* Disallow numeric separators in non oct for all numbers

* Specific error above the general error

* Add test for invalid leading zero in num separator

* Add start position to error
2019-09-23 23:07:52 +02:00
Ivan Medina
f339d2d034 [parser] Disallow numeric separator in unicode scape sequences (#10468)
* [parser] Disallow numeric separator in unicode scape sequences (#10460)

* raise error only when numeric separator plugin is set

* Adds argument for checking numeric separator

* Fix condition for readability

* Add test for hex escape sequence and rephrase error message

* Remove exposure for allowNumSeparator in readHexChar method
2019-09-23 22:47:18 +02:00
Vivek Nayyar
b7333ea97a added check to disallow super.private variable access and test case added (#10472)
* 🚀 added check to disallow super.private variable access and test case added

* ♻️ change the other linting change back to how it was

* ♻️ change the other linting change back to how it was

* ♻️ added newline at the end test output.json file

* ♻️ changed the linting style to the way it was

* ♻️ updated error message, removed super private member access test cases from whitelist of flow and test 262 suite

* ♻️ added newline in output.json
2019-09-21 00:22:37 +02:00
Guy Waldman
9c1ad0a9f7 [parser] Disallow static fields named constructor (#10461)
* Disallow static fields named `constructor` in a class

    - Disallowed static fields named `constructor` in a class (previously only non-static were disallowed)
    - Updated the text for the error for one consolidated warning, for both static and non-static fields
    - Added a test
    - Updated an existing test in the `flow` test suite of the parser to reflect the parse error.
  Strangely, the test used to pass and started failing when inlining the `isNonstaticConstructor` method, without any changes.
  In that test, `constructor` was a field, so in theory it should never have passed.
  Would appreciate some feedback on this, as I'm not 100% sure if this is somehow related to Flow

* Update test262 whitelist

* Add comment and fix && operator
2019-09-18 01:19:45 +02:00
Nicolò Ribaudo
0ef4972295
Ignore regexp tests from test262 (#10458) 2019-09-18 00:14:27 +02:00
Nicolò Ribaudo
cb881e6b3f
[parser] Report escapes in kws only if they won't be used as i… (#10455)
We can do it by tokenizing escaped keywords as normal identifiers, so that they won't
be accidentally used as real keywords.
2019-09-18 00:13:51 +02:00
Nicolò Ribaudo
45a484f0a2 Enable optional chaining in test262 (#10457) 2019-09-17 12:10:57 -05:00
Nicolò Ribaudo
99f4f6c3b0
Update Test262 (#10448) 2019-09-17 02:14:14 +02:00
Huáng Jùnliàng
0ee2c42b55 chore: add lint-ts rule (#10427) 2019-09-11 20:24:08 +02:00
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