Repository navigation
Add lint rule to enforce @sealed
#11964
DayKev
started this conversation in
Rule suggestion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Similar to
noPrivateImportsfor the@public/etc JSDoc/TSDoc tags, a rule enforcing subclasses don't override methods marked as@sealedwould be nice to have. I tried searching for an equivalent ESLint rule but there doesn't appear to be one (or at least it's not easy to find).Unfortunately the TS team has repeatedly rejected adding a
sealed/final/whatever keyword, and in fact explicitly said someone should just make a lint rule if they want it, so this is the only choice to get this behavior.Since
@sealedalready exists as part of the TSDoc spec, I think it's a good choice to use as the thing to check for.A simplified example:
If possible it would be good to support mixins too, though at least for us we have very few mixins so if the added complexity would delay the rule I have no problem with it not being supported initially.
All reactions