dwyl / goodparts

:see_no_evil: An ESLint Style that only allows JavaScript the Good Parts (and "Better Parts") in your code.
GNU General Public License v2.0
78 stars 26 forks source link

Why? #1

Open nelsonic opened 8 years ago

nelsonic commented 8 years ago

No Code Style or Linter I have looked at is "perfect". If I were to pick one it would be JSLint but its just not "fun" to use. (we have tried ... you end up having to include way too much config/comment per file)

"Standard" makes many assumptions and is opinionated without _Empirical Evidence_ (though I take my hat off to Feross for calling his style guide "_Standard_", of course he did not _invent_ *calling something "standard" in order to achieve the perception of quality... Standard Oil, Standard Life, Standard Motor Company... the list is endless ... and its been good marketing both for him and his other projects.)

Another option could be AirBnB JavaScript Style Guide but again, it's packet with opinion and light on "why".

So, instead of going on the opinions of the crowd, I propose that we leverage the experience of the person who knows more about JavaScript and crucially has more large scale production experience than anyone else.

javascript-the-good-parts-amazon-raking

ryanpcmcquen commented 7 years ago

This project will always be running to catch up with jslint, it seems unnecessary to me ... if you want to follow Crockford style, why not just use his linter?

nelsonic commented 7 years ago

@ryanpcmcquen really good question! ❓ Last time we investigated using jslint we looked at: https://github.com/douglascrockford/JSLint but I suspect you may be referring to: https://github.com/reid/node-jslint which looks way more user-friendly at least on the surface...

Review of the issues on GitHub https://github.com/reid/node-jslint/issues indicates that issues are not resolved particularly quickly. I guess we could help remedy that by submitting PRs to fix issues ... however its unclear those PRs would be merged/accepted as a quick glance at https://github.com/reid/node-jslint/pulls (old/stale PRs) suggests there isn't a clear process for contributing to the project ...

Reading through the issues we note that linter warnings are non-sequential; that would drive me nuts: https://github.com/reid/node-jslint/issues/128 (looks like they are going to fix it in the "next re-write"... but when is that...?)

I'm approaching this mini-investigation from a "will this save us a ton of effort" perspective, and I think further investigation is still required, but on the surface I'm going to have to disagree that we would be "running to catch up with jslint" for the simple reason that we intend to make linter a lot more user-focussed/friendly than jslint is and it will serve our purposes of writing code that Works Everywhere all-the-time

A re-read of http://jslint.com/help.html >> ECMAScript Sixth Edition suggests that the ES6 features jslint "recognises" are universally available/supported in all JS environments; they aren't. Without "transpiling" most of ES6 is only available in "Modern Web Browsers" (Chrome/Firefox/Edge) ... which sadly are not yet used by 100% of people ... So we either have to use babel in our projects (or some other "transpiler") or we have to have linter that knows when the code is going to be run in a browser in which case most of ES6 needs to be disallowed...

If you don't mind me asking, what is your preferred method for linting your JS projects? :blush:

jrans commented 7 years ago

Ok #190 opened with a proposed solution to cover this formed.

ryanpcmcquen commented 7 years ago

Well, I used standard JSLint for quite a while. There's a great Atom plugin that follows upstream closely:

https://atom.io/packages/linter-jslint

I would put this at the top of files:

/*global window*/
/*jslint browser:true, white:true*/

These days I only use Flow, since most linters do not support/endorse functional programming. Also, I kind of fell out of love with ESLint's creator when he advocated against the GPL here: https://www.nczonline.net/blog/2015/12/why-im-not-using-your-open-source-project/

nelsonic commented 7 years ago

@ryanpcmcquen thanks for sharing! its a shame that linters don't support FP. 😞 I hand't read NCZ's post on "not using your open source project" v. interesting read. 😕

iteles commented 7 years ago

A pretty good answer given in another repo that I wanted to make sure wasn't lost here: https://github.com/dwyl/learn-tdd/issues/72