htmlhint / HTMLHint

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

refactor: Convert most CommonJS-style import/exports to ESM #1368

Closed hyperupcall closed 7 months ago

hyperupcall commented 9 months ago

Short description of what this resolves:

Mixed import/export style makes things a bit more difficult to read because they have mixed semantics. Additionally, the "module style" is compiled down to CommonJS anyways, so there is no practical difference.

This also simplifies the unecessary verbosity of the type imports and require near the top of htmlhint.ts, since we do away with those CommonJS imports.

Proposed changes:

This converts all CommonJS modules in src/ that are able to be convered to static ECMAScript imports (no dynamic import).

codecov[bot] commented 9 months ago

Codecov Report

Merging #1368 (dcf405e) into master (22c5716) will not change coverage. Report is 4 commits behind head on master. The diff coverage is n/a.

:exclamation: Current head dcf405e differs from pull request most recent head 6c67a0a. Consider uploading reports for the commit 6c67a0a to get more accurate results

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/htmlhint/HTMLHint/pull/1368/graphs/tree.svg?width=650&height=150&src=pr&token=S8oI6yuz12&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=htmlhint)](https://app.codecov.io/gh/htmlhint/HTMLHint/pull/1368?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=htmlhint) ```diff @@ Coverage Diff @@ ## master #1368 +/- ## ======================================= Coverage 99.07% 99.07% ======================================= Files 2 2 Lines 1627 1627 Branches 332 332 ======================================= Hits 1612 1612 Misses 15 15 ``` ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/htmlhint/HTMLHint/pull/1368?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=htmlhint). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=htmlhint) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/htmlhint/HTMLHint/pull/1368?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=htmlhint). Last update [21022c6...6c67a0a](https://app.codecov.io/gh/htmlhint/HTMLHint/pull/1368?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=htmlhint). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=htmlhint).