language js

private pattern js_module_reference() {
  or {
    JsImport(),
    JsImportCallExpression()
  }
}

js_module_reference() as $stmt where {
  $stmt <: contains `$source` where { $source <: r"^[\"']\.\./[^/\"']+[\"']$" },
  register_diagnostic(span=$stmt, message="App-server subfolders must not import sibling root modules; move the dependency into a responsibility subfolder.", severity="error")
}
