Open BrunnerLivio opened 4 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
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
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
lighthouserc.js
: Could be done by offering TypeScript typings for the configuration which gets exported via the NPM package. Either Lighthouse CI would take care of compiling the userslighthouserc.ts
or the user then.lighthouserc.json
: From the typings, it may be possible to auto-generate a JSON schema (e.g. with YousefED/typescript-json-schema. Host the JSON schema on a public address, done. Example JSON schema file by Renovatelighthouserc.yml
: Not quite sure whether that is achievable.