Merge pull request #430 from sveltejs/disallow-import-root

disallow `import root` during validation
pull/435/head
Rich Harris 8 years ago committed by GitHub
commit 132de5cf72

@ -63,5 +63,13 @@ export default function validateJs ( validator, js ) {
validator.defaultExport = node;
}
if ( node.type === 'ImportDeclaration' ) {
node.specifiers.forEach( specifier => {
if ( specifier.local.name === 'root' ) {
validator.error( `Imported identifiers cannot have a name of 'root' due to technical limitations`, specifier.start );
}
});
}
});
}

@ -0,0 +1,8 @@
[{
"message": "Imported identifiers cannot have a name of 'root' due to technical limitations",
"pos": 17,
"loc": {
"line": 2,
"column": 8
}
}]

@ -0,0 +1,3 @@
<script>
import root from 'foo';
</script>
Loading…
Cancel
Save