node-generator-chrome-ninja icon indicating copy to clipboard operation
node-generator-chrome-ninja copied to clipboard

Update code style

Open vweevers opened this issue 9 years ago • 0 comments

  • [x] Replace usages of var with either const or let, in both generator and generated code
  • [ ] Maybe use ES6 modules. I'm on the fence about this, because comma-first CommonJS has a nice artful visual balance and I find it easier to read as a grouped statement:
const beep = require('beep')
    , bapbop = require('bapbop')
    , boop = require('boop')

import beep from 'beep'
import bapbop from 'bapbop'
import boop from 'boop'

But it's just a matter of preference. It's transpiled either way and we're not using any tooling that would benefit from one or the other. If I'm alone in my opinion, I will sigh once or twice, and adapt. Thoughts, @kessler?

  • [x] Parenthesize arrow functions, except when used in a single argument:
// no
build('beep', done => {
  // ..
})

// yes
build('beep', (done) => {
  // ..
})

// fine
build(done => {
  // ..
})
  • [ ] Lastly, I'd like both the code style (standard, xo, or a jscs preset) and es version (es5 or es6) to be a user choice. But I'm not sure yet how to make templates for that, without getting into an unmaintainable mess.

vweevers avatar Oct 28 '15 12:10 vweevers