Level / memdown

In-memory abstract-leveldown store for Node.js and browsers.
MIT License
287 stars 37 forks source link

Standard #89

Closed vweevers closed 7 years ago

vweevers commented 7 years ago

Closes #87.

ralphtheninja commented 7 years ago

@vweevers Wow, you're on a roll today! :)

vweevers commented 7 years ago

Wow, you're on a roll today! :)

At home with the flu, nothing else to do ;)

vweevers commented 7 years ago

This is a big change so wouldn't mind another review.

juliangruber commented 7 years ago

This is a big change so wouldn't mind another review.

did you run a command to achieve this?

vweevers commented 7 years ago

did you run a command to achieve this?

standard --fix, but this only took care of ~10%. Did the rest manually.

juliangruber commented 7 years ago

What would you think about also running prettier-standard '**/*.js' before standard --fix, if this is generated 100% through tools it should be safer to merge without the laborious review.

juliangruber commented 7 years ago

and in case this doesn't get us to 100% yet, maybe split the commits between tool output and manual fixes.

vweevers commented 7 years ago

My git skills are gonna fail me so I'll do this in a new branch.

juliangruber commented 7 years ago

ok^^

juliangruber commented 7 years ago

the steps would have been something like this:

$ git checkout standard
$ git reset --hard master
$ # do all the things and commit
$ git push --force
vweevers commented 7 years ago

Yeah, but I'd maybe like to compare the end results of the two branches.

juliangruber commented 7 years ago

good point!

vweevers commented 7 years ago

Hmm, prettier-standard sadly doesn't fix one-var. Also it's a little bit too aggressive in splitting long lines.

  var keys = [], i, key
  for (i = 0; i < NUM_KEYS; i++) {
    keys.push(Math.random().toString(36).slice(2))
  }

becomes

  var keys = [],
    i,
    key
  for (i = 0; i < NUM_KEYS; i++) {
    keys.push(
      Math.random()
        .toString(36)
        .slice(2)
    )
  }
vweevers commented 7 years ago

Also neither standard --fix or prettier-standard properly deal with ifs:

-    if (typeof this._start === 'undefined')
-      this._tree = tree.end
-    else if (ltgt.upperBoundInclusive(options))
-      this._tree = tree.le(this._start)
-    else
-      this._tree = tree.lt(this._start)
+    if (typeof this._start === 'undefined') this._tree = tree.end
+    else if (ltgt.upperBoundInclusive(options)) { this._tree = tree.le(this._start) } else this._tree = tree.lt(this._start)
juliangruber commented 7 years ago

wow, that output is terrible!