eslint-find-rules
Advanced tools
Comparing version 1.13.0 to 1.13.1
{ | ||
"name": "eslint-find-rules", | ||
"version": "1.13.0", | ||
"version": "1.13.1", | ||
"description": "Find built-in ESLint rules you don't have in your custom config.", | ||
@@ -36,3 +36,3 @@ "main": "src/lib/rule-finder.js", | ||
"window-size": "^0.2.0", | ||
"yargs": "^4.4.0" | ||
"yargs": "^5.0.0" | ||
}, | ||
@@ -48,3 +48,3 @@ "devDependencies": { | ||
"mocha": "^3.0.1", | ||
"npm-run-all": "2.3.0", | ||
"npm-run-all": "3.0.0", | ||
"nyc": "6.6.1", | ||
@@ -51,0 +51,0 @@ "opt-cli": "^1.1.1", |
@@ -20,2 +20,4 @@ #!/usr/bin/env node | ||
var getRuleURI = require('eslint-rule-documentation') | ||
var cli = require('../lib/cli-util') | ||
@@ -44,3 +46,8 @@ | ||
if (argv.verbose) { | ||
cli.verbosePush(rules) | ||
rules = rules.map(function(rule) { | ||
return [rule, getRuleURI(rule).url] | ||
}).reduce(function(all, single) { | ||
return all.concat(single) | ||
}) | ||
cli.push(rules, 2, false) | ||
} else { | ||
@@ -47,0 +54,0 @@ cli.push('\n' + options[option][0] + ' rules\n') |
@@ -1,2 +0,1 @@ | ||
var getRuleURI = require('eslint-rule-documentation') | ||
var size = require('window-size') | ||
@@ -6,14 +5,28 @@ var availableWidth = size.width || /*istanbul ignore next */ 80 | ||
function push(output, columns) { | ||
function push(output, columns, uniformColWidths) { | ||
var _output = [].concat(output) | ||
var padding = {top: 0, right: 2, bottom: 0, left: 0} | ||
var width = _output.reduce( | ||
var maxWidth = [_output.reduce( | ||
function getMaxWidth(previous, current) { | ||
return Math.max(padding.left + current.length + padding.right, previous) | ||
}, 0) | ||
}, 0)] | ||
var _columns = columns || Math.floor(availableWidth / width) | ||
var cellMapper = getOutputCellMapper(Math.floor(availableWidth / _columns), padding) | ||
var _columns = columns || Math.floor(availableWidth / maxWidth) | ||
var cellMapper, widths | ||
if (uniformColWidths === false && _columns > 1) { | ||
widths = [] | ||
_output.forEach(function(content, index) { | ||
widths[index % _columns] = Math.max( | ||
padding.left + content.length + padding.right, | ||
widths[index % _columns] || 0 | ||
) | ||
}) | ||
} else { | ||
widths = [Math.floor(availableWidth / _columns)] | ||
} | ||
cellMapper = getOutputCellMapper(widths, padding) | ||
while (_output.length) { | ||
@@ -24,10 +37,2 @@ ui.div.apply(ui, _output.splice(0, _columns).map(cellMapper)) | ||
function verbosePush(output) { | ||
var _output = [].concat(output).map(function(rule) { | ||
return rule + '\t' + getRuleURI(rule).url | ||
}) | ||
push(_output, 1) | ||
} | ||
function write(logger) { | ||
@@ -39,7 +44,11 @@ var _logger = logger || console | ||
function getOutputCellMapper(width, padding) { | ||
return function curriedOutputCellMapper(text) { | ||
function getOutputCellMapper(widths, padding) { | ||
return function curriedOutputCellMapper(text, index) { | ||
var _width = widths[index] | ||
if (_width === undefined) { | ||
_width = widths[0] | ||
} | ||
return { | ||
text: text, | ||
width: width, | ||
width: _width, | ||
padding: [padding.top, padding.right, padding.bottom, padding.left], | ||
@@ -52,4 +61,3 @@ } | ||
push: push, | ||
verbosePush: verbosePush, | ||
write: write, | ||
} |
@@ -8,6 +8,6 @@ var assert = require('assert') | ||
var getCurrentRules = sinon.stub().returns(['current']) | ||
var getPluginRules = sinon.stub().returns(['plugin']) | ||
var getAllAvailableRules = sinon.stub().returns(['all-available']) | ||
var getUnusedRules = sinon.stub().returns(['unused']) | ||
var getCurrentRules = sinon.stub().returns(['current', 'rules']) | ||
var getPluginRules = sinon.stub().returns(['plugin', 'rules']) | ||
var getAllAvailableRules = sinon.stub().returns(['all', 'available']) | ||
var getUnusedRules = sinon.stub().returns(['unused', 'rules']) | ||
@@ -14,0 +14,0 @@ var stub = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44560
939
+ Addedyargs@5.0.0(transitive)
+ Addedyargs-parser@3.2.0(transitive)
- Removedyargs@4.8.1(transitive)
- Removedyargs-parser@2.4.1(transitive)
Updatedyargs@^5.0.0