Closed Bnaya closed 8 years ago
@akariv I think to require a js code style requirements, using eslint, based on a common preset, and all PRS will need to comply with it. But i don't know what to choose, and i don't know them in depth.
some options: http://standardjs.com/ https://github.com/google/eslint-config-google https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
If you know someone that can advice us about this, it would be great
I'll consult with @pwalsh - however I think that we're not that opinionated on style. The most important thing is consistency, not the exact whitespace policy...
Actually white spaces vs tabs and tabs width is very important, as it can make diffs unreadable With the right tooling it would be very simple to stick to a specific style.
Yes - what I meant that it's important that it's consistent across all codebase. IMO it's less important if what we enforce is 2-space tabs or 4-space tabs.
So, I have been using jscs
, but was recently alerted that eslint
goes a step further to detect unused vars, etc. So I'll be moving to that.
As for style, choose any of the common presets I guess, such as AirBNB. I have been playing with my own styles here, but I guess it is better to stick to a preset. The only thing I'd really add to a preset like airbnb is to enforce writing without semi-colons. It makes the code nicer to read (IMHO) and the transpiler does whatever it has to do anyway.
Muh semicolons ); but i'm willing to give them up I'll go over airbnb and http://standardjs.com/ to make sure they work with es6 and decorators (for angular 2)
it seems standartjs doesn't support es6 so cross it out of the list /: I need to check airbnb more deeply
It doesn't have rules for the ES6 syntax, so we will get inconsistency there
we've decide to use typescript and not es6, I'm trying to make the typscript compiler and webpack modules resolver to work together
After more thinking, we will need to use es6 for now and typescript for new features. typescript static analyzer can't read amd modules and coffeescript.
After several iterations about js style guide, unfortunately i couldn't find something we can adopt as is, so i think we will start without.
webpack config & need node modules to transpile ES6 We are gonna use ES2015 + stage 1 http://babeljs.io/docs/plugins/preset-es2015/ http://babeljs.io/docs/plugins/preset-stage-1/
The code transform from coffee to ES6 was made using http://decaffeinate.github.io/decaffeinate/repl/ Then manually change the module format from AMD to ES6