-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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(config): add dedicated ID to audit/gatherer defns #8374
Conversation
Co-Authored-By: patrickhulce <patrick.hulce@gmail.com>
can you point to the second part? looks like these share a commit so its a tad harder to review. |
} | ||
|
||
return { | ||
id: audit.id || (implementation.meta && implementation.meta.id), |
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.
this line is new
throw new Error(`${auditName} has no audit() method.`); | ||
} | ||
|
||
if (typeof id !== 'string' || !id.trim()) { |
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.
this if is new
*/ | ||
function assertValidAudit(auditDefinition) { | ||
const {id, implementation, path: auditPath} = auditDefinition; | ||
const auditName = id || auditPath || 'Unknown audit'; |
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.
these two lines at the top are new to use id
over auditPath
when available since path could now be ambiguous
const mergedItems = []; | ||
|
||
for (const item of items) { | ||
const existingItem = mergedItems.find(candidate => candidate.id === item.id); |
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.
this now uses id instead of path
yeah sorry if I would've thought about it I would commit stopped :( |
* @param {LH.Config.Json['audits']} audits | ||
* @return {?Array<{id?: string, path: string, options?: {}} | {id?: string, implementation: typeof Audit, path?: string, options?: {}}>} | ||
*/ | ||
function expandAuditShorthand(audits) { |
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.
no changes here
* @return {string} | ||
* @throws {Error} | ||
*/ | ||
function resolveModule(moduleIdentifier, configDir, category) { |
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.
no changes here
hang on for reviewing Imma split this |
this needs to be reworked given our new direction with plugins |
Summary
So blessed artifacts turned out to be quite the rabbit hole. This is part 1 of 3 stages.
<plugin-id>
. It will still be able to reference our existing core audit implementations.Related Issues/PRs
#6747