-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core(noopener): use node detail type #10242
Conversation
href: anchor.href || 'Unknown', | ||
target: anchor.target || '', | ||
rel: anchor.rel || '', | ||
outerHTML: anchor.outerHTML || '', | ||
}; | ||
return item; |
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.
failingAnchors
-> items
|
||
if (node instanceof HTMLAnchorElement) { | ||
return { | ||
href: node.href, | ||
// TODO(blasingame): Deprecate text in favor of nodeLabel |
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.
6.0 is coming up, we should do this now.
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.
I'm not totally convinced we want to remove this. The purpose of including some of these properties was so that plugins could take advantage of generic information that is of common interest and untruncated text seems like something useful to surface. The alt text feature of getNodeLabel is pretty nice though.
I'd say we can resolve at a later date, but @connorjclark is right that 6.0 is imminent.
Options I see, but feel free to add:
- Add
nodeLabel
and keeptext
- Remove
text
and keepnodeLabel
- Change
text
to just be output ofgetNodeLabel
- Make truncateLength a parameter to
getNodeLabel
and use it astext
without truncation
I'm a fan of 1 and 4, personally. Thoughts anyone?
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.
yah option 1 works for me. thanks for thinking it through
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.
I've removed the TODO as option 1 is already taken care of as part of this PR.
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.
nice work @Beytoven! heads up it's gonna need a yarn update:sample-json
to fix the CI tests :)
/** Label for a column in a data table; entries will be the values of the html "rel" attribute from link in a page. */ | ||
columnRel: 'Rel', | ||
/** Label for a column in a data table; entries will be the HTML elements that failed the audit. Anchors are DOM elements that are links. */ | ||
failingAnchorsHeader: 'Failing Anchors', |
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.
nit: when text is exclusively used for a column label we tend to follow the columnNameOfThing
pattern
|
||
if (node instanceof HTMLAnchorElement) { | ||
return { | ||
href: node.href, | ||
// TODO(blasingame): Deprecate text in favor of nodeLabel |
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.
I'm not totally convinced we want to remove this. The purpose of including some of these properties was so that plugins could take advantage of generic information that is of common interest and untruncated text seems like something useful to surface. The alt text feature of getNodeLabel is pretty nice though.
I'd say we can resolve at a later date, but @connorjclark is right that 6.0 is imminent.
Options I see, but feel free to add:
- Add
nodeLabel
and keeptext
- Remove
text
and keepnodeLabel
- Change
text
to just be output ofgetNodeLabel
- Make truncateLength a parameter to
getNodeLabel
and use it astext
without truncation
I'm a fan of 1 and 4, personally. Thoughts anyone?
@@ -88,19 +84,16 @@ describe('External anchors use rel="noopener"', () => { | |||
}); | |||
assert.equal(auditResult.score, 0); | |||
assert.equal(auditResult.details.items.length, 2); | |||
assert.equal(auditResult.details.items.length, 2); | |||
assert.equal(auditResult.details.items[0].node.type, 'node'); |
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.
maybe we could get at least 1 assertion on the structure of the node value?
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.
I added the devtoolsNodePath to the AnchorElement mocks and added a couple assertions on the resulting item's node path. Not sure if this is what you meant though.
types/artifacts.d.ts
Outdated
@@ -289,6 +289,9 @@ declare global { | |||
href: string | |||
text: string | |||
target: string | |||
path: string |
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.
in scripts gatherer (one of the other "public" gatherers) we named this devtoolsNodePath
to make it clear this isn't for general use like the selector.
Rename failingAnchorsHeader to columnFailingAnchors to be in line with established pattern. Add assertions on the value of devtoolNodePath to unit tests.
…nd return it directly in map function
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! 🎉
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 🎉
BTW, I noticed you're adding some really descriptive messages for the commits here. Just so ya know, we squash all PRs and generally don't include a commit body (just the title of the PR), unless it's a rather complex change that warrants more. As long as the PR title is a well crafted commit message, that's enough. Of course, you should still be descriptive in each commit if you like. It's probably helpful for reviewers. But not 100% necessary imo. |
Yup, mostly what connor said. 👍 good call the PR title is key and it's populated from the first commit message.. personally i try to craft that one right, but you can obv make the PR title whatever before you send it out. as for all subsequent commits, yeah... often we're very lazy and use 'feedback' or 'json' or 'tests', etc. you can feel free to stay descriptive if its helpful for you. but it's true that it wont be seen in the master branch's history. ;) |
Summary
We want a better UX for viewing the noopener audit's results in devtools.
This does change the audit's result shape which is a breaking change.
Related Issues/PRs
Fixes #5110