GoogleChrome / GoogleChrome/lighthouse
Add Custom ClientHints to Lighthouse config.settings
- Dominant language
- JavaScript
- Stars
- 30.8k
- Forks
- 9.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 20
Description
**Feature request summary**
I propose adding the ability to set custom clientHints in Lighthouse config.settings. By default, clientHints in Lighthouse measurement is determined by the settings.formFactor, which limits the results to Android or macOS. However, the proposed feature will allow users to obtain more diverse Lighthouse measurement results and achieve more accurate results in various environments.
(ref: https://github.com/GoogleChrome/lighthouse/blob/main/core/lib/emulation.js#L35-L47).
Thank you in advance for providing me with the opportunity to contribute directly.
**What is the motivation or use case for changing this?**
It is inconvenient that there is no option to set a specific clientHints, as we may want to obtain results for a different platform such as iOS. The proposed feature will enable users to set custom clientHints to config.settings, making it easier to obtain the desired measurement results.
**How is this beneficial to Lighthouse?**
The proposed feature will improve the accuracy of Lighthouse measurement results and make it more flexible for users to customize the measurement environment. By allowing users to set custom clientHints, Lighthouse can be used to measure websites across a wider range of platforms and devices, which will benefit developers and website owners alike.
**Proposed changes**
The proposed feature would add a new property to the config.settings object called "emulatedClientHints". This property would be an object containing the custom clientHints values. The type of custom clientHints can be an interface called EmulatedClientHints, which has four properties: platform, platformVersion, architecture, and model. Each of these properties can have a range of valid values, including 'Windows', 'Macintosh', 'Android', 'iOS', and different versions and models of each.
Thank you for considering this feature.
Contributor guide
Research direction
Read core/lib/emulation.js at lines 35-47 first, then trace how config.settings supplies the current formFactor-derived client hints. Clarify the accepted emulatedClientHints shape and its interaction with existing settings, and verify completion for custom platform, version, architecture, and model values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- devtools, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100