GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.41k stars 644 forks source link

Add type security for configuration files #346

Open BrunnerLivio opened 4 years ago

BrunnerLivio commented 4 years ago

Description

In order to improve Developer Experience, it would be nice to have type security and IntelliSense suggestions when creating a Lighthouse configuration.

Suggested Solution

jfhr commented 3 years ago

Hi, I wanted to validate my config files so I made an unofficial JSON schema file. Example use:

{
  "$schema": "https://gist.githubusercontent.com/jfhr/181123d7acc87ea329be3700d9c37594/raw/9dafefb638f8ff0660930cc48debefa1dfcd87ca/lighthouserc.schema.json",
  "ci": {

  }
}

Let me know if this helps!

It might be possible to use jsonschematypes or something similar to auto-generate TypeScript class files from the JSON schema

passbyval commented 1 month ago

If anyone is still following this, I made an updated version that is fairly exhaustive: https://github.com/passbyval/lighthouse-rc-json-schema. It includes most known chrome flags, puppeteer definitions, etc