Link Search Menu Expand Document (external link)

Description

This rule specifies what actions should be done when there are undeclared symbols.

JSON Format

Either a simple Action object:

  • (object) An action to take when encounterred undeclared symbols

    • Either declare: declares the symbol at the specified scope. Allowed values: "block", "file", or "public".

    • Or report: reports a diagnostic with the specified severity. Allowed values: "inherit", "hint", "information", "warning", or "error".

Or a more Complex structure with conditions:

  • (object)

    • if: (object)

      • category: (string | string[])

      • pattern: (string | string[])

      • excludePattern: (string | string[])

      • namespace: (string | string[])

      • excludeNamespace: (string | string[])

    • then: (Action)

    • override: (Complex | Complex[])

Example 1. Example
Config
{
	"lint": {
		"undeclaredSymbol": [
			{
				"if": [
					{ "category": ["block", "entity_type", "item"], "namespace": "minecraft" },
					{ "category": ["advancement", "bossbar", "objective", "team"] },
				],
				"then": { "report": "warning" },
			},
			{
				"then": { "declare": "block" },
			},
		]
	}
}
👍 Good
tag @s add foo
👎 Bad
setblock ~ ~ ~ minecraft:foo

Severity

All diagnostics provided by this linter will be of warning severity by default. You can wrap the config value in a tuple like this to change the severity to one of error, warning, information, or hint:

Config
{
	"lint": {
		"undeclaredSymbol": ["error", <value>]
	}
}

To Disable

If you do not wish to utilize this rule, simply set it to null:

Config
{
	"lint": {
		"undeclaredSymbol": null
	}
}