disallow `import root` during validation

pull/430/head
Conduitry 8 years ago
parent 38ee4f15cf
commit f6934a1d20

@ -63,5 +63,13 @@ export default function validateJs ( validator, js ) {
validator.defaultExport = node; 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