runtimejs / discussions

Random discussions about runtime.js
1 stars 1 forks source link

Code Style #4

Closed facekapow closed 8 years ago

facekapow commented 8 years ago

I want to update all of the JS to ES6 (except, only the features that can be used without a transpiler), and I was also thinking about having a consistent code style. feross/standard or flet/semistandard? Or another different style? It'd make it easier for contributors to know how to code (e.g. currently I just use the style that the file I'm editing uses).

/cc @iefserge

iefserge commented 8 years ago

@facekapow There is an eslint config repository, style is very similar to semistandard but has more rules and a few minor differences. I think it's mostly the same as Node.js core style. https://github.com/runtimejs/eslint-config-runtime/blob/master/index.js. Tried semistandard, but it didn't include a few useful rules like consistent return etc, so I made a custom config instead. Not sure what's the current state of it.

Do you think it makes sense to switch to semistandard (maybe more familiar style) or just keep using custom config? We can add code examples somewhere to dev docs.

facekapow commented 8 years ago

Personally, I'd prefer to use semistandard, mainly because it's rules are written in a more readable format and I can just look them up if I forget. But then again, I'm fine with the custom eslint config, everyone contributing would just run eslint before commiting. (Though would also be great to have some example code :smiley:)

iefserge commented 8 years ago

What do you think about https://github.com/airbnb/javascript? This style looks very nice to me

facekapow commented 8 years ago

I like it, it's very thorough, and it's pretty much the style I already use in my own code!

Of course, we'd have to leave out the part about not using require, hopefully V8 gets native ES6 modules support soon.

iefserge commented 8 years ago

Cool, let's go with it then. We should be able to override module rule https://github.com/airbnb/javascript/blob/master/linters/.eslintrc