The actual snapshot is saved in prefer-destructuring-in-parameters.js.snap
.
Generated by AVA.
1 | const foo = bar => bar[0]
Output
`␊
1 | const foo = ([firstElementOfBar]) => firstElementOfBar␊
`
Error 1/1
`␊
> 1 | const foo = bar => bar[0]␊
| ^^^^^^ `bar[0]` should be destructed in parameter `bar`.␊
`
1 | const foo = bar => bar[0] === firstElementOfBar
Output
`␊
1 | const foo = ([firstElementOfBar_]) => firstElementOfBar_ === firstElementOfBar␊
`
Error 1/1
`␊
> 1 | const foo = bar => bar[0] === firstElementOfBar␊
| ^^^^^^ `bar[0]` should be destructed in parameter `bar`.␊
`
1 | const foo = bar => bar[0b01]
Output
`␊
1 | const foo = ([, secondElementOfBar]) => secondElementOfBar␊
`
Error 1/1
`␊
> 1 | const foo = bar => bar[0b01]␊
| ^^^^^^^^^ `bar[1]` should be destructed in parameter `bar`.␊
`
1 | const foo = bar => bar.length
Output
`␊
1 | const foo = ({length}) => length␊
`
Error 1/1
`␊
> 1 | const foo = bar => bar.length␊
| ^^^^^^^^^^ `bar.length` should be destructed in parameter `bar`.␊
`
1 | const foo = bar => bar.baz
Output
`␊
1 | const foo = ({baz}) => baz␊
`
Error 1/1
`␊
> 1 | const foo = bar => bar.baz␊
| ^^^^^^^ `bar.baz` should be destructed in parameter `bar`.␊
`