From 79d6c3ec5b1e4f655a46e393fe4ff716833d83e3 Mon Sep 17 00:00:00 2001 From: Adam Raine Date: Thu, 25 Aug 2022 17:26:59 -0700 Subject: [PATCH] docs(plugins): update to reflect changes in 10.0 --- docs/configuration.md | 1 + docs/plugins.md | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index bf6d0bf158d0..44715a38d912 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -144,6 +144,7 @@ The categories property controls how to score and organize the audit results in | -- | -- | -- | | title | `string` | The display name of the category. | | description | `string` | The displayed description of the category. | +| supportedModes | `string[]` (optional) | The lighthouse [modes](https://github.com/GoogleChrome/lighthouse/blob/master/docs/user-flows.md) supported by the category. Category will support all modes if this is not provided. | | auditRefs | `Object[]` | The audits to include in the category. | | auditRefs[$i].id | `string` | The ID of the audit to include. | | auditRefs[$i].weight | `number` | The weight of the audit in the scoring of the category. | diff --git a/docs/plugins.md b/docs/plugins.md index 327688e0723e..a07f80856720 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -75,7 +75,7 @@ This file contains the configuration for your plugin. It can be called anything **Example `plugin.js`** ```js -module.exports = { +export default { // Additional audits to run on information Lighthouse gathered. audits: [{path: 'lighthouse-plugin-cats/audits/has-cat-images.js'}], @@ -99,7 +99,7 @@ These files contain the logic that will generate results for the Lighthouse repo **Example `audits/has-cat-images.js`** ```js -const Audit = require('lighthouse').Audit; +import {Audit} = from 'lighthouse'; class CatAudit extends Audit { static get meta() { @@ -129,7 +129,7 @@ class CatAudit extends Audit { } } -module.exports = CatAudit; +export default CatAudit; ``` #### Run the plugin locally in development @@ -164,6 +164,7 @@ Defines the display strings of the plugin's category and configures audit scorin - `description: string` _OPTIONAL_ - A more detailed description of the category's purpose. - `manualDescription: string` _OPTIONAL_ - A more detailed description of all of the manual audits in a plugin. Only use this if you've added manual audits. - `auditRefs: Array<{id: string, weight: number, group?: string}>` **REQUIRED** - The list of audits to include in the plugin category along with their overall weight in the score of the plugin category. Each audit ref may optionally reference a group ID from `groups`. +- `supportedModes: string[]` _OPTIONAL_ - Which Lighthouse [modes](https://github.com/GoogleChrome/lighthouse/blob/master/docs/user-flows.md) this plugin supports. Category will support all modes if this is not provided. #### `groups` @@ -239,7 +240,7 @@ You might have noticed that a simple array of network requests is missing from t See below for an example of an audit that processes network requests. ```js -const {Audit, NetworkRecords} = require('lighthouse'); +import {Audit, NetworkRecords} from 'lighthouse'; class HeaderPoliceAudit { static get meta() { @@ -271,7 +272,7 @@ class HeaderPoliceAudit { } } -module.exports = HeaderPoliceAudit; +export default HeaderPoliceAudit; ``` ## Best Practices