-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional static enum lint #36759
Conversation
Hey @erwinmombay! These files were changed:
|
290a5da
to
56e8ceb
Compare
232175b
to
f98ebb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this is not worth disabling for build-system
. In fact, build-system should likely never use @enum
since it isn't compiled and therefore the annotation has no meaning
build-system/eslint-rules/enums.js
Outdated
if (callee.type === 'Identifier') { | ||
const {name} = callee; | ||
if ( | ||
name === 'isEnumValue' // || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either:
- a) remove comments? same for lower down ones
- b) add a TODO line w/ a small explanation of why this is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buid-system/
uses the funky Closure dialect of Typescript, so they do have @enums
that are named FOO_ENUM
and will not pass the linter. So I disabled.
build-system/eslint-rules/enums.js
Outdated
if (callee.type === 'Identifier') { | ||
const {name} = callee; | ||
if ( | ||
name === 'isEnumValue' // || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This adds an optional enum linter that ensures that an enum is only used in a statically DCE-able way. Enums opt-into this behavior by using the
_Enum
suffix in their name.Depends on #36755
Partial for #36754