Closed jjarthur closed 4 years ago
This is the correct behavior. This is one of the few cases where ;
is required in JS
yup
I experience the same issue as a result of conflict between prettier-standard
and @typescript-eslint/no-extra-semi
.
I created a simplified repo which helps to reproduce the problem: https://github.com/ertrzyiks/typescript-eslint-no-semi-repro
The content of the sample.ts
file is the following:
(window.scrollY as unknown) = 123
no-extra-semi
is ok without semicolon and actually complains when it's added
prettier-standard
forces the semicolon presence
no-extra-semi
rule is right in this case, there is no other code that could possibly cause misinterpretation. The same is true for the example given by @jjarthur
The semicolon is needed only if there is any other expression before (
. You can modify the sample.ts
to have it like:
console.log('Hello world')
;(window.scrollY as unknown) = 123
Then both prettier-standard
and no-extra-semi
rule get it right - the semicolor is required.
@JCQuintas @sheerun please reconsider this as a bug
I have the following code:
prettier-standard changes this to the following:
I'm not sure where this is coming from -- is this a bug?