Command-Line Interface (CLI)
You can use HTMLHint on the command-line. For example:
npx htmlhint index.html
Use npx htmlhint --help
to print the CLI documentation.
Options
Section titled “Options”In addition to the standard options, the CLI accepts:
--color, --no-color
Section titled “--color, --no-color”Force enabling/disabling of color.
--init
Section titled “--init”Create a new HTMLHint configuration file (.htmlhintrc
) in the current directory with default rules. If a configuration file already exists, this command will exit successfully without making changes.
npx htmlhint --init
--list, -l
Section titled “--list, -l”Show all the rules available
--rules, -r
Section titled “--rules, -r”Set all of the rules available
--rulesdir, -R
Section titled “--rulesdir, -R”Load custom rules from file or folder. See the custom rules documentation for detailed information on creating and using custom rules.
# Load a single custom rule filenpx htmlhint --rulesdir ./my-custom-rule.js index.html
# Load all custom rules from a directorynpx htmlhint --rulesdir ./custom-rules/ index.html
--version, -V
Section titled “--version, -V”Show the currently installed version of HTMLHint.