Skip to content
This repository was archived by the owner on Jul 27, 2018. It is now read-only.

Fixes #1242: reformat files to follow standard#1269

Merged
Gozala merged 22 commits intobrowserhtml:masterfrom
magopian:1242-reformat-code-to-follow-standard
Apr 5, 2017
Merged

Fixes #1242: reformat files to follow standard#1269
Gozala merged 22 commits intobrowserhtml:masterfrom
magopian:1242-reformat-code-to-follow-standard

Conversation

@magopian
Copy link
Copy Markdown
Contributor

@magopian magopian commented Feb 23, 2017

This PR only deals with the easy fixes:

  • move commas to the end of the line
  • curly braces placement
  • remove unused imports and declaration
  • replace == and != by === and !== (when not comparing to null or undefined)
  • various straightforward small fixes

….js and src/Browser/Navigators/Navigator/Assistant/Suggestion.js
…type parameters, namespace XMLHttpRequest with 'window' in src/Devtools/Record.js
…ttpRequest with 'window' in src/Devtools/Replay.js
@magopian magopian force-pushed the 1242-reformat-code-to-follow-standard branch from 33ffa90 to 5809efc Compare February 27, 2017 09:28
@magopian magopian force-pushed the 1242-reformat-code-to-follow-standard branch from 5809efc to 62c1a6e Compare February 27, 2017 10:02
@magopian
Copy link
Copy Markdown
Contributor Author

I believe I've been as far as I could with my knowledge of js, flow, standard and the codebase.

I'm not sure how to fix the 7 remaining files, and would welcome any tip or help on those.

Maybe dealing with those problematic ones in another PR would make sense though, this one is already pretty large.

@Gozala any thoughts?

@Gozala
Copy link
Copy Markdown
Contributor

Gozala commented Feb 28, 2017

I believe I've been as far as I could with my knowledge of js, flow, standard and the codebase.

That is amazing! Thank you so much! I'll try to get through this by end of tomorrow!

I'm not sure how to fix the 7 remaining files, and would welcome any tip or help on those.

I'll definitely try to look into those, but let's get these landed first.

Maybe dealing with those problematic ones in another PR would make sense though, this one is already pretty large.

Most certainly! I would rather land formatting changes separate from ones that actually alter code, so that if we introduce some regressions it would be easier to track it down and fix.

Copy link
Copy Markdown
Contributor

@Gozala Gozala left a comment

Choose a reason for hiding this comment

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

Thanks again for all the hard work! I can't wait to get this merged, there are just few things to be addressed.
Feel free to ignore few comments I did about the indentation, I am surprised that it still complies with standard. I am tempted to pass code through prettier before handing it over to standard (as discussed in prettier/prettier#736) just so that code style is more consistent but that's probably better done as followup.

So I think it's just a new String and some code removal and it should be ready to go.

Also my apologies for taking this long with review, it's just this change is huge.

main.js Outdated
? { flag
, query
? { flag,
query
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Indentation here is odd, not sure why lint is not catching it, but my understanding of the rules is it should be as:

{
  flags,
  query
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't see any indentation "errors" caught by the linter, so I don't think it's even checking it. I'll fix those indentations issues with pleasure ;)

main.js Outdated
, query: ""
),
{ flag: null,
query: ''
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same as in comment above

main.js Outdated
, webPreferences:
{ nodeIntegration: true
, preload: path.resolve(path.join('.'), 'electron-preload.js')
mainWindow = new BrowserWindow({ width: 1024,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think width: 1024 should be on next line.

main.js Outdated
height: 740,
frame: false,
webPreferences:
{ nodeIntegration: true,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it should be webPreferences: {\n

{ id: ID
, input: Input.Model
, output: Output.Model
{ id: ID,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it objects keys should start on a line after { according to standard format.



const DELETE = new String('delete');
const DELETE = 'delete'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is important for DELETE to be a special unexposed object rather than plain string which is what new String('delete') produced as it's treated as special instruction.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll change it back, but then i'll leave this file in the standard-flow ignore list, as it complains:

standard-flow: Use JavaScript Standard Style (with Flow types) (https://github.com/gozala/standard-flow)
  /Users/mathieu/mozilla/browserhtml/src/About/Repl/Repl/Host/Window.js:14:16: Do not use String as a constructor.
  /Users/mathieu/mozilla/browserhtml/src/About/Repl/Repl/Host/Window.js:69:57: eval can be harmful.```

}
}

export const update =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this function gone now ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please keep this function, even if it's not used right now. I would rather remove obsolete code in separate change from formatting one.



export type Model <model, action> =
export type Model <model, action> = // eslint-disable-line no-unused-vars
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question: Why eslint-disable-line no-unused-vars is necessary here ? exports aren't considered unused are they ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's the model type that is unused, and that's why it's complaining.

@Gozala Gozala self-assigned this Mar 3, 2017
Copy link
Copy Markdown
Contributor

@Gozala Gozala left a comment

Choose a reason for hiding this comment

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

Can you please undo deletes that I've pointed out so we can land this ?




export const updateSuggestion =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please keep this function, I know it's not used but it's going to be soon. And in any case I'd rather prune obsolete code in separate change.

}
}

export const update =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please keep this function, even if it's not used right now. I would rather remove obsolete code in separate change from formatting one.

(Task.requestAnimationFrame().map(Tick))
]

const endTransition = <model>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please export this function instead of deleting it.

@magopian magopian force-pushed the 1242-reformat-code-to-follow-standard branch from e0c7cda to 283bcac Compare March 8, 2017 09:08
@magopian
Copy link
Copy Markdown
Contributor Author

magopian commented Mar 8, 2017

I believe I've addressed all your comments, please let me know if I missed something or if you'd need anything else, i'd be happy to help!

@Gozala Gozala merged commit 7ae365b into browserhtml:master Apr 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants