Make WordPress Core

Opened 4 weeks ago

Closed 4 weeks ago

#65632 closed enhancement (fixed)

Update `htmlhint` to version `1.9.2`

Reported by: desrosj Owned by: wildworks
Priority: normal Milestone: 7.1
Component: External Libraries Version:
Severity: normal Keywords: has-patch has-test-info
Cc: Focuses:

Description

Version 1.9.2 of the htmlhint library is available. Core currently includes version 1.8.0.

A full list of changes can be found on GitHub: https://github.com/htmlhint/HTMLHint/compare/v1.8.0...v1.9.2.

Change History (7)

This ticket was mentioned in PR #12527 on WordPress/wordpress-develop by @desrosj.


4 weeks ago
#1

A full list of changes can be found on GitHub: https://github.com/htmlhint/HTMLHint/compare/v1.8.0...v1.9.2.

Trac ticket: Core-65632

## Use of AI Tools

None

#2 @desrosj
4 weeks ago

  • Keywords needs-testing added

#3 @luisdavid01
4 weeks ago

## Patch Testing Report

Patch tested: https://github.com/WordPress/wordpress-develop/pull/12527

### Environment

WordPress: 7.1.0
PHP: 8.3.32
Server: nginx 1.31.2
Database: mysql 9.7.1
Browser: Helium 0.14.3.1 (Official Build, Chromium 150.0.7871.46) Arch Linux (64-bit)
OS: Operating System CachyOS 7.1.3
Theme: twentytwentyfive 1.5
MU Plugins:
None
Plugins:
Hello Dolly 1.7.2
### Steps taken

  1. Run build command for testing environment "npm run build:dev"
  2. Compared editor behavior between 1.8.0 and 1.9.2 in Theme File Editor and Custom HTML widget
  3. Run unit test and e2e tests

❌ Patch is failing: Observed identical behavior in both versions but unit tests failed because Tests_Dependencies_Scripts test case tries to find htmlhint 1.8.0
### Expected result

htmlhint should be updated to 1.9.2 and PHPUnit dependency test passing.
### Additional Notes
The version string in script-loader.php still pointing to 1.8.0, i suggest changing the version expected to "1.9.2" in script-loader.php to fix the unit test error.

@wildworks commented on PR #12527:


4 weeks ago
#4

I have fixed the unit tests and resolved the conflicts.

#5 @mukesh27
4 weeks ago

@luisdavid01 Can you retest the PR as that issue is solved now.

#6 @khokansardar
4 weeks ago

  • Keywords has-test-info added; needs-testing removed

Patch testing report

Patch / PR tested

Environment

WordPress: 7.1-alpha-62161-src
PHP: 8.2.18 (Docker)
MySQL: 8.0.36
OS: macOS 26.5.2
Browser: Chromium (Chrome DevTools), desktop viewport
Local wordpress-develop @ http://localhost:8889

Steps

  1. Checked out PR branch, ran npm install (pulls htmlhint@1.9.2 from the updated lockfile).
  2. Ran npm run build:dev — the Grunt copy:codemirror task vendors node_modules/htmlhint/dist/htmlhint.min.js into src/wp-includes/js/codemirror/htmlhint.js.
  3. Confirmed the version strings in package.json and wp_default_scripts() (script-loader.php) match.
  4. Ran the dependency version PHPUnit test test_vendor_script_versions_registered_manually (the test that failed in comment:3).
  5. Ran the wp_enqueue_code_editor and Custom HTML widget PHPUnit tests.
  6. Loaded the freshly-vendored htmlhint.js in the browser and exercised HTMLHint.verify() against valid and invalid HTML.

Results

  • Library install: pass — node_modules/htmlhint reports 1.9.2; dist file present.
  • Build/vendor step: pass — src/.../codemirror/htmlhint.js header now reads HTMLHint v1.9.2, with the window.HTMLHint export shim appended as before. (This file is gitignored / build-generated, so it is correctly not part of the diff.)
  • Version consistency: pass — package.json (1.9.2) and the registered htmlhint script (1.9.2) match.
  • PHPUnit test_vendor_script_versions_registered_manually: pass — 29 tests, 87 assertions OK. This is the case that previously failed while script-loader.php still pointed at 1.8.0; it now passes.
  • PHPUnit code editor + Custom HTML widget (wp_enqueue_code_editor, wpWidgetCustomHtml): pass — 13 tests, 142 assertions OK; htmlhint still enqueued.
  • Browser linter smoke test: pass — window.HTMLHint is the linter object and verify() is a function; invalid HTML <DIV><img src="x.png"><p>hello</DIV> returns 4 messages (tagname-lowercase, alt-require, tag-pair), valid HTML returns 0.

Conclusion
PR #12527 updates htmlhint from 1.8.0 to 1.9.2 across package.json, package-lock.json, and the registered script version in wp_default_scripts(). The change is minimal and scoped to the ticket — no signature, hook, return-shape, or default-behaviour changes, and no scope creep. The vendored htmlhint.js is a gitignored build artifact regenerated from node_modules, so its absence from the diff is expected and correct. The unit-test failure reported in comment:3 is resolved now that the script version matches package.json, and the linter functions correctly under 1.9.2. Recommend commit.

#7 @wildworks
4 weeks ago

  • Owner set to wildworks
  • Resolutionfixed
  • Status newclosed

In 62750:

External Libraries: Update htmlhint to 1.9.2.

Updates the htmlhint library from version 1.8.0 to 1.9.2. The devDependencies entry in package.json and the version registered for the bundled htmlhint script in wp_default_scripts() are both bumped.

Props desrosj, khokansardar, luisdavid01, mukesh27, wildworks.
Fixes #65632.

Note: See TracTickets for help on using tickets.