Bladeren bron

fix(code-runtime-python): suppress no-unnecessary-condition on the late-rejection settled guard

Chinesezjc 1 maand geleden
bovenliggende
commit
be0551f52f
1 gewijzigde bestanden met toevoegingen van 5 en 1 verwijderingen
  1. 5 1
      packages/code-runtime/code-runtime-python/src/index.ts

+ 5 - 1
packages/code-runtime/code-runtime-python/src/index.ts

@@ -1425,9 +1425,13 @@ export class PythonCodeRuntime extends CodeRuntime {
                 // before `sendReply` peeks at `settled`. Dropping the framed
                 // reply early spares the host heap and time for a run whose
                 // outcome is already fixed.
-                // oxlint-disable-next-line typescript/no-unnecessary-condition -- the run can settle while this binding is awaited.
+                // (oxlint block-disable so both `v8 ignore next` and the rule
+                // suppression land on the `if`: `settled` flips true mid-wait,
+                // invisible to the type-aware lint, which narrows it to false.)
+                /* oxlint-disable typescript/no-unnecessary-condition */
                 /* v8 ignore next -- a rejection arriving after settlement is not schedulable from a test. */
                 if (settled) return
+                /* oxlint-enable typescript/no-unnecessary-condition */
                 sendReply({ type: 'reply', id: message.id, ok: false, message: messageOf(error) })
               }
             })()