-
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
deps: update eslint to latest #12333
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
}, | ||
}); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ | |
*/ | ||
'use strict'; | ||
|
||
/* global URL */ | ||
|
||
/** | ||
* @fileoverview | ||
* @suppress {reportUnknownTypes} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
*/ | ||
'use strict'; | ||
|
||
/* globals self, URL */ | ||
/* globals self */ | ||
|
||
/** @typedef {import('./i18n')} I18n */ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,12 +64,12 @@ function hasBeenRecentlyScraped(library) { | |
* @return {library is BundlePhobiaLibrary} | ||
*/ | ||
function validateLibraryObject(library) { | ||
return library.hasOwnProperty('name') && | ||
library.hasOwnProperty('size') && | ||
library.hasOwnProperty('gzip') && | ||
library.hasOwnProperty('description') && | ||
library.hasOwnProperty('repository') && | ||
library.hasOwnProperty('version') && | ||
return typeof library.name === 'string' && | ||
typeof library.size === 'number' && | ||
typeof library.gzip === 'number' && | ||
typeof library.description === 'string' && | ||
typeof library.repository === 'string' && | ||
typeof library.version === 'string' && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
!library.version.match(/^([0-9]+) packages$/); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ const traceData = { | |
networkRecords: [ | ||
{ | ||
url: 'http://google.com/index.js', | ||
_statusCode: 200, | ||
statusCode: 200, | ||
mimeType: 'text/javascript', | ||
requestId: 0, | ||
resourceSize: 9, | ||
|
@@ -33,7 +33,7 @@ const traceData = { | |
}, | ||
{ | ||
url: 'http://google.com/index.css', | ||
_statusCode: 200, | ||
statusCode: 200, | ||
mimeType: 'text/css', | ||
requestId: 1, | ||
resourceSize: 6, | ||
|
@@ -45,7 +45,7 @@ const traceData = { | |
}, | ||
{ | ||
url: 'http://google.com/index.json', | ||
_statusCode: 200, | ||
statusCode: 200, | ||
mimeType: 'application/json', | ||
requestId: 2, | ||
resourceSize: 7, | ||
|
@@ -57,7 +57,7 @@ const traceData = { | |
}, | ||
{ | ||
url: 'http://google.com/index.json', | ||
_statusCode: 200, | ||
statusCode: 200, | ||
mimeType: 'application/json', | ||
requestId: 27, | ||
resourceSize: 7, | ||
|
@@ -70,7 +70,7 @@ const traceData = { | |
}, | ||
{ | ||
url: 'http://google.com/index.json', | ||
_statusCode: 304, // ignore for being a cache not modified response | ||
statusCode: 304, // ignore for being a cache not modified response | ||
mimeType: 'application/json', | ||
requestId: 22, | ||
resourceSize: 7, | ||
|
@@ -82,7 +82,7 @@ const traceData = { | |
}, | ||
{ | ||
url: 'http://google.com/other.json', | ||
_statusCode: 200, | ||
statusCode: 200, | ||
mimeType: 'application/json', | ||
requestId: 23, | ||
resourceSize: 7, | ||
|
@@ -94,7 +94,7 @@ const traceData = { | |
}, | ||
{ | ||
url: 'http://google.com/index.jpg', | ||
_statusCode: 200, | ||
statusCode: 200, | ||
mimeType: 'image/jpg', | ||
requestId: 3, | ||
resourceSize: 10, | ||
|
@@ -106,7 +106,7 @@ const traceData = { | |
}, | ||
{ | ||
url: 'http://google.com/helloworld.mp4', | ||
_statusCode: 200, | ||
statusCode: 200, | ||
mimeType: 'video/mp4', | ||
requestId: 4, | ||
resourceSize: 100, | ||
|
@@ -136,7 +136,7 @@ describe('Optimized responses', () => { | |
}); | ||
|
||
it('returns only text and non encoded responses', () => { | ||
return responseCompression.afterPass(options, createNetworkRequests(traceData)) | ||
return responseCompression.afterPass(options, traceData) | ||
.then(artifact => { | ||
assert.equal(artifact.length, 2); | ||
assert.ok(/index\.css$/.test(artifact[0].url)); | ||
|
@@ -145,7 +145,7 @@ describe('Optimized responses', () => { | |
}); | ||
|
||
it('computes sizes', () => { | ||
return responseCompression.afterPass(options, createNetworkRequests(traceData)) | ||
return responseCompression.afterPass(options, traceData) | ||
.then(artifact => { | ||
assert.equal(artifact.length, 2); | ||
assert.equal(artifact[0].resourceSize, 6); | ||
|
@@ -155,7 +155,7 @@ describe('Optimized responses', () => { | |
|
||
it('recovers from driver errors', () => { | ||
options.driver.getRequestContent = () => Promise.reject(new Error('Failed')); | ||
return responseCompression.afterPass(options, createNetworkRequests(traceData)) | ||
return responseCompression.afterPass(options, traceData) | ||
.then(artifact => { | ||
assert.equal(artifact.length, 2); | ||
assert.equal(artifact[0].resourceSize, 6); | ||
|
@@ -191,27 +191,10 @@ describe('Optimized responses', () => { | |
], | ||
}; | ||
|
||
return responseCompression.afterPass(options, createNetworkRequests(traceData)) | ||
return responseCompression.afterPass(options, traceData) | ||
.then(artifact => { | ||
assert.equal(artifact.length, 1); | ||
assert.equal(artifact[0].resourceSize, 123); | ||
}); | ||
}); | ||
|
||
// Change into SDK.networkRequest when examples are ready | ||
function createNetworkRequests(traceData) { | ||
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; | ||
}); | ||
Comment on lines
-203
to
-213
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is handling suuuuper legacy stuff, from back when we used Anyways, |
||
|
||
return traceData; | ||
} | ||
}); |
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 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.