htmlhint / HTMLHint

⚙️ The static code analysis tool you need for your HTML
https://htmlhint.com
MIT License
3.08k stars 380 forks source link

Rules are silently ignored if not valid JavaScript #1035

Open thatsIch opened 2 years ago

thatsIch commented 2 years ago

Describe the bug Upon writing custom rules, we often encounter that HTMLHint does not notify us about broken rules.

To Reproduce

  1. Define a custom rule like
module.exports = HTMLHint > {

};

Expected behavior Like in https://github.com/htmlhint/HTMLHint/issues/662 it is expected, that at least some warning is shown, which rule could not be loaded.

Additional context

The result is to be expected due to catching all errors regarding rule imports and ignoring them: https://github.com/htmlhint/HTMLHint/blob/e147134aa3237273e0d1daf19e201c60e7af5a4f/src/cli/htmlhint.ts#L210

thatsIch commented 1 year ago

I saw, that #662 was fixed with https://github.com/htmlhint/HTMLHint/commit/bad68d91317d826eca0b44af8ea794a25fc3e4fe. I guess, that the solution could be pretty similar. I am unsure where to put the test-rules.

Maybe a new folder?