check.js 720 Bytes
const shelljs = require('shelljs');
const path = require('path');

const ext = process.platform === 'win32' ? '.cmd' : ''; // Windows 平台需要加后缀
const lintPath = {
    js: path.resolve('./node_modules/.bin/eslint'),
    css: path.resolve('./node_modules/.bin/stylelint')
};

const jsfiles = ['.', 'public/vue/**/*.vue'];
const cssfiles = ['public/scss/**/*.css', 'public/vue/**/*.vue'];

jsfiles.forEach(function(filepath){
	shelljs.exec(`${lintPath.js}${ext} -f table -c .eslintrc --cache ${filepath}`);
});

cssfiles.forEach(function(filepath){
	shelljs.exec(`${lintPath.css}${ext} --syntax scss --config .stylelintrc --custom-formatter ./node_modules/stylelint-formatter-table/index.js '${filepath}'`);
})