* refactor: simply browserslists defaults overwriting
When `hasTargets` is `false`, `targets` is always an empty object by definition, `objectToBrowserslist({})` always return `[]` therefore we can remove `objectToBrowserslist`.
* test: apply external-helpers on preset-env test fixtures
* test: add ie 6 to force all transforms in corejs 3, debug, corejs 2 fixtures
* Add ie 6 as targets for test fixtures
* 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>
* Transform initializers with ids in rest elements
Fix issue 11281. Transform parameters with default initializers that
have ids that are also in a parameter with a rest element.
Before, these parameters were not transformed.
* Add plugin-transform-parameters as dependency
* Remove outdated comment
* Use set instead of array for paramsWithRestElement
* Skip when encounter "Scope"
Previously, f({...R}, f = R => R) would be incorrectly transformed.
* Pass in loose mode option instead of false
* Address review and re-organize tests
Checking the RHS of an assignment pattern/checking the parent of
an identifier node fails on cases like "({...R}, a = f(R))" or
"({...R}, {[R.key]: a = 42})".
Also refactor tests by removing unecessary tests and
separating "should transform" from "should not transform" tests.
* Define default value for vars shadowing params
* Remove from package.json
* Only convert traverse the params if needed
This prevents this plugin from running after the destructuring
transform, which causes #11256
* Review
* Review
* Update packages/babel-plugin-transform-parameters/src/params.js [skip ci]
Co-Authored-By: Brian Ng <bng412@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
* Extract for-of iterator handling to a helper
Dis greatly recudes the code size when for-of is used multiple times across the
codebase. Also, makes it easier to read what's happening in a compiled loop.
* Unify spec and loose code
* Legacy implementation fallback
* Update tmp var name
* Updates from review and after rebase
* 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
When there is a variable declaration inside the function body, which shares its name to a referenced identifier in default parameter expression, the function body should be wrapped into iife, otherwise the binding in default parameter scope will be shadowed by function body.
* fix: strip type imports used in Enums and object types
* chore: update failing snapshot
* docs: correct TSPropertySignature comment
* fix: enum value should be considered a reference
* chore: add tests for TSPropertySignature and TSEnumMember