-
Notifications
You must be signed in to change notification settings - Fork 198
Used inquirer to prompt for properties when creating a new rule. #679
Used inquirer to prompt for properties when creating a new rule. #679
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.
Thank you for converting to prompts!
The only change that I think definitely should be - ask if rule should allow linting JS. (UPD. could be done in separate PR)
Other are suggestions and up to you.
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.
Looks great, thanks @reduckted! I tried it out locally and it works wonderfully.
No comments from me other than what IllusionMH posted, just waiting on responses/resolutions to those.
Thanks for the suggestions. I've made those extra changes. Detecting VS Code Insiders ended up being easier than I thought it would be. I've tested the generator in VS Code and Insiders, and the new files opened up in the correct instance, but it would be great if someone else could confirm it works for them just in case there's something special about my configuration that made it work. |
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.
Checked locally and it works great! 👍
Thanks for updates! No more comments from my side
Thanks @reduckted! This is very snazzy. |
PR checklist
Includes testsOverview of change:
As per #258, I've used Inquirer.js to prompt for the rule's metadata.
All metadata except for the
options
(and related properties) andcommonWeaknessEnumeration
can be specified. I figured it wasn't worth doing anything with CWE because of #611.Is there anything you'd like reviewers to focus on?
The existing generator didn't actually work, because it tried to add the new rule to the root
tslint.json
file, but that file contains comments and cannot be parsed as JSON. For now, I've removed that step, but I kinda think it's something that should still be done. I'm just not sure how to go about doing it. 😕 Any suggestions are welcome.I've also tried to be nice and open the new rule's files after they've been created. I can detect that the generator is running in the VS Code terminal by looking at the environment variables and just launch
code new_file_name.ts
to open the file in the current VS Code instance. It works for me on Windows. In theory it should work on other operating systems, but I haven't confirmed that. I'm happy to remove this feature if you don't think it's worth the trouble.