ni / javascript-styleguide

JavaScript and TypeScript Style Guide
MIT License
9 stars 9 forks source link

Don't enforce naming convention for HTMLElementNameTagMap #111

Closed jattasNI closed 1 year ago

jattasNI commented 1 year ago

Defining an HTMLElementTagNameMap interface is common in TypeScript libraries that define elements so that querySelector can return a typed element when you select by the element name. With our current ruleset you have to suppress @typescript-eslint/naming-convention because the interface member must match the element name which is hyphen-case instead of camelCase.

declare global {
    interface HTMLElementTagNameMap {
        // eslint-disable-next-line @typescript-eslint/naming-convention
        'sl-action-menu': NgElement & WithProperties<SlActionMenuComponent>;
    }
}

We can probably improve this by using one of the strategies described in Ignore properties that require quotes

This came from this PR we are updating a repo with the latest version of the styleguide and had to add a bunch of suppressions.