Link Search Menu Expand Document (external link)

Description

This rule enforces a consistent naming convention for keys in NBT compound tags and NBT paths.

This linter only checks the naming in the following cases:

  • This is a key definition in an nbtdoc compound definition block that is outside of the ::minecraft module;

  • This is a key used in an NBT compound tag that doesn’t have an associated nbtdoc definition; OR

  • This is a key used in an NBT path that doesn’t have an associated nbtdoc definition.

JSON Format

  • (string) A regex specifying the pattern of the name. The name will be considered valid if any part of it matches the regex, so use ^ and $ if you want the full name to be tested.

Example 1. Snake case
Config
{
	"lint": {
		"nameOfNbtKey": "^[a-z]+(_[a-z]+)*$"
	}
}
👍 Good
give @s stone{foo: true}
give @s stone{foo_bar: true}
👎 Bad
give @s stone{FooBar: true}

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": {
		"nameOfNbtKey": ["error", <value>]
	}
}

To Disable

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

Config
{
	"lint": {
		"nameOfNbtKey": null
	}
}