-
Notifications
You must be signed in to change notification settings - Fork 200
Add feature to import-name rule ignoring node_modules and etc ( #541 ) #569
Conversation
…make more state for the later
…e that is currently in a validation process Add "es7" to "lib" at tsconfig.json for using Array.includes() with string[] type
- Need Help I want to write a test about ignoring node_moduels feature, but "node" object is only given at runtime. I don't know how to write a test of it.
…op and silently doesn't go into for loop. I changed it to forEach. Now It's working.
I think only a few people will actually use this rule to be this extend, but as I started adding features ended up like this. Why taking more arguments? It looks too much. About third argument About fourth argument By the way, I didn't update the readme file because of not knowing how to write version section. Here are my updates that may be used for updating readme doc.
|
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.
Thanks for this @lonyele! The rule configuration is confusing but I don't think that's anything you can fix in this PR - seems like a pre-existing structural shenanigan.
Could you please document in the rule's metadata how the options work? After this PR goes in we can file a followup issue to make them less confusing.
Don't worry about that 😊 I'll go through all the PRs before the next release and write that. |
2. Without es7 support, Array.includes doesnt work. I changed it using filter function. (This is the reason why I added es7 support) I think Array.includes() is not that 'absolutely needed' I just removed it.
1. no-any rule --> change to unknown 2. using isObject TypeGuard 3. resolve type issues by temporarily making interfaces
After changing to 'unknown' type, I got the errors even if I type guard object property. I've looked through all the types I could see on |
--> naming of previous one can be confusing.
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'll file a followup issue for cleaning up the configuration options & interfaces.
Thanks for your persistence on this @lonyele! 🚀 |
Hi, It's a follow-up PR: fixes #541
I try not to make any conflict with current structure thus I make getting more arguments for below features
First: same as before (boolean)
Second: same as before ({ [indes: tring] : string })
Third: get the array of module names that user want to ignore not replacing (string[])
Fourth: currently 'ignoreExternalModule' : true by default. It prevents from tslint outputting error by checking the path of imported module at runtime and check If it is an external module(In this case any things from ./node_modules/*
I'm a junior developer, technically I'm not even a junior developer since I haven't had a full time job yet. So please check If I've done right.