-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(image-size-responsive): remove elidedUrl, elide url property instead #13226
core(image-size-responsive): remove elidedUrl, elide url property instead #13226
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
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.
Are you using your own linter to adjust everything? This PR is mostly style changes, some of which violate our existing linter rules.
Would it be possible to revert the style changes but keep the elidedUrl
deprecation?
@@ -8,28 +8,29 @@ | |||
* the page are large enough with respect to the pixel ratio. The | |||
* audit will list all visible images that are too small. | |||
*/ | |||
'use strict'; | |||
"use strict"; |
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.
We use '
. yarn lint --fix
should resolve these.
@@ -9,7 +9,7 @@ | |||
"axe-core": "4.2.3" | |||
} | |||
}, | |||
"lighthouseVersion": "8.6.0", | |||
"lighthouseVersion": "8.5.1", |
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.
I don't think we want the version to change here.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@adamraine I have done all the fixes mentioned. |
Thank you for making those fixes! There are still some unrelated style changes in this PR (indentations, spacing, etc.). These changes just make the PR larger than it needs to be, especially in our generated files like TL;DR: If the changes aren't functional, we should leave them out of this PR :) |
Hey @adamraine , Thanks a lot for reviewing my changes. I have removed the not required changes. |
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.
Thank you for reverting the style changes in sample_v2.json
, but most of this PR is still pure style changes. I've highlighted the changes we should keep, but the rest should be left out :)
Once you make those changes, you can run yarn update:sample-json
to fix sample_v2.json
automatically (without style changes).
@@ -53,8 +53,11 @@ describe('Images: size audit', () => { | |||
}); |
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.
All the changes in this file look like style, please only update any tests that are failing.
"failures": [ | ||
"No manifest was fetched" | ||
], | ||
"failures": ["No manifest was fetched"], |
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.
You shouldn't need to change this file. We will update it in the future, but for now it's fine.
return { | ||
url: image.src, | ||
elidedUrl: URL.elideDataURI(image.src), | ||
url: URL.elideDataURI(image.src), |
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.
Removing elidedUrl
here is good.
@@ -45,7 +46,7 @@ const LARGE_IMAGE_FACTOR = 0.75; | |||
// considered SMALL. | |||
const SMALL_IMAGE_THRESHOLD = 64; | |||
|
|||
/** @typedef {{url: string, elidedUrl: string, displayedSize: string, actualSize: string, actualPixels: number, expectedSize: string, expectedPixels: number}} Result */ | |||
/** @typedef {{url: string, displayedSize: string, actualSize: string, actualPixels: number, expectedSize: string, expectedPixels: number}} Result */ |
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.
This change is good.
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.
You can run yarn update:sample-json
to propagate these changes to sample_v2.json
.
{key: 'displayedSize', itemType: 'text', text: str_(UIStrings.columnDisplayed)}, | ||
{key: 'actualSize', itemType: 'text', text: str_(UIStrings.columnActual)}, | ||
{key: 'expectedSize', itemType: 'text', text: str_(UIStrings.columnExpected)}, | ||
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)}, |
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.
Removal of the elidedUrl
heading is good. We like to keep each heading entry on a single line though. Anything else I didn't highlihgt is a style change we don't need.
@@ -69,8 +71,8 @@ function isVisible(imageRect, viewportDimensions) { | |||
*/ | |||
function isSmallerThanViewport(imageRect, viewportDimensions) { | |||
return ( | |||
(imageRect.bottom - imageRect.top) <= viewportDimensions.innerHeight && |
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.
Your editor seems to have made multiple unnecessary formatting changes. Could you undo those?
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.
You can run git diff origin/master
to see the current diff between your current branch and master. You can remove all the unnecessary changes by running that command multiple times as you undo things.
Make sure to run |
@adamraine I'm facing few issues running that command on my machine. |
Hmm the command may be broken on windows, unfortunately I can't test on a windows machine at the moment to resolve this. If you resolve the merge conflicts and give me access to your fork, I can run the command on my end. |
@adamraine Thanks a lot |
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.
Thanks @prerana1821!
Summary
The audit "image-size-responsive" used to contain "elidedUrl" property. All other audits save the result of URL.elideDataURI to their url property. So, I have set url to this elided value, and droped elidedUrl. I also have updated all the tests related to this audit.
Resolved Issue
fixes #13182