Configuring webhint
User guide
- Getting Started
Concepts
Configuring webhint
Connectors
Development flow integration
Formatters
Hints
- AMP HTML validator
- Avoid CSS limits
- Avoid HTTP redirects
- aXe accessibility check
- Babel configuration hint set
- Compatibility of CSS, HTML and JavaScript features
- Correct `Content-Type` header
- Correct manifest extension
- Correct viewport
- Disallowed HTTP headers
- External links disown opener
- Has web app manifest
- Highest document mode
- HTTP cache
- Manifest has name
- Minify JavaScript
- Modern DOCTYPE
- No `P3P` headers
- No broken links
- No byte-order mark
- No protocol-relative URLs
- No small error pages
- No vulnerable libraries
- Nu HTML test
- Optimal compression
- Optimize images
- Performance budget
- Prefixed CSS first
- Specify button type
- SSL server test
- TypeScript configuration hints set
- Unneeded HTTP headers
- Use `Strict-Transport-Security` header
- Use `X-Content-Type-Options` header
- Use Apple touch icon
- Use charset `utf-8`
- Use HTTPS
- Use subresource integrity
- Valid `Set-Cookie` header
- Valid `theme-color`
- Valid manifest
- webpack configuration hints set
Parsers
Server configurations
Telemetry
Troubleshoot
- Concepts
- Configuring webhint
- Connectors
- Development flow integration
- Formatters
- Hints
- Parsers
- Server configurations
- Telemetry
- Troubleshoot
Configuring webhint
There are 2 ways in which you can configure webhint
:
- Via a
.hintrc
file. - Adding a
hintConfig
property in yourpackage.json
.
To create a basic .hintrc
file you can use the following command:
npm create hintrc |
If webhint
cannot find a (valid) configuration, it will use a default
one and warn you about it.
In both cases, the format used is the same. The following is an example
for a .hintrc
:
{ |
And for a package.json
:
{ |
The main things you can configure are:
connector
: how to access the resources.formatter
s: how to output the results.parser
s: how to handle special files like stylesheets, JavaScript, manifest, etc.hint
s: what to test for and theseverity
it should have.
The severity
of a hint
can be:
off
: Thehint
will not be run. This is the same as deleting it from the.hintrc
.warning
: If thehint
finds any issue it will be reported but the exit code will be0
.error
: If thehint
finds any issue it will be reported and the exit code will be1
.
webhint
allows you to configure it in many different ways. Please
check the other entires under Configuring webhint and the main page
for each package to have more details.