-
Notifications
You must be signed in to change notification settings - Fork 63
Conversation
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.
Question here for a general consensus.
Do we want to 1 for 1 implement the tslint rule?
First:
It seems to me like the configuration is a bit ugly with arrays of arrays.
It's error-prone and unintuitive.
Would prefer something like:
{
"types": {
"String": "Use string instead", // custom error message
"Foo": null // default error message
}
}
Second:
Do we want to add a fixer to this rule?
I personally think that we should endeavour to add fixers to as many rules as possible.
Esp if the general use case for this rule is to prevent usage of a type, there's probably an alternative.
In this case we could add a config option to specify the alternate type.
@bradzacher yup, i was thinking about this, but i decided to keep interface as is in tslint, i can change it :> fixer will be nice but it will require users to specify to what they want to change it. {
"types": {
"String": "string",
"Foo": null
}
} maybe we can change interface a little that, when user is not allowed to specify message, but replace string? |
@bradzacher i updated options to follow first of your suggestions |
great work! Maybe add a third option which is an object config?
What do you think? I'm not sure - depends on our intention with this rule. If it's about forcing alternatives, then having the If it's purely for flagging, then the 3 option style is best. |
we can add support for all 3 syntaxes, it's not going to be hard, just few ifs. |
@bradzacher i added support for all 3 of them :> |
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.
two minor nits, otherwise LGTM - great work
Almost forgot - don't forget to update the root README.md! |
ba2f9c3
to
679f23d
Compare
af425a0
to
0818053
Compare
I ported this rule and tests from tslint, additionally i added some extra tests to check more cases
this rule relies on changes from #174