unused-template-option
disallow a Template option that no file in the Template references
Why
An option only takes effect where a file substitutes it as “${templateOption:name}”. One that nothing references is still presented to the user when the Template is applied, so it asks a question whose answer changes nothing — usually a leftover from a removed file or a renamed reference.
Bad
devcontainer-template.json
{
"id": "dotnet",
"version": "1.0.0",
"name": "C# (.NET)",
"options": {
"imageVariant": {
"type": "string",
"proposals": ["8.0", "9.0"],
"default": "9.0"
}
}
}
.devcontainer/devcontainer.json
{
"image": "mcr.microsoft.com/devcontainers/dotnet:9.0"
}
Good
devcontainer-template.json
{
"id": "dotnet",
"version": "1.0.0",
"name": "C# (.NET)",
"options": {
"imageVariant": {
"type": "string",
"proposals": ["8.0", "9.0"],
"default": "9.0"
}
}
}
.devcontainer/devcontainer.json
{
"image": "mcr.microsoft.com/devcontainers/dotnet:${templateOption:imageVariant}"
}