Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: implement standard.js linting #1794

Merged
merged 1 commit into from
Jul 8, 2019
Merged

src: implement standard.js linting #1794

merged 1 commit into from
Jul 8, 2019

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jun 22, 2019

IMO it's time for some proper linting, the code style is all over the place and the existing rules were super minimal. Current style is pretty close to standard.js, and it's a fairly universally accepted and understood style.

I've done a couple of additional things on top:

  • moved module.exports to the bottom
  • no single-line if statements
  • no if statements without a {
  • const for requires

This is going to make it harder to manage older pull requests of course, so this comes with a cost.

Thoughts?

@richardlau
Copy link
Member

I've no real preferences re. standard vs other lint rules as long as the linting is part of the tests (which it is).

Since we have Travis enabled now and the linting is run as part of the npm test script we'll get visual feedback in newer and rebased PR's if the linting fails. I'm kind of assuming older PR's will need to be rebased anyway.

@rvagg rvagg mentioned this pull request Jun 26, 2019
Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

RSLGTM. Maybe add 'use strict'; to all files while you're here?

@rvagg rvagg force-pushed the rvagg/standard branch 4 times, most recently from ce9d0b4 to e9fefd9 Compare June 27, 2019 10:58
@rvagg
Copy link
Member Author

rvagg commented Jun 28, 2019

implemented 'use strict' and a couple of other minor tweaks including making consistent spacing with array declarations [ foo, bar ], not [foo, bar], we have both.

@joaocgreis
Copy link
Member

In addition:

* moved module.exports to the bottom
* no single-line if statements
* no if statements without a {
* const for requires
* array declarations get spaces inside [ ]
* 'use strict' in all .js files

PR-URL: #1794
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: João Reis <reis@janeasystems.com>
@joaocgreis
Copy link
Member

@rvagg it would be good to get this one landed to avoid it becoming outdated. AFAICT this is ready to land and I can do it tomorrow, please let me know if I shouldn't.

@joaocgreis joaocgreis merged commit e40c99e into master Jul 8, 2019
@rvagg rvagg mentioned this pull request Jul 16, 2019
@rvagg rvagg deleted the rvagg/standard branch October 2, 2019 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants