js: Format helpers.js#205
Merged
captncraig merged 2 commits intoStackExchange:masterfrom Sep 15, 2017
Merged
Conversation
whs
commented
Sep 15, 2017
| var d = dot.split('.'); | ||
| return ((((((+d[0])*256)+(+d[1]))*256)+(+d[2]))*256)+(+d[3]); | ||
| // prettier-ignore | ||
| return ((((((+d[0]) * 256) + (+d[1])) * 256) + (+d[2])) * 256) + (+d[3]); |
Contributor
Author
There was a problem hiding this comment.
Without prettier-ignore, this line turns to
return ((+d[0] * 256 + +d[1]) * 256 + +d[2]) * 256 + +d[3];I'm not sure which is better, so I put spaces around the operands in the original line instead.
Contributor
|
The other thing I'd like to check is documentation. If possible we should probably wrap that all in a function and explicitly export things to the global context that we expect to use. Then we can inspect the exports and make sure they all have a file in the docs folder. That just seems like a bit of work I haven't buckled down to attack yet. |
rblenkinsopp
pushed a commit
to rblenkinsopp/dnscontrol
that referenced
this pull request
Aug 21, 2020
* Format helpers.js with prettier * Adding docs on how to run prettier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Last time I worked with helpers.js, that file was a completely mess with so many coding standards mixed together.
This pull request use Prettier to cleanup the file. It should work similar to gofmt, although there is no one true style in JavaScript so I take some liberty in defining the prettierrc.
Integration test files are not ran though prettier, as it doesn't understand our DSL and will put all arguments on its own line.
If we want this to last, I'd suggest we should add a check on pull requests similar to gofmt.
I have a plan for another pull request which add eslint to perform static analysis (like warn on unused variables) plus some style guide check (for the ones I skipped like integration tests). I'll see the response from this pull request first.