-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
🏗Prefer destructuring objects #15204
🏗Prefer destructuring objects #15204
Conversation
This pull request fixes 1 alert when merging f73785a into f7bb404 - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
build-system/app.js
Outdated
@@ -342,7 +342,7 @@ app.use('/examples/live-list-update(-reverse)?.amp.html', (req, res, next) => { | |||
// When we already have state in memory and user refreshes page, we flush | |||
// the dom we maintain on the server. | |||
if (!('amp_latest_update_time' in req.query) && liveListDoc) { | |||
let outerHTML = liveListDoc.documentElement./*OK*/outerHTML; |
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.
Does this circumvent our property accessor checks?
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.
Damn, I'll add an exception for this.
*/ | ||
'use strict'; | ||
|
||
module.exports = function(context) { |
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.
Can you provide an explanation with an example?
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.
Done.
milestone, | ||
assignee, | ||
'pull_request': pullRequest, | ||
'updated_at': issueLastUpdate, |
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.
Huh, didn't know you could do that.
if (!data || data['sentinel'] != SENTINEL) { | ||
return; | ||
} | ||
const origin = /** @type {string} */ (event.origin); |
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.
Lost type information?
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.
A few don't seem necessary.
This pull request fixes 1 alert when merging 15577df into f7bb404 - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
This pull request fixes 1 alert when merging 721d573 into f7bb404 - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
721d573
to
bb5d2e9
Compare
This pull request fixes 1 alert when merging bb5d2e9 into 291df9e - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
bb5d2e9
to
d862981
Compare
This pull request fixes 1 alert when merging d862981 into 91e7a6a - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
Ping @choumx, needs approval. |
d862981
to
75ec660
Compare
This pull request fixes 1 alert when merging 75ec660 into 9cb1201 - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
With this code, you should be able to bypass strict linting: amphtml/build-system/tasks/lint.js Lines 200 to 202 in 32ec5af
|
75ec660
to
c95da6a
Compare
Ping @choumx |
This pull request fixes 1 alert when merging c95da6a into 4058693 - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
c95da6a
to
9e53e1b
Compare
This pull request fixes 1 alert when merging 9e53e1b into 80914d9 - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
This pull request fixes 1 alert when merging 7352832 into 5675ddc - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
This pull request fixes 1 alert when merging 19c45db into 7a6e36d - view on lgtm.com fixed alerts:
Comment posted by lgtm.com |
@@ -0,0 +1,35 @@ | |||
/** | |||
* Copyright 2016 The AMP HTML Authors. All Rights Reserved. |
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 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'm gonna fix this in a follow up.
This adds a (auto fixable!) lint rule to prefer destructing declarations instead of repeating the name twice:
Additionally, it adds a (also auto fixable!) lint rule to combine multiple destructures of the same object, further saving space: