@spalger/kibana
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
35 lines (27 loc) • 974 B
JavaScript
var _ = require('lodash');
var resolve = require('path').resolve;
var root = resolve(__dirname, '..');
var simpleGit = require('simple-git')(root);
var diff = require('bluebird').promisify(simpleGit.diff, simpleGit);
module.exports = function (grunt) {
grunt.registerTask(
'lintStagedFiles',
'Run staged files through JSHint/JSCS',
function () {
diff(['--name-only', '--cached'])
.then(function (files) {
// match these patterns
var patterns = grunt.config.get('lintThese');
files = files.split('\n').filter(Boolean).map(function (file) {
return resolve(root, file);
});
files = grunt.file.match(patterns, files);
grunt.log.debug(files);
if (!_.size(files)) return;
grunt.config.set('run.eslintStaged.args', _.union(grunt.config.get('run.eslintStaged.args'), files));
grunt.task.run(['run:eslintStaged']);
})
.nodeify(this.async());
}
);
};