Conversation
|
Hi @Azurinine! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@slorber following up on this, please take a loop at the PR when you get the time! |
|
Hey, thanks for the PR I'll review this later, it's unfortunately not my top priority to review new linter rules |
Pre-flight checklist
Motivation
This PR address the concerns brought up in issue #6472, and enforces the use of @theme/IdealImage component instead of
tags.
Following feedback from @slorber in previous discussions (#8826, #11416), this rule adopts a tiered approach to minimize false positives and noise:
src={require('./img.png')}. Since the asset is explicitly required, we are certain it is a local file that would benefit from the Ideal Image optimization pipeline../img.png) or root-relative paths (/img.png). This nudges the user to optimize if the file is indeed local.https://...) and protocol-relative links (//).src={props.src}orsrc={someVariable}) to avoid annoying users in generic components.IdealImagedoes not support vector formats, these are explicitly ignored to prevent useless warnings.Test Plan
I have implemented a comprehensive test suite in
prefer-ideal-image.test.tscovering the following:.svgfiles.<img>tags usingrequire(), relative strings, and manualsrcsetimplementations.Tested locally using
yarn jest packages/docusaurus-eslint-pluginwith all cases passing.Related issues/PRs