New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eslint-html-reporter

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-html-reporter - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

test/.eslintrc

2

package.json
{
"name": "eslint-html-reporter",
"version": "0.4.3",
"version": "0.4.4",
"description": "HTML Reporter for ESLint",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,31 +17,24 @@ /**

exports.sortErrors = function(a, b) {
return (b.errors - a.errors);
};
/**
* Sort files with only warnings so the ones with the most warnings are at the top
* @param {object} a - Object to compare to b
* @param {object} b - Object to compare to a
* @returns {int} - Value used to sort the list of files
*/
exports.sortWarnings = function(a, b) {
return (b.warnings - a.warnings);
};
/**
* Sort clean files alphabetically
* @param {object} a - Object to compare to b
* @param {object} b - Object to compare to a
* @returns {int} - Value used to sort the list of files
*/
exports.sortClean = function(a, b) {
if (a.path < b.path) {
return -1;
} else if (a.path > b.path) {
return 1;
if (b.errors === 0 && a.errors === 0) {
if (b.warnings === 0 && a.warnings === 0) {
if (a.path < b.path) {
return -1;
} else if (a.path > b.path) {
return 1;
} else {
return 0;
}
} else {
return (b.warnings - a.warnings);
}
} else {
return 0;
if (b.errors === a.errors) {
return (b.warnings - a.warnings);
} else {
return (b.errors - a.errors);
}
}
};
/**

@@ -48,0 +41,0 @@ * Summarize reported data

@@ -1,41 +0,39 @@

"use strict";
var assert = require('assert');
var assert = require("assert");
var util = require('../src/js/util');
var util = require("../src/js/util");
describe("util", function() {
describe("sortErrors(a, b)", function() {
it("should return -1 when a.errors = 2 and b.errors = 1", function() {
assert.equal(-1, util.sortErrors({ "errors": 2 }, { "errors": 1 }));
describe('util', function() {
describe('sortErrors(a, b)', function() {
it('should return -1 when a.errors = 2 and b.errors = 1', function() {
assert.equal(-1, util.sortErrors({ 'errors': 2 }, { 'errors': 1 }));
});
it("should return 1 when a.errors = 1 and b.errors = 2", function() {
assert.equal(1, util.sortErrors({ "errors": 1 }, { "errors": 2 }));
it('should return 1 when a.errors = 1 and b.errors = 2', function() {
assert.equal(1, util.sortErrors({ 'errors': 1 }, { 'errors': 2 }));
});
});
describe("sortWarnings(a, b)", function() {
it("should return -1 when a.warnings = 2 and b.warnings = 1", function() {
assert.equal(-1, util.sortWarnings({ "warnings": 2 }, { "warnings": 1 }));
// only warnings
it('should return -1 when a.warnings = 2 and b.warnings = 1', function() {
assert.equal(-1, util.sortErrors({ 'errors': 0, 'warnings': 2 }, { 'errors': 0, 'warnings': 1 }));
});
it("should return 1 when a.warnings = 1 and b.warnings = 2", function() {
assert.equal(1, util.sortWarnings({ "warnings": 1 }, { "warnings": 2 }));
it('should return 1 when a.warnings = 1 and b.warnings = 2', function() {
assert.equal(1, util.sortErrors({ 'warnings': 1 }, { 'warnings': 2 }));
});
});
describe("sortClean(a, b)", function() {
it("should return 1 when a.path = 'fileA.js' and b.path = 'fileB.js'", function() {
assert.equal(-1, util.sortClean({ "path": "fileA.js" }, { "path": "fileB.js" }));
// clean files
it('should return 1 when a.path = "fileA.js" and b.path = "fileB.js"', function() {
assert.equal(-1, util.sortErrors({ 'errors': 0, 'warnings': 0, 'path': 'fileA.js' }, { 'errors': 0, 'warnings': 0, 'path': 'fileB.js' }));
});
it("should return 1 when a.path = 'fileB.js' and b.path = 'fileA.js'", function() {
assert.equal(1, util.sortClean({ "path": "fileB.js" }, { "path": "fileA.js" }));
it('should return 1 when a.path = "fileB.js" and b.path = "fileA.js"', function() {
assert.equal(1, util.sortErrors({ 'errors': 0, 'warnings': 0, 'path': 'fileB.js' }, { 'errors': 0, 'warnings': 0, 'path': 'fileA.js' }));
});
it("should return 0 when a.path = 'fileA.js' and b.path = 'fileA.js'", function() {
assert.equal(0, util.sortClean({ "path": "fileA.js" }, { "path": "fileA.js" }));
it('should return 0 when a.path = "fileA.js" and b.path = "fileA.js"', function() {
assert.equal(0, util.sortErrors({ 'errors': 0, 'warnings': 0, 'path': 'fileA.js' }, { 'errors': 0, 'warnings': 0, 'path': 'fileA.js' }));
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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