|
|
@ -710,6 +710,10 @@ function validate_export(node, scope, name) {
|
|
|
|
const binding = scope.get(name);
|
|
|
|
const binding = scope.get(name);
|
|
|
|
if (!binding) return;
|
|
|
|
if (!binding) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (binding.kind === 'prop') {
|
|
|
|
|
|
|
|
error(node, 'invalid-prop-export');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (binding.kind === 'derived') {
|
|
|
|
if (binding.kind === 'derived') {
|
|
|
|
error(node, 'invalid-derived-export');
|
|
|
|
error(node, 'invalid-derived-export');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -941,10 +945,20 @@ export const validation_runes = merge(validation, a11y_validators, {
|
|
|
|
if (node.label.name !== '$' || path.at(-1)?.type !== 'Program') return;
|
|
|
|
if (node.label.name !== '$' || path.at(-1)?.type !== 'Program') return;
|
|
|
|
error(node, 'invalid-legacy-reactive-statement');
|
|
|
|
error(node, 'invalid-legacy-reactive-statement');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ExportNamedDeclaration(node, { state }) {
|
|
|
|
ExportNamedDeclaration(node, { state, next }) {
|
|
|
|
if (node.declaration?.type !== 'VariableDeclaration') return;
|
|
|
|
if (node.declaration?.type !== 'VariableDeclaration') return;
|
|
|
|
if (node.declaration.kind !== 'let') return;
|
|
|
|
|
|
|
|
|
|
|
|
// visit children, so bindings are correctly initialised
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const declarator of node.declaration.declarations) {
|
|
|
|
|
|
|
|
for (const id of extract_identifiers(declarator.id)) {
|
|
|
|
|
|
|
|
validate_export(node, state.scope, id.name);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (state.analysis.instance.scope !== state.scope) return;
|
|
|
|
if (state.analysis.instance.scope !== state.scope) return;
|
|
|
|
|
|
|
|
if (node.declaration.kind !== 'let') return;
|
|
|
|
error(node, 'invalid-legacy-export');
|
|
|
|
error(node, 'invalid-legacy-export');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ExportSpecifier(node, { state }) {
|
|
|
|
ExportSpecifier(node, { state }) {
|
|
|
|