Skip to content
This repository was archived by the owner on Sep 18, 2023. It is now read-only.

Limit no-customized-built-in-elements to built ins - #39

Merged
koddsson merged 1 commit into
github:mainfrom
mbullington:built-in-elements-cross-ref
Feb 11, 2022
Merged

Limit no-customized-built-in-elements to built ins#39
koddsson merged 1 commit into
github:mainfrom
mbullington:built-in-elements-cross-ref

Conversation

@mbullington

Copy link
Copy Markdown
Contributor

Description

This PR changes no-customized-built-in-elements to only error if the extended class is a value of builtInTagMap (except HTMLElement, of course).

          node.superClass &&
          node.superClass.name !== 'HTMLElement' &&
          Object.values(builtInTagMap).includes(node.superClass.name)

The main motivation behind this work is extending a class that itself extends HTMLElement, without the complexity of static analyzing.

Alternatives

Alternatively to this PR, users could just turn this rule off, but would lose slight benefit.

We could also have an allowlist for this rule, allowedSuperNames, similar to #38

Breaking changes

This may change the actual (not expected) behavior of no-customized-built-in-elements in slight ways

…gMap

This may change the actual (not expected) behavior of no-customized-built-in-elements in slight ways

@keithamus keithamus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @koddsson thoughts?

@koddsson koddsson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! Looks great to me 👍🏻

@koddsson
koddsson merged commit 7bed82c into github:main Feb 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants