This is my code:
const colors = ['red', 'green']
[colors[1], colors[0]] = [colors[0], colors[1]]
Without semicolon I recive this error:
ReferenceError: can't access lexical declaration `updatedPreviewBlocks' before initialization
With semicolon, I don't have any error
@RodrigoTomeES thank you for using Standard and reporting your issue.
This is one of the few cases where a semicolon is necessary. That's because the first [ of the second line is interpreted as an accessor to the literal array from the first line. Place a semicolon at the start of the second line:
const colors = ['red', 'green']
;[colors[1], colors[0]] = [colors[0], colors[1]]
Read about it here.