WPTT / WPThemeReview

PHP_CodeSniffer rules (sniffs) to enforce WordPress theme review coding conventions
MIT License
208 stars 38 forks source link

False positive on loading stylesheet in JS file #202

Closed joyously closed 5 years ago

joyously commented 5 years ago

Two examples of jQuery code that produce an error for Stylesheets must be registered/enqueued via wp_enqueue_style

$('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link); and $('link[rel="stylesheet"]').forEach(StyleFix.link);

jrfnl commented 5 years ago

This is not an issue with the TRTCS sniffs, but a WPCS issue. It is a valid bug though.

I've send in a PR to fix this to WPCS - see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/pull/1644.

Once the PR is merged, WPCS has released a new version and TRTCS has updated the WPCS dependency to this new version, this bug will be fixed for TRTCS as well.

jrfnl commented 5 years ago

The fix was merged a while ago and will be included in the WPCS 2.1.0 release which is expected soon.

dingo-d commented 5 years ago

The WPCS 2.1.0is out, and the 0.2.0 version will have this included, so is it's safe to close this issue @jrfnl ?

jrfnl commented 5 years ago

Yes, I believe it is.