Generalise the no-restricted-syntax rule from the literal pdfjs-dist selector (added in #535) to also catch the underlying mechanism named in ADR-012 / #553: any `vi.mock(..., async () => { ... await import(...) ... })` produces a late birpc roundtrip during worker teardown. Selector: vi.mock CallExpression whose second argument is an ArrowFunctionExpression with async=true and whose subtree contains an AwaitExpression > ImportExpression. Both rules coexist — the literal pdfjs-dist rule still enforces the libLoader prop injection pattern (catches sync forms too); the new rule enforces the sync-factory invariant universally. Demonstrated by planting a synthetic offender locally and watching ESLint flag it with the new rule's message. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6.7 KiB
6.7 KiB