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
Conversation
maps.forEach( | ||
map => { StringMapWrapper.forEach(map, (value, prop) => { result[prop] = value; }); }); | ||
maps.forEach(map => { | ||
Object.keys(map).forEach(prop => { |
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.
remove "{", convert to one liner
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.
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.
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.
Ok for braces but still should be 1 liner, wdyt
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.
It's up to clang-format to decide how many lines... do you just mean formatting, or do you mean to change syntax?
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.
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 => { |
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.
unused value, one liner
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 fixed these cases where I created a value variable that was not used, PTAL
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.
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 => { |
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.
again
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.
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 => { |
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.
Unused
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.
Res.push(...Object.keys)
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.
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 => { |
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.
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 => { |
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.
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 => { |
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.
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 => { |
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.
Res.push(...Object.keys)
} | ||
}); | ||
Object.keys(entry).forEach(prop => { | ||
const value: any = (entry as{[key: string]: string | number})[prop]; |
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.
Move in if
} | ||
}); | ||
Object.keys(styles).forEach(prop => { | ||
const value = styles[prop]; |
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.
Move in if
974d179
to
5bc2ad6
Compare
I did a bunch more manual cleanup, mostly removing the introduced |
@alexeagle could you please rebase |
This change mostly automated by alexeagle/tslint@12012b0 with some manual fixes.
rebased On Mon, Oct 3, 2016 at 3:45 PM Victor Berchet notifications@github.com
|
) This change mostly automated by alexeagle/tslint@12012b0 with some manual fixes.
This change mostly automated by alexeagle/tslint@12012b0 with some manual fixes.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Automated using alexeagle/tslint@12012b0
with a few manual fixes after.