You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

lint-prepush

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lint-prepush - npm Package Compare versions

Comparing version

to
2.1.0

@@ -73,3 +73,4 @@ #!/usr/bin/env node

base : baseBranch = 'master',
tasks = {}
tasks = {},
verbose = false
} = userConfig || {};

@@ -137,3 +138,8 @@

new Listr(resolveMainTask({ tasks, committedGitFiles }), {
const options = {
verbose,
output: []
};
new Listr(resolveMainTask({ tasks, committedGitFiles, options }), {
exitOnError: false,

@@ -147,2 +153,8 @@ concurrent: true,

debug('Cached Current Commit Hash');
if (options.verbose && options.output.length) {
log(success('\nAll tasks completed successfully. Printing tasks output.\n'));
for (const line of options.output) {
log(line);
}
}
log(success("\nVoila! 🎉 Code is ready to be Shipped.\n"));

@@ -149,0 +161,0 @@ })

{
"name": "lint-prepush",
"version": "2.0.1",
"version": "2.1.0",
"description": "Run linters on committed files in a Branch🔬",

@@ -5,0 +5,0 @@ "author": "“Theenadayalan” <“puduvai.theena@gmail.com”>",

@@ -1,2 +0,2 @@

# lint-prepush
# lint-prepush
[![npm version](https://badge.fury.io/js/lint-prepush.svg)](https://www.npmjs.com/package/lint-prepush)

@@ -16,3 +16,3 @@ [![npm downloads](https://img.shields.io/npm/dt/lint-prepush.svg)](https://www.npmtrends.com/lint-prepush)

* This package requires Node.js `>=8`.
* This package requires Node.js `>=8`.
* A package to manage git hooks.

@@ -38,3 +38,3 @@

* Here [Husky](https://github.com/typicode/husky) is used for managing git hooks.
* Here [Husky](https://github.com/typicode/husky) is used for managing git hooks.

@@ -69,3 +69,3 @@ ```diff

Tasks for a file group will by default run in linear order (eg. `"*.js": [ "jest", "eslint"]` will run jest first, then after it's done run eslint).
Tasks for a file group will by default run in linear order (eg. `"*.js": [ "jest", "eslint"]` will run jest first, then after it's done run eslint).
If you'd like to run tasks for a file group concurrently instead (eg. jest and eslint in parallel), use the `concurrent` property like so:

@@ -85,2 +85,15 @@

### Verbose
By default when the tasks succeed, there is no output printed to the console. Sometimes you might need to show linter rules configured for `warn` which should be displayed even if the tasks succeed. In order to achieve this, you can pass the config `verbose: true` so that the task output is printed to the console when the tasks succeed.
```
"lint-prepush": {
"verbose": true,
"tasks": {
...
}
}
```
## Built With

@@ -100,3 +113,3 @@

This package use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/theenadayalank/lint-prepush/tags).
This package use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/theenadayalank/lint-prepush/tags).

@@ -103,0 +116,0 @@ ## Authors

@@ -11,3 +11,3 @@ const execa = require("execa");

module.exports = function execTask({ command, fileList, task }) {
module.exports = function execTask({ command, fileList, task, options = {} }) {
let { executor, args } = resolveLinterPackage({ command, fileList });

@@ -23,2 +23,5 @@ let startTime = process.hrtime();

if (!result.failed) {
if (options.verbose) {
processOutput(command, result, options);
}
return `Passed ${command}`;

@@ -52,1 +55,12 @@ }

}
function processOutput(command, { stderr, stdout }, options) {
const hasOutput = !!stderr || !!stdout;
if (hasOutput) {
const output = []
.concat(`\n${symbols.info} Task: ${command}\n`)
.concat(stderr ? stderr : [])
.concat(stdout ? stdout : []);
options.output.push(output.join('\n'));
}
}
const execTask = require("./execTask");
module.exports = function resolveLintTask(commandList, fileList) {
module.exports = function resolveLintTask(commandList, fileList, options) {
return commandList.map(command => ({

@@ -10,5 +10,6 @@ title: command,

ctx,
task
task,
options
})()
}));
};

@@ -8,7 +8,7 @@ const Listr = require("listr");

module.exports = function resolveMainTask( options = {} ) {
return constructTaskList(options).map(task => ({
module.exports = function resolveMainTask( config = {} ) {
return constructTaskList(config).map(task => ({
title: `Linting ${task.fileFormat} files`,
task: () =>
new Listr(resolveLintTask(task.commandList.concurrent || task.commandList, task.fileList), {
new Listr(resolveLintTask(task.commandList.concurrent || task.commandList, task.fileList, config.options), {
exitOnError: true,

@@ -15,0 +15,0 @@ concurrent: Array.isArray(task.commandList.concurrent)