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

Remove some StringMapWrapper facades #12022

Merged
merged 1 commit into from Oct 3, 2016
Merged

Conversation

alexeagle
Copy link
Contributor

Automated using alexeagle/tslint@12012b0
with a few manual fixes after.

@alexeagle alexeagle added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 1, 2016
maps.forEach(
map => { StringMapWrapper.forEach(map, (value, prop) => { result[prop] = value; }); });
maps.forEach(map => {
Object.keys(map).forEach(prop => {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove "{", convert to one liner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The advantage of the curly braces is they either contain a return statement or are void. typescript-eng has discussed the style here and I think we've decided that arrow function with a bare expression on the RHS means you use the return value from it. Otherwise it is unclear if you are using an expression to mean void, or are using its return value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok for braces but still should be 1 liner, wdyt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's up to clang-format to decide how many lines... do you just mean formatting, or do you mean to change syntax?

Copy link
Contributor

Choose a reason for hiding this comment

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

Change the syntax, do not introduce the const

@@ -17,7 +17,10 @@ export function formatNum(n: number) {

export function sortedProps(obj: {[key: string]: any}) {
var props: string[] = [];
StringMapWrapper.forEach(obj, (value, prop) => props.push(prop));
Object.keys(obj).forEach(prop => {
Copy link
Contributor

Choose a reason for hiding this comment

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

unused value, one liner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed these cases where I created a value variable that was not used, PTAL

Copy link
Contributor

Choose a reason for hiding this comment

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

Push(...Object.keys)

@@ -42,7 +41,10 @@ export class SampleDescription {
public metrics: {[key: string]: any}) {
this.description = {};
descriptions.forEach(description => {
StringMapWrapper.forEach(description, (value, prop) => this.description[prop] = value);
Object.keys(description).forEach(prop => {
Copy link
Contributor

Choose a reason for hiding this comment

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

again

Copy link
Contributor

Choose a reason for hiding this comment

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

1 line

@@ -68,7 +67,10 @@ export function main() {

function sortedKeys(stringMap: {[key: string]: any}) {
var res: string[] = [];
StringMapWrapper.forEach(stringMap, (_, key) => { res.push(key); });
Object.keys(stringMap).forEach(key => {
Copy link
Contributor

Choose a reason for hiding this comment

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

...

Copy link
Contributor

Choose a reason for hiding this comment

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

Unused

Copy link
Contributor

Choose a reason for hiding this comment

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

Res.push(...Object.keys)

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

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

Most 2 liners should be converted to 1 line IMO
Did not repeat the same comments towards the end

@@ -17,7 +17,10 @@ export function formatNum(n: number) {

export function sortedProps(obj: {[key: string]: any}) {
var props: string[] = [];
StringMapWrapper.forEach(obj, (value, prop) => props.push(prop));
Object.keys(obj).forEach(prop => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Push(...Object.keys)

@@ -42,7 +41,10 @@ export class SampleDescription {
public metrics: {[key: string]: any}) {
this.description = {};
descriptions.forEach(description => {
StringMapWrapper.forEach(description, (value, prop) => this.description[prop] = value);
Object.keys(description).forEach(prop => {
Copy link
Contributor

Choose a reason for hiding this comment

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

1 line

@@ -68,7 +67,10 @@ export function main() {

function sortedKeys(stringMap: {[key: string]: any}) {
var res: string[] = [];
StringMapWrapper.forEach(stringMap, (_, key) => { res.push(key); });
Object.keys(stringMap).forEach(key => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused

@@ -68,7 +67,10 @@ export function main() {

function sortedKeys(stringMap: {[key: string]: any}) {
var res: string[] = [];
StringMapWrapper.forEach(stringMap, (_, key) => { res.push(key); });
Object.keys(stringMap).forEach(key => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Res.push(...Object.keys)

}
});
Object.keys(entry).forEach(prop => {
const value: any = (entry as{[key: string]: string | number})[prop];
Copy link
Contributor

Choose a reason for hiding this comment

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

Move in if

}
});
Object.keys(styles).forEach(prop => {
const value = styles[prop];
Copy link
Contributor

Choose a reason for hiding this comment

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

Move in if

@alexeagle alexeagle force-pushed the rm_isblank branch 2 times, most recently from 974d179 to 5bc2ad6 Compare October 3, 2016 17:51
@alexeagle
Copy link
Contributor Author

I did a bunch more manual cleanup, mostly removing the introduced const value if it was only used once.

@vicb vicb added pr_state: LGTM action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 3, 2016
@vicb
Copy link
Contributor

vicb commented Oct 3, 2016

@alexeagle could you please rebase

This change mostly automated by
alexeagle/tslint@12012b0
with some manual fixes.
@alexeagle
Copy link
Contributor Author

rebased

On Mon, Oct 3, 2016 at 3:45 PM Victor Berchet notifications@github.com
wrote:

@alexeagle https://github.com/alexeagle could you please rebase


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#12022 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAC5I1T7dOEv854HPO_TozfI5-Do6ET8ks5qwYV9gaJpZM4KLn6b
.

@chuckjaz chuckjaz merged commit b64b5ec into angular:master Oct 3, 2016
chuckjaz pushed a commit to chuckjaz/angular that referenced this pull request Oct 5, 2016
chuckjaz pushed a commit that referenced this pull request Oct 5, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants