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

fix estree plugin type declaration #15018

Merged
merged 3 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog_unreleased/api/15018.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### Fix plugins/estree.d.ts to make it a module (#15018 by @kingyue737)

Add `export {}` in `plugins/estree.d.ts` to fix the "File is not a module" error
5 changes: 3 additions & 2 deletions scripts/build/build-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ async function buildPluginTypes({ file: { input, output } }) {
const parserNames = Object.keys(plugin.parsers ?? {});

// We only add `parsers` to types file, printers should not be used alone
// For `estree` plugin, we just write an empty file
// For `estree` plugin, we just export an empty object to ensure it treated
// as a module
const code =
parserNames.length === 0
? ""
? "export {};\n"
: outdent`
import { Parser } from "../index.js";

Expand Down