Based off the third example in the rule's documentation under Ignore properties that require quotes, I am using a regex to match properties that follow the lower-hyphen-case naming convention of custom elements, and turning off format checks for properties that match.
Testing
Locally tried these cases with the results described in the comments.
declare global {
interface HTMLElementTagNameMap {
'valid-custom-element': NI; // passes because of new configuration
'valid-custom-element2': NI; // passes because of new configuration
'2invalid-custom-element': NI; // fails because custom-element regex requires starting with a-z
'nohyphen': NI; // passes because camelCase (with no capitals) is allowed by original configuration
'noHyphen': NI; // passes because camelCase is allowed by original configuration
camelCase: NI; // passes because camelCase is allowed by original configuration
'Capital-Custom-Element': NI; // fails because PascalCase is disallowed by original configuration and new regex only matches lower case
'capital-Custom-Element': NI; // fails because PascalCase is disallowed by original configuration and new regex only matches lower case
PascalCase: NI; // fails because PascalCase is disallowed by original configuration
}
}
Also did some testing in nimble and SystemLinkShared with locally built packages. This allows us to get rid of a global suppression in nimble and only add one inline suppression. It doesn't really help with SystemLinkShared because the one place that uses this pattern is an older library that has a custom naming-convention configuration so the one from the styleguide doesn't apply. However we should be able to copy the same pattern from this PR into that custom configuration.
Justification
Fixes #111.
Implementation
Based off the third example in the rule's documentation under Ignore properties that require quotes, I am using a regex to match properties that follow the lower-hyphen-case naming convention of custom elements, and turning off format checks for properties that match.
Testing
Locally tried these cases with the results described in the comments.
Also did some testing in nimble and SystemLinkShared with locally built packages. This allows us to get rid of a global suppression in nimble and only add one inline suppression. It doesn't really help with SystemLinkShared because the one place that uses this pattern is an older library that has a custom
naming-convention
configuration so the one from the styleguide doesn't apply. However we should be able to copy the same pattern from this PR into that custom configuration.