From 7757acd8d2e2b9fc9297cae303c78ca9980862a7 Mon Sep 17 00:00:00 2001 From: filip-savic-bm <127976793+filip-savic-bm@users.noreply.github.com> Date: Wed, 1 May 2024 00:08:02 +0800 Subject: [PATCH] Programatic use of linter - Update README.md Adds programatic use of linter in JavaScript code. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index f8b8394a4..28282bce4 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,13 @@ $ ./node_modules/.bin/htmlhint www/index.html $ ./node_modules/.bin/htmlhint www/**/*.html ``` +Or, you can use HTMLHint linter programatically, like this: +``` +import { HTMLHint } from 'htmlhint'; +const htmlVerificationHints = HTMLHint.verify(localHtmlContent); +console.log('htmlVerificationHints', htmlVerificationHints); // this logs a list of `Hint`s which contain information on all linting errors +``` + ### Global Installation and Usage If you want to make HTMLHint available to tools that run across all of your projects, you can install HTMLHint globally using npm: