Skip to content

HtmlValidate doesn't use any default rules

I'm not sure if this is a bug or if it's the intended way and I'm just lazy.

When using HtmlValidate directly it doesn't seem to use any default rules. I think it would make sense to have it use the same default rules when using the API as the CLI.

Reduced test-case

Show the smallest possible markup that fails.

const htmlValidator = new HtmlValidate();
const validationResult = htmlValidator.validateString('<button>A Button</button>');
console.log(validationResult);

Expected result

When using the CLI I get the following result:

❯ html-validate button.html

button.html
  1:1  error  Button is missing type attribute  button-type

✖ 1 problem (1 error, 0 warnings)

Actual result

When using the API I get the following result:

{
  "valid": true,
  "results": []
}