JsLint 的安裝和使用

來源:互聯網
上載者:User

標籤:margin   script   png   安裝和使用   blog   工具   ret   block   src   

 JSLint 是一款Javascript驗證工具,在定位錯誤並確保基本指南得以遵循時,非常有用。如果你正在編寫專業級的javascript,應該使用 JSLint 或者類似的驗證工具(JSHint)。它協助我們避免了許多種bug,極大縮短了開發時間。如果你安裝了Node.js,像這樣即可安裝:

npm install -g jslint

 

配置 JSlint 以及 搭建測試 demo

/*jslintbrowser : true,  continue :  true,    devel    :  true,indent   : 2,       maxerr    :  50,      newcap :  true,nomen  : true,   plusplus  :  true,    regexp  :  true,sloppy   : true,   vars        :  false,    white   :  true,*/var spa = (function(){    var initModule = function ( $container ) {            $container.html(                ‘<h1 style="display:inline-block;margin:25px;">‘                 + ‘ hello World‘                  + ‘</h1>‘            );    };        return {        initModule : initModule    };}());

 

使用 JSlint

在命令列使用 JSLint 文法如下:

jslint spa.js

如有以下效果出現,說明你安裝並且驗證成功了!

 

JsLint 的安裝和使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.