denoland/deno · error · Error
${prefix}Linter plugin name must not have consequtive hyphen
Error message
${prefix}Linter plugin name must not have consequtive hyphens. What it means
Thrown by installPlugin() in cli/js/40_lint.js (message spelled "consequtive") when the plugin name contains two or more hyphens in a row (plugin.name.includes("--")). Runs after the character-set and edge-hyphen checks, so it only fires for names that are otherwise valid.
Source
Thrown at cli/js/40_lint.js:499
: "";
if (typeof plugin !== "object") {
throw new Error(`${prefix}Linter plugin must be an object`);
}
if (typeof plugin.name !== "string") {
throw new Error(`${prefix}Linter plugin name must be a string`);
}
if (!/^[a-z-]+$/.test(plugin.name)) {
throw new Error(
`${prefix}Linter plugin name must only contain lowercase letters (a-z) or hyphens (-).`,
);
}
if (plugin.name.startsWith("-") || plugin.name.endsWith("-")) {
throw new Error(
`${prefix}Linter plugin name must start and end with a lowercase letter.`,
);
}
if (plugin.name.includes("--")) {
throw new Error(
`${prefix}Linter plugin name must not have consequtive hyphens.`,
);
}
if (typeof plugin.rules !== "object") {
throw new Error(`${prefix}Linter plugin rules must be an object`);
}
if (state.installedPlugins.has(plugin.name)) {
throw new Error(`Linter plugin ${plugin.name} has already been registered`);
}
state.plugins.push(plugin);
state.installedPlugins.add(plugin.name);
return {
name: plugin.name,
ruleNames: Object.keys(plugin.rules),
};
}
View on GitHub (pinned to 89f33cbef2)
Solutions
- Collapse consecutive hyphens into one: "my-plugin"
- If the name is generated from parts, filter out empty segments before joining
Example fix
// before
const name = [vendor, "", "plugin"].join("-"); // "my--plugin"
// after
const name = [vendor, "plugin"].filter(Boolean).join("-"); // "my-plugin" Defensive patterns
Strategy: validation
Validate before calling
function assertNoConsecutiveHyphens(name) {
if (name.includes("--")) {
throw new TypeError(`'${name}' must not contain consecutive hyphens`);
}
} Type guard
function hasNoConsecutiveHyphens(name) {
return !name.includes("--");
} Prevention
- When composing names from parts, filter empty parts before joining with '-'
- Prefer a single hardcoded literal name over string concatenation
When it happens
Trigger: A plugin `name` like "my--plugin" or "a---b"; anything produced by joining parts with hyphens where one part was empty.
Common situations: Building the name dynamically, e.g. `\`my-${scope}-plugin\`` where `scope` is an empty string; hand-editing a name and accidentally doubling the hyphen.
Related errors
- ${prefix}Linter plugin name must only contain lowercase lett
- ${prefix}Linter plugin name must start and end with a lowerc
- ${prefix}Linter plugin rules must be an object
- Linter plugin ${plugin.name} has already been registered
- Visitor "${name}" of plugin "${id}" errored
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/c5a085e9035c995c.
Report an issue: GitHub.