From 39e3aa505691b2df37a880776676abfebd249ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=95=85=E5=9B=AD=E8=8B=92=E8=8B=92?= Date: Thu, 30 May 2019 17:24:16 +0800 Subject: [PATCH] fix: fix lint rule (#96) * chore: add test code * chore: add test code * chore: improve code coverage to 95% * fix: when install p plugin in devDependencies cant use plugin * fix: change package.json main file * fix: fix eslint check * fix: add some pkg * fix: fix lint rule * fix: penetrate lint err code to process --- lib/internal/lint/linter.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/internal/lint/linter.js b/lib/internal/lint/linter.js index 8560a111..66f9c5b7 100644 --- a/lib/internal/lint/linter.js +++ b/lib/internal/lint/linter.js @@ -3,18 +3,16 @@ const path = require('path'); const spawn = require('cross-spawn'); const Loading = require('../../utils/index').Loading; - const exec = require('child_process').exec; - const sgf = require('staged-git-files'); const pify = require('pify'); const findParentDir = require('find-parent-dir'); -const jsFilesFilter = (files) => { - return files.filter(filepath => /\.js$/.test(filepath)) +// filter js file +function jsFilesFilter (files){ + return files.filter(filepath => /\.js$/.test(filepath)); } - // get stage files function getStageFiles(cb) { const gitDir = findParentDir.sync(process.cwd(), '.git'); @@ -66,7 +64,7 @@ function getCommitDiffFiles(cb) { console.log('err:', err) console.log('stderr:', stderr) } else { - const typeList = ['M', 'D', 'A'] + const typeList = ['A', 'C', 'M']; let arr; typeList.forEach(type => { arr = getArrList(stdout, type) @@ -133,6 +131,7 @@ class Linter { loading.success('lint complete'); } else { loading.fail(`code get errors or warnings`); + process.exit(code); } }); }