segmentio / eslint-config

Segment's ESLint configurations.
9 stars 6 forks source link

Expected literal to be on the right side of == #57

Open yields opened 8 years ago

yields commented 8 years ago

Can't think of any good reason this is a rule at all, clearly this is a style choice?

dominicbarnes commented 8 years ago

Yeah, definitely a style choice. I've always found "yoda-style" comparisons awkward and I usually have to reread it. For me, code clarity is reason enough to justify an error.

The main goal with rules like this is consistency, so we can get close to something like go fmt for our JS code. (I don't think every rule has to correct an actual bug/error if it helps make our codebase consistent for everyone)

yields commented 8 years ago

so we can get close to something like go fmt

Don't think we will ever achieve that with errors/warnings everywhere, go fmt is optional doesn't break the build and fixes stuff for you.

We should add make fmt or something similar, but to do that we'll have to decouple errors from "style errors" i think...

I've always found "yoda-style" comparisons awkward and I usually have to reread it

I think we'll all benefit if we remove style errors and warnings and move them to jsfmt in another repo we're we can create a standard and a tiny jsfmt ruleset that will back it up.

I don't mind writing code that fits the style in the app for example, but i think we won't have consistency since the more rules we add less people will adopt this repo.

Personally think this repo tries to handle way too much.