fix(rule): add check node to the check result object #2608
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was more difficult than I had hoped. The functions all mutate the original results through various passes, which meant that I couldn't return a new object as the final filter of
item.filtered === true
had to run on the originalresult.nodes
. I'm not a fan of how we're doing it, but it would take a huge refactor to get it to work differently, and an even bigger understanding of why we are doing what we are doing.I then tried to just add the
node
object directly to the check result, but that resulted in the finalresults
object that axe returns having the node property for every check result. This wasn't ideal and frankly not needed as the parent check object has the node in question.So to get everything to work, I added the node to the object and then deleted it after we didn't need it any more. Is it a good solution? No. But I think it's probably the best we can do unless we want to refactor the entire function (which I would need some understanding first).
Allows us to work on #728 and #2330
Reviewer checks
Required fields, to be filled out by PR reviewer(s)