As suggested by @felixarntz in https://github.com/WordPress/plugin-check/issues/443, those should use wp_get_attachment_image() etc. instead, which comes with performance benefits. The exception is img tags which aren't for attachments. For such manual img tags, the check could trigger a warning if the wp_get_loading_optimization_attributes() is not used as part of generating the output.
We could probably use the same/opposite approach as core does to to find images without the core image class (in a runtime check)
As suggested by @felixarntz in https://github.com/WordPress/plugin-check/issues/443, those should use
wp_get_attachment_image()
etc. instead, which comes with performance benefits. The exception is img tags which aren't for attachments. For such manual img tags, the check could trigger a warning if the wp_get_loading_optimization_attributes() is not used as part of generating the output.We could probably use the same/opposite approach as core does to to find images without the core image class (in a runtime check)