Skip to content
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

deps: update eslint to latest #12333

Merged
merged 2 commits into from
Apr 5, 2021
Merged

deps: update eslint to latest #12333

merged 2 commits into from
Apr 5, 2021

Conversation

brendankenny
Copy link
Member

Gets rid of the

@typescript-eslint/parser@4.16.1" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0 || ^7.0.0".

warning on every yarn. It's been working correctly in spite of the peer dep requirement, but our eslint@^4.19.1 is three years old, the upgrade was pretty painless, and the minor changes needed were reasonable.

@brendankenny brendankenny requested a review from a team as a code owner April 5, 2021 17:36
@brendankenny brendankenny requested review from adamraine and removed request for a team April 5, 2021 17:36
@google-cla google-cla bot added the cla: yes label Apr 5, 2021
@@ -336,22 +336,24 @@ class Driver {
sendCommandToSession(method, sessionId, ...params) {
const timeout = this._nextProtocolTimeout;
this._nextProtocolTimeout = DEFAULT_PROTOCOL_TIMEOUT;
return new Promise(async (resolve, reject) => {
const asyncTimeout = setTimeout((() => {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is from no-async-promise-executor. Usually reasonable, but to be fair the reasoning "if an async executor function throws an error, the error will be lost" is exactly why we have the try/catch in there.

Rather than ignoring the error, though, this new form is how we already handle adding a timeout in most of the rest of the code base, so it seems reasonable to use the same style and now pass the lint check.

@@ -43,7 +43,7 @@ function installMediaListener() {
// @ts-expect-error - `___linkMediaChanges` created above.
window.___linkMediaChanges.push(mediaChange);

return this.setAttribute('media', val);
this.setAttribute('media', val);
Copy link
Member Author

@brendankenny brendankenny Apr 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the intention here was to be double sure we were matching the behavior of the replaced property setter...but eslint correctly points out that even if you return a value in a setter the value still goes nowhere, so the return is misleading (and setAttribute() itself returns undefined anyways)

typeof library.gzip === 'number' &&
typeof library.description === 'string' &&
typeof library.repository === 'string' &&
typeof library.version === 'string' &&
Copy link
Member Author

@brendankenny brendankenny Apr 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lint rule is for preventing risks due to prototype pollution that has no bearing on us here, but I'm also not sure what the intention of using hasOwnProperty was. Checking typeof seems more straightforward and is stricter to boot.

Comment on lines -203 to -213
traceData.networkRecords = traceData.networkRecords.map(record => {
record.url = record.url;
record.statusCode = record._statusCode;
record.mimeType = record.mimeType;
record.resourceSize = record.resourceSize;
record.transferSize = record.transferSize;
record.responseHeaders = record.responseHeaders;
record.requestId = record.requestId;

return record;
});
Copy link
Member Author

@brendankenny brendankenny Apr 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is handling suuuuper legacy stuff, from back when we used SDK.networkRequest for network request handling and had a split between leading-underscored internal properties and no-underscored external interface, so this was doubling up the values. Over time we migrated off using the underscores directly (and these dropped their underscores one by one until only _statusCode was left) and then stopped using SDK.networkRequest altogether (almost three years ago - #5451), but we never got rid of this thing doing 85% nothing and 15% useless work :)

Anyways, _statusCode isn't a thing anymore except in this file, so 👋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants