2015-10-27 14 views
8

Browserify ile Gulp ve Hintify kullanıyorum. hataları yakalamak için standardway gibi bir şey gibi görünüyor: Bu harika çalışıyorBrowserify dönüşümü var mı? İpucu, hata devam ediyor

browserify({ 
    entries: 'app.js', 
    transform: [ 
     // Some other transforms 
     plugins.hintify 
    ] 
    // A bunch of other settings 
}).bundle() 
    // Error handling 
    .on('error', function(error) { 
     util.beep(); // Util is gulp-util 
     util.log(error); 
     this.emit('end'); 
    }) 
    .pipe(...) 

ve her şey benim jshint Böyle bir şey olsun ihlal:

Users/me/Sites/project/client/scripts/app.js: line 11, col 23, Missing semicolon. 

Ve inşa durdurur. Ancak, bir noktalı virgülü unutsa bile, numaralı yapıya devam etmeyi tercih ederim. Şu anda jshint hata oluşumu işlemden kaldırılıyor. Kodumun eşit olup olmadığını kontrol etmeyi seviyorum, ancak bir işlevde kullanılmamış bir argümanım varsa, binadaki her şeyi engellememeliyim.

Yardım?

+0

[Bu yazı] 'yı gördünüz mü (https://isimmons.github.io/)? Belki istediğini yapar. Görüyorum ki [jshint] (https://gist.github.com/connor/1597131) bir "maxerr" özelliğine sahip – Rik

cevap

2

geçerli kurulum (here gibi yapılandırma sam) benim için çalışıyor:

var jshint = require('gulp-jshint'); 
var notify = require('gulp-notify'); 
var stylish = require('jshint-stylish') 
... 
.pipe(jshint('.jshintrc')) 
.pipe(jshint.reporter('jshint-stylish')) 
//.pipe(jshint.reporter('fail')) // <- omit a fail reporter 
... 

VEYA

... 
.pipe(jshint('.jshintrc')) 
.pipe(jshint.reporter('jshint-stylish')) 
.pipe(jshint.reporter('fail')) 
.on('error', notify.onError({ message: 'JS hint fail'})) // <- pipe fail to notification 
... 

Bu bana çıktıyı verir:

... 
src\m\typings.js 
    line 0 col 0 ES5 option is now set per default 
    line 3 col 18 ['SUCCESS'] is better written in dot notation. 
    line 4 col 18 ['FAILURE'] is better written in dot notation. 
    line 5 col 18 ['UNSTABLE'] is better written in dot notation. 
    line 6 col 18 ['NOT_BUILT'] is better written in dot notation. 
    line 10 col 26 ['info'] is better written in dot notation. 
    line 11 col 26 ['success'] is better written in dot notation. 
    line 12 col 26 ['mark'] is better written in dot notation. 
    line 13 col 26 ['warn'] is better written in dot notation. 
    line 14 col 26 ['error'] is better written in dot notation. 
    line 15 col 26 ['debug'] is better written in dot notation. 
    line 16 col 26 ['none'] is better written in dot notation. 
    line 18 col 1 Unnecessary semicolon. 

    ‼ 13 warnings 

[10:08:32] src\m\typings.js 

src\helper\scaffolding.helper.js 
    line 0 col 0 ES5 option is now set per default 
    line 65 col 61 Regular parameters cannot come after default parameters. 
    line 82 col 79 Expected an assignment or function call and instead saw an expression. 
    line 84 col 77 Regular parameters cannot come after default parameters. 
    line 90 col 39 Expected an assignment or function call and instead saw an expression. 
    line 91 col 21 Missing 'new' prefix when invoking a constructor. 
    line 91 col 60 Expected an assignment or function call and instead saw an expression. 
    line 105 col 46 Expected an assignment or function call and instead saw an expression. 
    line 106 col 29 Missing 'new' prefix when invoking a constructor. 
    line 106 col 103 Expected an assignment or function call and instead saw an expression. 
    line 3 col 12 'require' is not defined. 
    line 4 col 14 'require' is not defined. 
    line 5 col 11 'require' is not defined. 
    line 6 col 19 'require' is not defined. 
    line 7 col 10 'require' is not defined. 
    line 8 col 13 'require' is not defined. 
    line 9 col 13 'require' is not defined. 
    line 33 col 17 'none' is not defined. 
    line 42 col 13 'color' is not defined. 
    line 45 col 13 'color' is not defined. 
    line 48 col 13 'color' is not defined. 
    line 51 col 13 'color' is not defined. 
    line 54 col 13 'color' is not defined. 
    line 57 col 13 'color' is not defined. 
    line 60 col 13 'color' is not defined. 
    line 63 col 12 'color' is not defined. 
    line 85 col 25 'process' is not defined. 

    × 2 errors 
    ‼ 25 warnings 

[10:08:32] src\helper\scaffolding.helper.js 

src\helper\scaffolding.server.js 
    line 0 col 0 ES5 option is now set per default 
    line 22 col 44 Expected an assignment or function call and instead saw an expression. 
    line 23 col 25 Missing 'new' prefix when invoking a constructor. 
    line 23 col 75 Expected an assignment or function call and instead saw an expression. 
    line 25 col 43 Expected an assignment or function call and instead saw an expression. 
    line 26 col 25 Missing 'new' prefix when invoking a constructor. 
    line 26 col 117 Expected an assignment or function call and instead saw an expression. 
    line 38 col 40 Expected an assignment or function call and instead saw an expression. 
    line 39 col 21 Missing 'new' prefix when invoking a constructor. 
    line 39 col 50 Expected an assignment or function call and instead saw an expression. 
    line 74 col 43 Expected an assignment or function call and instead saw an expression. 
    line 75 col 25 Missing 'new' prefix when invoking a constructor. 
    line 75 col 96 Expected an assignment or function call and instead saw an expression. 
    line 4 col 12 'require' is not defined. 
    line 5 col 13 'require' is not defined. 
    line 7 col 13 'require' is not defined. 

    ‼ 16 warnings 

[10:08:32] src\helper\scaffolding.server.js 

src\server\publish.js 
    line 0 col 0 ES5 option is now set per default 
    line 17 col 17 Missing 'new' prefix when invoking a constructor. 
    line 17 col 54 Expected an assignment or function call and instead saw an expression. 
    line 29 col 21 Missing 'new' prefix when invoking a constructor. 
    line 29 col 44 Expected an assignment or function call and instead saw an expression. 
    line 3 col 12 'require' is not defined. 
    line 4 col 13 'require' is not defined. 
    line 7 col 14 'require' is not defined. 
    line 9 col 12 'require' is not defined. 
    line 10 col 10 'require' is not defined. 
    line 11 col 14 'require' is not defined. 
    line 12 col 13 'require' is not defined. 

    ‼ 12 warnings 
[10:08:32] gulp-notify: [Error running Gulp] JS hint fail 
[10:08:32] src\server\publish.js 
[10:08:32] Finished 'build' after 1.61 s 

jshint ile ^1.12.0

+2

Evet, benzer bir kurulumu kullandım, bu da sorunsuz çalışabileceğim. Ama Browserify dönüşümlerini kullanmaya çalıştığım anda - ipucu - Yukarıdaki problemle karşılaşıyorum. –

+2

Göz atmaya alışkın değilim, ama belki [bu yazı] (https://gist.github.com/mlouro/8886076) benzer bir kurulumu açıklıyor? – Rik

+2

Ayrıca [gulp-jshint] (https://github.com/spalger/gulp-jshint) ve [ipucu] (https://github.com/ansis/hintify) kullanmıyorlar. Temelde tarif ettiğin ve şimdiye kadar kullandığım gibi aynı ayar. Bununla birlikte, bunun sadece “ipucu” ile mümkün olup olmadığını merak ediyorum… –

İlgili konular