I have installed the htmlhint
library that I can run in my command line over any HTML file like this:
npx htmlhint src/test-file.html
This lints the file and outputs some HTML errors (if any), for example:
/Users/filipsavic/Documents/Programming/BM/Raven/code/src/component-library/widgets/HtmlEditor/test.html
L1 |<html><body><div>asd <p>qw <span></span></p></div></body></html>
^ Doctype must be declared first. (doctype-first)
Scanned 1 files, found 1 errors in 1 files (5 ms)
I would like to use this library in my JavaScript/React files, something like this:
import htmlHint from 'htmlhint';
const parseRes = htmlHint('<html><body><span>some stuff...</span></body></html>');
How can I achieve this?
1