Skip to content

Conversation

@patrickhulce
Copy link
Collaborator

alternative to #4958

this brings back -A, it didn't come out quite as clean as I had hoped, but it is typesafe which is kinda nice :)

settings?: SettingsJson;
passes?: PassJson[];
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

someone's got a diff trailing space editor setting it seems :)

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, damn, eslint isn't checking .ts files, obvs. I'll find the setting :P

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

an alternative to this approach would be to JSON.parse(JSON.strigify(settings)) each of them before here:

// TODO(phulce): allow change of throttling method to `simulate`
if (!isDeepEqual(normalizedGatherSettings, normalizedAuditSettings)) {

wdyt about that instead? seems like an option, though I don't feel so strongly about it.

* @param {LH.Flags=} flags
* @return {Partial<LH.Config.Settings>}
*/
function cleanFlagsForSettings(flags = {}) {
Copy link
Member

Choose a reason for hiding this comment

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

semantically this is removedUndefinedProperties right?

could we call it that instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure I'm following you, this is looking at what properties are not on constants.defaultSettings and dropping them from flags regardless of their value.

the JSON.parse(JSON.stringify()) approach would address the specific undefined yargs case but not an underlying problem that having miscellaneous junk present that isn't part of settings throws off our isDeepEqual later

Copy link
Member

Choose a reason for hiding this comment

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

oh got it.

what properties are not on constants.defaultSettings

ahhh.. mmhmmm.

k lgtm

Copy link
Contributor

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM!

},
};

/** @type {LH.Config.Settings} */
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

settings?: SettingsJson;
passes?: PassJson[];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ah, damn, eslint isn't checking .ts files, obvs. I'll find the setting :P

}

/**
* @param {LH.Flags=} flags
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a function description that this is dropping any flag not found on settings?

@brendankenny brendankenny merged commit 6d6af51 into master Apr 13, 2018
@brendankenny brendankenny deleted the cleaner_config_settings branch April 13, 2018 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants