Open Dschungelabenteuer opened 1 year ago
This is fantastic @Dschungelabenteuer ! I made a few tweaks and added a few more test cases which we need to support. Can you take a look?
@yannbf It looks good to me, should I go green? I'll work something out :)
Sorry for being that long to address these cases @yannbf, I've been a bit busy lately!
While taking a look at some other issues (including #28 and #67 you mentioned on Discord), I ended up being a bit more ambitious than just addressing the original issue and its test cases.
I definitely wanted to have a generic, easy and re-usable way of restricting validation logic to stories and their properties. I came up with some wrapper function which abstracts the whole process of "figuring out whether we're in a Story context" and exposes a very simple API to get stories and story properties. You can even filter them, which can come handy as illustrated by the use-string-literal-names
rule, which specifically targets both name
and storyName
properties. A few notes:
parameters
property of a Story.I believe this could make writing new rules much easier, and bring in a bit of confidence about what's going on under the hood. The rule I've wrote to address the original issue now just holds in <50 LOC! However, I could not come up with any good approach on how to unit test the wrapper, which kind of upsets me!
I'd love to get your insight!
Issue: #111
What Changed
Documentation and any plain english content may need to be rephrased.
Checklist
Check the ones applicable to your change:
yarn update-all
Change Type
Indicate the type of change your pull request is:
maintenance
documentation
patch
minor
major