-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rule "Prefer lighter formats for image files" #46
Add rule "Prefer lighter formats for image files" #46
Conversation
Co-authored-by: Lucas Leroux <[email protected]> Co-authored-by: Vincent-Letourmy <[email protected]>
I mark this PR as Draft until decision about all PRs about the same subject :
check comment about the subject in PR green-code-initiative/creedengo-java#47 @utarwyn waiting for you point of view (and action on JS) about all this subject |
if (dotIndex === -1) { | ||
context.report({ | ||
node, | ||
messageId: "DefineFormatsForImageFiles", | ||
data: { eligibleExtensions: eligibleExtensions.join(", ") }, | ||
}); | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid any false-positive report, I propose to remove this check.
If the source filename does not have an extension, we can't know which format the file uses. Some cloud/storage services does not use extensions in URL but are sending a content-type
header instead. In this case we do not want to warn the developer because the best practice may be respected.
- https://greenspector.com/en/which-image-format-to-choose-to-reduce-its-energy-consumption-and-its-environmental-impact/[greenspector.com - Which image format choose to reduce energy consumption and environmental impact?] | ||
- https://dodonut.com/blog/use-cases-of-web-image-formats/[dodonut.com - The Most Efficient Web Image Formats. Use Cases For Different Types Of Images.] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some issues with the Markdown format here
8cba468
to
36b9f82
Compare
36b9f82
to
0e185f1
Compare
@dedece35 I have reworked the implementation of this rule. So this PR is ready to be included in the JavaScript plugin. |
Fixing #35