lijinma
V2EX  ›  Node.js

大家 nodejs 都使用什么 Code style and code convention?

  •  
  •   lijinma · Mar 8, 2014 · 4142 views
    This topic created in 4459 days ago, the information mentioned may be changed or developed.
    用nodejs一段时间,但是同事之间代码风格不太一致,看起来别扭,我有代码洁癖。。。

    网上查了很多,使用的比较多和推崇的比较多的是:

    Felix's Node.js Style Guide

    http://nodeguide.com/style.html

    (1)大家都用什么code style 和 code convention?

    (2)mongodb数据库的name convention呢?

    (3)view中的html的name convention呢?

    感谢你的答案;
    6 replies    1970-01-01 08:00:00 +08:00
    hxgdzyuyi
        1
    hxgdzyuyi  
       Mar 8, 2014
    comma first
    hxgdzyuyi
        2
    hxgdzyuyi  
       Mar 8, 2014
    tj那种
    leofml
        3
    leofml  
       Mar 8, 2014 via iPad
    必须使用promise和lodash,嵌套不能超过三层。
    cnxh
        4
    cnxh  
       Mar 8, 2014
    ))}}})))}})))}))
    rexren
        5
    rexren  
       Mar 9, 2014
    个人感觉不同style guide都大同小异,重要的是team里有一个大家都认可并且遵守的即可。
    mcfog
        6
    mcfog  
       Mar 9, 2014
    如果场景是同事的话,我觉得可执行跟重要,所以选择jsHint,放jshintrc文件,grunt上检查,用机器自动拉代码,发现fail 就发邮件点名 谁的代码fail了

    promise 必须有
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2895 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 93ms · UTC 13:48 · PVG 21:48 · LAX 06:48 · JFK 09:48
    ♥ Do have faith in what you're doing.