Skip to content

Commit

Permalink
Fix #775 - linting for redeclared vars
Browse files Browse the repository at this point in the history
  • Loading branch information
gregglind committed Aug 25, 2016
1 parent 49ed210 commit 02725b3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/chai/assertion.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module.exports = function (_chai, util) {
if (true !== config.showDiff) showDiff = false;

if (!ok) {
var msg = util.getMessage(this, arguments)
msg = util.getMessage(this, arguments)
, actual = util.getActual(this, arguments);
throw new AssertionError(msg, {
actual: actual
Expand Down
6 changes: 3 additions & 3 deletions lib/chai/core/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1753,14 +1753,14 @@ module.exports = function (chai, _) {
var contains = flag(this, 'contains');
var ordered = flag(this, 'ordered');

var failMsg, failNegateMsg, lengthCheck;
var subject, failMsg, failNegateMsg, lengthCheck;

if (contains) {
var subject = ordered ? 'an ordered superset' : 'a superset';
subject = ordered ? 'an ordered superset' : 'a superset';
failMsg = 'expected #{this} to be ' + subject + ' of #{exp}';
failNegateMsg = 'expected #{this} to not be ' + subject + ' of #{exp}';
} else {
var subject = ordered ? 'ordered members' : 'members';
subject = ordered ? 'ordered members' : 'members';
failMsg = 'expected #{this} to have the same ' + subject + ' as #{exp}';
failNegateMsg = 'expected #{this} to not have the same ' + subject + ' as #{exp}';
}
Expand Down
2 changes: 1 addition & 1 deletion lib/chai/utils/expectTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var flag = require('./flag');
var type = require('type-detect');

module.exports = function (obj, types) {
var obj = flag(obj, 'object');
obj = flag(obj, 'object');
types = types.map(function (t) { return t.toLowerCase(); });
types.sort();

Expand Down
10 changes: 6 additions & 4 deletions lib/chai/utils/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ function formatValue(ctx, value, recurseTimes) {
var visibleKeys = getEnumerableProperties(value);
var keys = ctx.showHidden ? getProperties(value) : visibleKeys;

var name, nameSuffix;

// Some type of object without properties can be shortcutted.
// In IE, errors have a single `stack` property, or if they are vanilla `Error`,
// a `stack` plus `description` property; ignore those for consistency.
Expand All @@ -107,8 +109,8 @@ function formatValue(ctx, value, recurseTimes) {
(keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack')
))) {
if (typeof value === 'function') {
var name = getName(value);
var nameSuffix = name ? ': ' + name : '';
name = getName(value);
nameSuffix = name ? ': ' + name : '';
return ctx.stylize('[Function' + nameSuffix + ']', 'special');
}
if (isRegExp(value)) {
Expand All @@ -132,8 +134,8 @@ function formatValue(ctx, value, recurseTimes) {

// Make functions say that they are functions
if (typeof value === 'function') {
var name = getName(value);
var nameSuffix = name ? ': ' + name : '';
name = getName(value);
nameSuffix = name ? ': ' + name : '';
base = ' [Function' + nameSuffix + ']';
}

Expand Down

0 comments on commit 02725b3

Please sign in to comment.