Skip to content

Commit

Permalink
docs(plugins): update to reflect changes in 10.0 (#14322)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine committed Nov 15, 2022
1 parent 3e73cc2 commit 389e07e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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, [user flows](https://github.com/GoogleChrome/lighthouse/blob/master/docs/user-flows.md)) | The modes 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. |
Expand Down
11 changes: 6 additions & 5 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'}],

Expand All @@ -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() {
Expand Down Expand Up @@ -129,7 +129,7 @@ class CatAudit extends Audit {
}
}

module.exports = CatAudit;
export default CatAudit;
```

#### Run the plugin locally in development
Expand Down Expand Up @@ -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`

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -271,7 +272,7 @@ class HeaderPoliceAudit {
}
}

module.exports = HeaderPoliceAudit;
export default HeaderPoliceAudit;
```

## Best Practices
Expand Down

0 comments on commit 389e07e

Please sign in to comment.