related-tags
Define a list of tags with a list of related tags that should be present too. The related tags can be a string or a regular expression (represented as a string between slashes /
.
Configuration
Name | Type | Description | Default |
---|---|---|---|
tags | Record<string, (string|RegExp)[]> | An object with a tag as a key, and an array of string/regular expression as a value. | {} |
Examples
Define a tag that requires another tag.
When the tag
@disabled
is present, is also required to define the tag@TICKET.PROJ-
, followed by a number (This example is useful to keep tracking issues using a ticketing system).
{
"related-tags": [
"error",
{
"tags": {
"@disabled": [
"/^@TICKET\\.PROJ-[0-9]+$/"
]
}
}
]
}
Define a tag that requires another tag from a list.
When the tag
@foo
is present, is also required to define at least one of the following tags:@bar
,@baz
o@qux
. A regular expression is used to define@bar
and@baz
, and a plain text to define@qux
.
{
"related-tags": [
"error",
{
"tags": {
"@foo": [
[
"/^@ba[rz]$/",
"@qux"
]
]
}
}
]
}