Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use worker.mts for pure ESM #496

Open
4 tasks done
JounQin opened this issue Dec 22, 2023 · 0 comments
Open
4 tasks done

feat: use worker.mts for pure ESM #496

JounQin opened this issue Dec 22, 2023 · 0 comments
Assignees
Labels
🏡 area/internal This affects the hidden internals 🦋 type/enhancement This is great to have

Comments

@JounQin
Copy link
Member

JounQin commented Dec 22, 2023

Initial checklist

Problem

A lot of await import in https://github.com/mdx-js/eslint-mdx/blob/3bdd2eb88244aeda636c11f3ccaff35ae2c05ac2/packages/eslint-mdx/src/worker.ts and the hack loadEsmModule

export const loadEsmModule = <T>(modulePath: URL | string): Promise<T> =>
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
new Function('modulePath', `return import(modulePath);`)(
modulePath,
) as Promise<T>

is unnecessary.

Solution

Just change worker.ts to pure ESM worker.mts which is just supported by synckit natively.

Alternatives

N/A

@JounQin JounQin added 🦋 type/enhancement This is great to have 🏡 area/internal This affects the hidden internals labels Dec 22, 2023
@JounQin JounQin self-assigned this Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏡 area/internal This affects the hidden internals 🦋 type/enhancement This is great to have
Development

No branches or pull requests

1 participant