htmlhint / HTMLHint

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

Print relative paths in error reports (including console) #1373

Open hyperupcall opened 9 months ago

hyperupcall commented 9 months ago

Is your feature request related to a problem? Please describe.

When printing hinting violations, it prints the absolute path of the HTML file:

/storage/ur/storage_home/Docs/Programming/Repositories/fox-forks/HTMLHint/test/cli/formatters/example.html
      L8 |  <div bad='' bad=''></div>
                ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)
      L8 |  <div bad='' bad=''></div>
                       ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)
      L8 |  <div bad='' bad=''></div>
                       ^ Duplicate of attribute name [ bad ] was found. (attr-no-duplication)
      L9 |  <div bad='' bad=''></div>
                ^ The value of attribute [ bad ] must be in double quotes. (attr-value-double-quotes)

Describe the solution you'd like

Both ESLint and Prettier print relative file paths. Relative file paths make it significantly easier to parse the error message and know exactly what file violated a linting rule. This compounds when file paths are long.

Describe alternatives you've considered

Using absolute paths

Additional context Add any other context or screenshots about the feature request here.