{"record":{"id":"325d5a6d74b61653","repo":"zellij-org/zellij","slug":"unrecognised-import-syntax-at","errorCode":null,"errorMessage":"unrecognised import syntax at {}","messagePattern":"unrecognised import syntax at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/assets.rs","lineNumber":174,"sourceCode":"        if line.contains(\"import(\") {\n            return Err(anyhow!(\"dynamic import is not supported at {}\", location()));\n        }\n\n        if let Some(rest) = line.strip_prefix(\"import \") {\n            if is_terminated_import(rest) {\n                validate_module_specifier(rest, &location())?;\n                continue;\n            }\n            let mut terminated = false;\n            for (_, continuation) in lines.by_ref() {\n                let trimmed = continuation.trim_start();\n                if trimmed.starts_with(\"} from \") && trimmed.ends_with(';') {\n                    validate_module_specifier(trimmed, &location())?;\n                    terminated = true;\n                    break;\n                }\n                if !is_import_binding_line(trimmed) {\n                    return Err(anyhow!(\"unrecognised import syntax at {}\", location()));\n                }\n            }\n            if !terminated {\n                return Err(anyhow!(\"unterminated import statement at {}\", location()));\n            }\n            continue;\n        }\n\n        if line.starts_with(\"export \") || line.starts_with(\"export{\") {\n            if line.starts_with(\"export {\") {\n                if line.contains(\" from \") {\n                    validate_module_specifier(line, &location())?;\n                    continue;\n                }\n                return Err(anyhow!(\"unrecognised export syntax at {}\", location()));\n            }\n            if line.starts_with(\"export default\") || line.starts_with(\"export *\") {\n                return Err(anyhow!(\"unsupported export form at {}\", location()));","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/zellij-org/zellij/blob/98a0837077492d53dd252ab30bc3e43e41e504f4/xtask/src/assets.rs#L156-L192","documentation":"Raised while flattening a multi-line import: after a line starting with `import ` that is not a terminated single-line import, every continuation line must be a plain binding list (only [A-Za-z0-9_$ ,] characters) until a line starting with `} from ` and ending with `;`. Any other continuation line is rejected as unrecognised syntax.","triggerScenarios":"A multi-line import with a default binding (`import d, {`), a comment inside the binding block, `as` aliasing with unusual characters, or a closing line like `}from './x.js'` (missing space after `}` or missing trailing semicolon).","commonSituations":"Copy-pasted prettier-formatted imports containing aliases or comments; hand-edited import blocks; minified imports without spaces; merge-conflict residue inside imports.","solutions":["Collapse the import to a single line: `import { a, b } from './utils.js';`","Keep multi-line imports to plain comma-separated names, with the closing line exactly `} from './name.js';` (space after `}`, trailing semicolon)","Remove comments and aliases from import blocks"],"exampleFix":"// before (rejected)\nimport {\n  // core helpers\n  a as alpha,\n} from './utils.js'\n\n// after\nimport { a } from './utils.js';","handlingStrategy":"validation","validationCode":"# reject multi-line imports that are not plain binding lists\nawk '/^import / && !/;$/ {in_import=1; next} in_import {\n  if ($0 !~ /^[[:space:]]*[A-Za-z0-9_$ ,]+[[:space:]]*$/ && $0 !~ /^[[:space:]]*} from \\.\\/.*\\.js;$/) {\n    print FILENAME \":\" NR \": suspicious import continuation: \" $0\n  }\n  /;$/ {in_import=0}\n}' zellij-client/assets/*.js","typeGuard":"fn is_import_binding_line(line: &str) -> bool {\n    line.trim_end_matches(',')\n        .chars()\n        .all(|c| c.is_alphanumeric() || c == '_' || c == '$' || c == ' ')\n}","tryCatchPattern":null,"preventionTips":["Prefer single-line imports in these modules; the flattener is line-based","No aliases, comments, or default bindings inside import blocks","After editing imports, run `cargo xtask assets` — it fails fast with a file:line location"],"tags":["javascript","bundler","parser","import","assets"],"backgroundTag":null,"analyzedSha":"98a0837077492d53dd252ab30bc3e43e41e504f4","analyzedAt":"2026-08-16T13:02:01.396Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}