oxc icon indicating copy to clipboard operation
oxc copied to clipboard

linter: few incorrect fixes

Open Hideman42 opened this issue 8 months ago • 0 comments

What version of Oxlint are you using?

0.16.5

What command did you run?

oxlint --fix --fix-suggestions --quiet

What happened?

Here some diffing I've seen erroneous:

no-plus-plus => Issue with nested var

-      varA.varB++;
+      varB += 1;

no-else-return => Issue with comment & indent

       return something;
-    } else {
-      // this comment get dropped
-      return value;
     }
+      return value;

no-else-return => Issue with indent & new line

      return something;
-  } else if (isSomehtingElse) {
+  } if (isSomehtingElse) {

prefer-array-some && no-extra-boolean-cast => Did not remove the Boolean cast

-  return Boolean(items.find((item) => item.isNew));
+  return Boolean(items.some((item) => item.isNew));

unicorn/require-post-message-target-origin => MessagePort has postMessage but should not get location.origin as 2nd arg

export function getPostMessage(port: MessagePort): <T>(message: T) => void {
-  return <T>(message: T) => port.postMessage(message);
+  return <T>(message: T) => port.postMessage(message, port.location.origin);
}

Hideman42 avatar Apr 16 '25 12:04 Hideman42