{"record":{"id":"62aed8c650f9945b","repo":"denoland/deno","slug":"prefix-linter-plugin-name-must-be-a-string","errorCode":null,"errorMessage":"${prefix}Linter plugin name must be a string","messagePattern":"(.+?)Linter plugin name must be a string","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/js/40_lint.js","lineNumber":486,"sourceCode":"  return plugins.map((plugin, i) => installPlugin(plugin, specifiers?.[i]));\n}\n\n/**\n * @param {Deno.lint.Plugin} plugin\n * @param {string} [specifier] The specifier the plugin was loaded from, if any.\n */\nfunction installPlugin(plugin, specifier) {\n  // When the plugin was loaded from a specifier (i.e. `lint.plugins` in the\n  // config), prefix validation errors with it so the user knows which plugin\n  // is misbehaving instead of getting an anonymous error.\n  const prefix = typeof specifier === \"string\"\n    ? `Failed to load lint plugin '${specifier}': `\n    : \"\";\n  if (typeof plugin !== \"object\") {\n    throw new Error(`${prefix}Linter plugin must be an object`);\n  }\n  if (typeof plugin.name !== \"string\") {\n    throw new Error(`${prefix}Linter plugin name must be a string`);\n  }\n  if (!/^[a-z-]+$/.test(plugin.name)) {\n    throw new Error(\n      `${prefix}Linter plugin name must only contain lowercase letters (a-z) or hyphens (-).`,\n    );\n  }\n  if (plugin.name.startsWith(\"-\") || plugin.name.endsWith(\"-\")) {\n    throw new Error(\n      `${prefix}Linter plugin name must start and end with a lowercase letter.`,\n    );\n  }\n  if (plugin.name.includes(\"--\")) {\n    throw new Error(\n      `${prefix}Linter plugin name must not have consequtive hyphens.`,\n    );\n  }\n  if (typeof plugin.rules !== \"object\") {\n    throw new Error(`${prefix}Linter plugin rules must be an object`);","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/js/40_lint.js#L468-L504","documentation":"While mirroring remote modules for the stock-tsc compatibility layer, `write_mirror` maps each URL to `<remote_root>/<host>/<path>` via `url_to_local_path`. That mapping returns None when the URL has no host or its path is empty/ends with `/` (a directory-like URL — no index filename can be inferred without server cooperation). Such a URL cannot be mirrored to a file, so the error names it.","triggerScenarios":"The module graph built during `deno check`/`deno sync-types` (npm-compat path) contains a remote import of a directory-style URL, e.g. `import \"https://example.com/lib/\"` or a bare-host URL, and the fetched module is about to be written into the local mirror.","commonSituations":"Code written for the web where the server redirects directory imports to an index file; hand-written imports with trailing slashes; dependencies that themselves import directories via redirects (works in deno's runtime resolution but has no filename to mirror).","solutions":["Import a concrete file URL: `import \"https://example.com/lib/mod.ts\"` instead of `https://example.com/lib/`","If the trailing-slash import is in a third-party module, use an import map to alias it to the concrete file","Vendor the dependency locally so no remote mirror path is needed"],"exampleFix":"// before\nimport { helper } from \"https://example.com/lib/\";\n// URL has no resolvable mirror path: https://example.com/lib/\n\n// after\nimport { helper } from \"https://example.com/lib/mod.ts\";","handlingStrategy":"type-guard","validationCode":"// Flag directory-like remote imports before running check/sync-types\nexport function isMirrorableUrl(specifier: string): boolean {\n  try {\n    const u = new URL(specifier);\n    return !!u.host && u.pathname !== \"\" && !u.pathname.endsWith(\"/\");\n  } catch {\n    return false;\n  }\n}","typeGuard":"function isMirrorableUrl(url: string): boolean {\n  const u = new URL(url);\n  return u.host.length > 0 && u.pathname.length > 0 && !u.pathname.endsWith(\"/\");\n}","tryCatchPattern":null,"preventionTips":["Always import concrete files (`.../mod.ts`), never directory URLs with trailing slashes","Use an import map to alias bare directory URLs to concrete file URLs","Run a quick lint over imports (grep for `from \"https?://[^\"]*/\"`) in CI"],"tags":["url","mirror","module-resolution","typescript","npm-compat"],"backgroundTag":"url-to-path-conversion-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}