-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): add "no-enum-literals" rule #315
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
feat(eslint-plugin): add "no-enum-literals" rule #315
Conversation
7da7895
to
564d479
Compare
564d479
to
3cabb56
Compare
…t-eslint into mohsen1--no-enum-literals
Make test code multiline Remove unused schema and defaultOption
004720b
to
df08d28
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.
LGTM
I wonder if a discussion about naming is needed, because I'm not sure what |
maybe would be better if it was called |
It also prevents you from using literals instead enum params |
@mohsen1 - I can see a valid test for that, but there's no invalid test. Correct me if I'm wrong - but I don't see you using the |
oh wow! how did I miss that? I'll work on it. Meanwhile, let's finalize the naming. |
even though it doesn't technically cover the |
How about |
This rule looks like to handle enums as a nominal type. (related: microsoft/TypeScript#202) Because the type system of TS is structural typing, enums are compatible with the actual types ( Now, how about EDIT: I may be misunderstanding something. 🤔 |
my only problem with using I spend a decent chunk of time poking around typescript, and I still had to look up their meanings. Maybe instead we could take a leaf out of flow's books and use the word
|
I like |
I'm still working on this. Functions and methods with overloading and all that is complicated. I also like the name |
Hi @mohsen1, thanks again for the PR, when do you think you will have chance to finalise this one? |
#308