2016-06-12 1 views
-1

터미널에서 오류를 표시하기 위해 gulp-eslint을 사용하려고하는데 작동하지 않습니다 ..! GitHub에서내 gulp-eslint가 작동하지 않습니까?

내 프로젝트 소스 코드 :

https://github.com/nicefellow1234/react-skeletongulpfile.js :

eslint.config.json 파일
"use strict"; 

var gulp = require('gulp'); 
var connect = require('gulp-connect'); // Runs a local Dev Server 
var open = require('gulp-open'); // Open a URL in a Web Browser 
var browserify = require('browserify'); // Bundles JS 
var reactify = require('reactify'); // Transforms React JSX to JS 
var source = require('vinyl-source-stream'); // Use Conventional text strams with Gulp 
var concat = require('gulp-concat'); // Concatenates files 
var lint = require('gulp-eslint'); // Lint JS files, including JSX 

var config = { 
    port: 9005, 
    devBaseUrl: 'http:localhost', 
    paths: { 
     html: './src/*.html', 
     js: './src/**/*.js', 
     css : [ 
      'node_modules/bootstrap/dist/css/bootstrap.min.css', 
      'node_modules/bootstrap/dist/css/bootstrap-theme.min.css' 
     ], 
     dist: './dist', 
     mainJs: './src/main.js' 
    } 
} 

gulp.task('connect', function(){ 
    connect.server({ 
     root: ['dist'], 
     port: config.port, 
     base: config.devBaseUrl, 
     livereload: true 
    }); 
}); 

gulp.task('open', ['connect'], function() { 
    gulp.src(__filename) 
    .pipe(open({ uri : config.devBaseUrl + ':' + config.port + '/'})) 

}); 

gulp.task('html', function() { 
    gulp.src(config.paths.html) 
    .pipe(gulp.dest(config.paths.dist)) 
    .pipe(connect.reload()); 
}); 

gulp.task('js', function() { 
    browserify(config.paths.mainJs) 
    .transform(reactify) 
    .bundle() 
    .on('error',function() { 
     console.error(console)}) 
    .pipe(source('bundle.js')) 
    .pipe(gulp.dest(config.paths.dist + '/scripts')) 
    .pipe(connect.reload()); 
}); 


gulp.task('css', function() { 
    gulp.src(config.paths.css) 
    .pipe(concat('bundle.css')) 
    .pipe(gulp.dest(config.paths.dist + '/css')); 
}); 

gulp.task('lint', function() { 
    return gulp 
    .src(config.paths.js) 
    .pipe(lint({config: 'eslint.config.json'})) 
    .pipe(lint.format()) 
    .pipe(lint.failAfterError()); 
}); 


gulp.task('watch', function(){ 
    gulp.watch(config.paths.html, ['html']); 
    gulp.watch(config.paths.js, ['js','lint']); 
}); 

gulp.task('default',['html','js','css','lint','open','watch']); 

:

{ 
    "ecmaFeatures": { 
    "jsx": true 
    }, 
    "env": { 
    "browser": true, 
    "node": true, 
    "jquery": true 
    }, 
    "rules": { 
    "quotes": 0, 
    "no-trailing-spaces": 0, 
    "eol-last": 0, 
    "no-unused-vars": 0, 
    "no-underscore-dangle": 0, 
    "no-alert": 0, 
    "no-lone-blocks": 0 
    }, 
    "globals": { 
    "jQuery": true, 
    "$": true 
    } 
} 

내가 src에 위치한 test: 1;main.js에 파일을 추가하려고 폴더를 저장 한 후 자동 다시로드 때 나는 그것이 년후 재로드를 중지 그럼 수동으로 다시로드 및로드를 유지, 그래서 또한

enter image description here

페이지 : 보풀이 작업은 다시 실행하지만 같이 터미널에서 오류를 포기하지 않았다 이 에스 프 린트 전에 일어난 일이 ..! 아무도 내가 여기에 문제가 뭔지 알려주시겠습니까 ?? 당신이 어떤 rules를 사용할 수 없습니다 때문

+0

확인 응답, 내가 삭제됩니다 그것 –

답변

1

오류가 기록되지 않습니다 그 이유는 다음과 같습니다

어떤 규칙이 기본적으로 사용되지 않습니다. 구성 파일의 "extends": "eslint:recommended" 속성은 일반적인 문제를보고하는 규칙을 활성화합니다. 오프 규칙을 설정

  • "warn" 또는 1 - -에 대한 경고로 규칙을 설정 (영향을주지 않습니다

    그리고 모든 규칙 종료 코드)
  • "error" 또는 2 - 규칙을 오류로 설정합니다 (트리거 될 때 종료 코드는 1)
  • 다음은 모든 권장 eslint 규칙을 활성화 것, 게다가 사람이 이미 eslint.config.json 파일에 있습니다 도움이되지 않는 경우에 대답 아래

    "extends": "eslint:recommended", 
    "rules": { 
        "quotes": 2, 
        "no-trailing-spaces": 2, 
        "eol-last": 2, 
        "no-unused-vars": 2, 
        "no-underscore-dangle": 2, 
        "no-alert": 2, 
        "no-lone-blocks": 2 
    }, 
    
    +0

    또한 내 브라우저에 다음 페이지가 계속로드되고 린트 작업과 js가 처음으로 다시 실행될 때 멈추지 않는 이유를 알려주시겠습니까 ??? –

    +0

    질문을 이해할 수 없습니다. 너는 무엇을하고 있니? 무슨 일이야? 문제에 대한 명확한 설명과 그것을 재현하는 단계를 제공하지 않는다면, 나는 정말로 당신을 도울 수 없습니다. –

    +0

    지금은 괜찮아 보이는 것 같아요 : http://recordit.co/uMvd1aQORU –