* 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.
10 lines
256 B
JavaScript
10 lines
256 B
JavaScript
({...R}, a = R) => {}
|
|
({X: Y,...R}, {a = {Y}}) => {}
|
|
(a = R, {...R}) => {}
|
|
({...R}, e, c = 2, a = R, f = q) => { let q; }
|
|
({...R}, a = f(R)) => {}
|
|
({...R}, { [R.key]: a = 42 }) => {}
|
|
|
|
({...R}, {a = {R: b}}) => {}
|
|
({...R}, {a = R => R} = {b: R => R}) => {}
|