Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jshint-stylish

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jshint-stylish - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

74

index.js

@@ -1,1 +0,73 @@

module.exports = require('path').join(__dirname, 'stylish.js');
'use strict';
var chalk = require('chalk');
var table = require('text-table');
var logSymbols = require('log-symbols');
var stringLength = require('string-length');
function pluralize(str, count) {
return str + (count === 1 ? '' : 's');
}
module.exports = {
toString: function () {
return __filename;
},
reporter: function (result, config, options) {
var total = result.length;
var ret = '';
var headers = [];
var prevfile;
var errorCount = 0;
var warningCount = 0;
options = options || {};
ret += table(result.map(function (el, i) {
var err = el.error;
// E: Error, W: Warning, I: Info
var isError = err.code && err.code[0] === 'E';
var line = [
'',
chalk.gray('line ' + err.line),
chalk.gray('col ' + err.character),
isError ? chalk.red(err.reason) : chalk.blue(err.reason)
];
if (el.file !== prevfile) {
headers[i] = el.file;
}
if (options.verbose) {
line.push(chalk.gray('(' + err.code + ')'));
}
if (isError) {
errorCount++;
} else {
warningCount++;
}
prevfile = el.file;
return line;
}), {
stringLength: stringLength
}).split('\n').map(function (el, i) {
return headers[i] ? '\n' + chalk.underline(headers[i]) + '\n' + el : el;
}).join('\n') + '\n\n';
if (total > 0) {
if (errorCount > 0) {
ret += ' ' + logSymbols.error + ' ' + errorCount + pluralize(' error', errorCount) + (warningCount > 0 ? '\n' : '');
}
ret += ' ' + logSymbols.warning + ' ' + warningCount + pluralize(' warning', total);
} else {
ret += ' ' + logSymbols.success + ' No problems';
ret = '\n' + ret.trim();
}
console.log(ret + '\n');
}
};

5

package.json
{
"name": "jshint-stylish",
"version": "1.0.2",
"version": "2.0.0",
"description": "Stylish reporter for JSHint",

@@ -19,4 +19,3 @@ "license": "MIT",

"files": [
"index.js",
"stylish.js"
"index.js"
],

@@ -23,0 +22,0 @@ "keywords": [

@@ -24,6 +24,6 @@ # jshint-stylish [![Build Status](https://travis-ci.org/sindresorhus/jshint-stylish.svg?branch=master)](https://travis-ci.org/sindresorhus/jshint-stylish)

```
$ jshint --reporter node_modules/jshint-stylish/stylish.js file.js
$ jshint --reporter=node_modules/jshint-stylish file.js
```
### [gulp-jshint](https://github.com/wearefractal/gulp-jshint)
### [gulp-jshint](https://github.com/spalger/gulp-jshint)

@@ -30,0 +30,0 @@ ```js

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc