webhintio / hint

💡 A hinting engine for the web

Home Page:https://webhint.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can webhint static code analysis be executed through a command?

dani-oropeza-nic opened this issue · comments

Hello, I'm very new to webhint. I have a quick question...

I know that there is a VSCode extension that analyses de code statically. I would like to know If I can have the same (analyses the code statically), but by executing a command. Something like .eslint, you just have to execute ng lint and it starts to analyses the code and then shows in the console the errors/warning.

Can you please clarify this to me please? If you could share help links I would be very grateful.

Hi @dani-oropeza-nic, yes there is a way to use webhint from the command line by installing and using the hint npm package. You can also try it out easily by typing npx hint https://mywebsite.com on the command line.
There is some documentation here: https://webhint.io/docs/user-guide/
And the npm package can be found here: https://www.npmjs.com/package/hint

Hope this helps! I'll close this issue for now, but please do feel free to reply if you need anything else.

Thank you @captainbrosset for your response.

When running the command npx hint something.html, this error message is displayed in the console.

image

However, when adding local configuration, It seems that It is not checking the files correctly because something.html has accessibility errors.

image

Can you please give me a hand with this?

These are my dependencies

image

Another clue: when I remove the .hintrc file and then I execute this command npx hint something.html. It does check against the default rules.

image