MCPcopy
hub / github.com/prettier/prettier / validateImportExport

Function validateImportExport

src/language-markdown/embed.js:87–105  ·  view source on GitHub ↗
(ast, type)

Source from the content-addressed store, hash-verified

85}
86
87function validateImportExport(ast, type) {
88 const {
89 program: { body },
90 } = ast;
91
92 // https://github.com/mdx-js/mdx/blob/3430138958c9c0344ecad9d59e0d6b5d72bedae3/packages/remark-mdx/extract-imports-and-exports.js#L16
93 if (
94 body.some(
95 (node) =>
96 !(
97 node.type === "ImportDeclaration" ||
98 node.type === "ExportDefaultDeclaration" ||
99 node.type === "ExportNamedDeclaration"
100 ),
101 )
102 ) {
103 throw new Error(`Unexpected '${type}' in MDX.`);
104 }
105}
106
107export default embed;

Callers 1

embedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…