-
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(fr): add audit mode filter #12649
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.
nice work!
* @return {LH.Config.FRConfig['audits']} | ||
*/ | ||
function filterAuditsByAvailableArtifacts(audits, availableArtifacts) { | ||
function filterAudits(audits, availableArtifacts, mode) { |
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.
separate function filterAuditsByGatherMode
? the BySomeVerboseSingleThing
was intentional for clarity :)
My lessons from the way config evolved the past 5 years and how important these files are was to be as excessively clear as possible in v2 ;)
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 tried filterAuditsByGatherModeAndAvailableArtifacts
but that was too long. I'm ok excluding one of the filters from the name if you are though.
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.
Now that I think about it filterAuditsByAvailableArtifacts
makes more sense because we will filtering by artifacts most of the time.
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.
WDYT about two functions?
filterAuditsByAvailableArtifacts
filterAuditsByGatherMode
filterCategories
invokes both of them in sequence
types/audit.d.ts
Outdated
@@ -57,6 +57,8 @@ declare global { | |||
__internalOptionalArtifacts?: Array<keyof Artifacts>; | |||
/** A string identifying how the score should be interpreted for display. */ | |||
scoreDisplayMode?: Audit.ScoreDisplayMode; | |||
/** A list of gather modes that this audit is applicable to. */ | |||
applicableModes?: Gatherer.GatherMode[], |
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.
WDYT about matching supportedModes
? was the use of applicable
instead an intentional differentiator?
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.
It was different intentionally to avoid mismatch with gatherers. supportedModes
does make sense though so I'm fine going back.
Feels like a solid v9 breaking change to make :) |
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!
Co-authored-by: Patrick Hulce <[email protected]>
Implementation of our ideas in #12595 (comment)
This feels good to me, but I would be receptive to making
applicableModes
required for two reasons: