Skip to content

Commit 01fd34f

Browse files
committed
Fix lint issues
1 parent c42cc99 commit 01fd34f

6 files changed

+26
-28
lines changed

lib/document.js

+11-13
Original file line numberDiff line numberDiff line change
@@ -2079,8 +2079,6 @@ function _evaluateRequiredFunctions(doc) {
20792079
*/
20802080

20812081
function _getPathsToValidate(doc) {
2082-
let i;
2083-
let len;
20842082
const skipSchemaValidators = {};
20852083

20862084
_evaluateRequiredFunctions(doc);
@@ -2110,13 +2108,13 @@ function _getPathsToValidate(doc) {
21102108
// subdoc
21112109
for (const p of paths) {
21122110
if (p === null || p.startsWith(subdoc.$basePath + '.')) {
2113-
paths.delete(p);
2111+
paths.delete(p);
21142112
}
21152113
}
21162114

21172115
if (doc.isModified(subdoc.$basePath, modifiedPaths) &&
2118-
!doc.isDirectModified(subdoc.$basePath) &&
2119-
!doc.$isDefault(subdoc.$basePath)) {
2116+
!doc.isDirectModified(subdoc.$basePath) &&
2117+
!doc.$isDefault(subdoc.$basePath)) {
21202118
paths.add(subdoc.$basePath);
21212119

21222120
skipSchemaValidators[subdoc.$basePath] = true;
@@ -2174,8 +2172,8 @@ function _getPathsToValidate(doc) {
21742172
// be validated on their own when we call `validate()` on the subdoc itself.
21752173
// Re: gh-8468
21762174
if (doc.schema.singleNestedPaths.hasOwnProperty(path)) {
2177-
paths.delete(path);
2178-
continue;
2175+
paths.delete(path);
2176+
continue;
21792177
}
21802178
const _pathType = doc.schema.path(path);
21812179
if (!_pathType || !_pathType.$isSchemaMap) {
@@ -2214,10 +2212,10 @@ Document.prototype.$__validate = function(pathsToValidate, options, callback) {
22142212
('validateModifiedOnly' in options);
22152213

22162214
const saveDeepStacktrace = (
2217-
options &&
2218-
(typeof options === 'object') &&
2219-
!!options['deepStackTrace'])
2220-
|| !!this.schema.options.deepStackTrace;
2215+
options &&
2216+
(typeof options === 'object') &&
2217+
!!options['deepStackTrace'])
2218+
|| !!this.schema.options.deepStackTrace;
22212219
const parentStack = saveDeepStacktrace && options &&
22222220
(typeof options === 'object') &&
22232221
options.parentStack || [];
@@ -2308,8 +2306,8 @@ Document.prototype.$__validate = function(pathsToValidate, options, callback) {
23082306
validated[path] = true;
23092307
total++;
23102308

2311-
let stackToHere = saveDeepStacktrace ?
2312-
[(new Error().stack), path].concat(parentStack) : void 0;
2309+
const stackToHere = saveDeepStacktrace ?
2310+
[(new Error().stack), path].concat(parentStack) : void 0;
23132311

23142312
process.nextTick(function() {
23152313
const p = _this.schema.path(path);

lib/error/parallelValidate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function ParallelValidateError(doc, opts) {
1818
MongooseError.call(this, msg + doc._id);
1919
this.name = 'ParallelValidateError';
2020
if (opts && opts.parentStack) {
21-
// Provide a full async stack, most recent first
22-
this.stack = this.stack + "\n\n" + opts.parentStack.join('\n\n');
21+
// Provide a full async stack, most recent first
22+
this.stack = this.stack + '\n\n' + opts.parentStack.join('\n\n');
2323
}
2424
// You need to know to look for this, but having it can be very helpful
2525
// for tracking down issues when combined with the deepStackTrace schema

lib/schema.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ Schema.prototype.defaultOptions = function(options) {
404404
capped: false, // { size, max, autoIndexId }
405405
// Setting to true may help with debugging but will have performance
406406
// consequences
407-
deepStackTrace: false,
407+
deepStackTrace: false,
408408
versionKey: '__v',
409409
discriminatorKey: '__t',
410410
minimize: true,

lib/schema/SingleNestedPath.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,13 @@ SingleNestedPath.prototype.doValidate = function(value, fn, scope, options) {
238238
value = new Constructor(value, null, scope);
239239
}
240240
try {
241-
return value.validate(fn);
241+
return value.validate(fn);
242242
} catch (err) {
243-
// Save the parent stack on the error
244-
if (options.parentStack) {
245-
err.parentStack = options.parentStack;
246-
}
247-
throw err;
243+
// Save the parent stack on the error
244+
if (options.parentStack) {
245+
err.parentStack = options.parentStack;
246+
}
247+
throw err;
248248
}
249249
}
250250
const parentStack = options && options.parentStack;
@@ -258,8 +258,8 @@ SingleNestedPath.prototype.doValidate = function(value, fn, scope, options) {
258258
}
259259

260260
value.validate(fn, {
261-
deepStackTrace: !!parentStack,
262-
parentStack: parentStack,
261+
deepStackTrace: !!parentStack,
262+
parentStack: parentStack,
263263
});
264264
}, scope, options);
265265
};

lib/schema/documentarray.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ DocumentArrayPath.prototype.doValidate = function(array, fn, scope, options) {
252252
}
253253

254254
doc.$__validate(null, {
255-
parentStack: options && options.parentStack,
256-
deepStackTrace: !!(options && options.parentStack)
257-
}, callback);
255+
parentStack: options && options.parentStack,
256+
deepStackTrace: !!(options && options.parentStack)
257+
}, callback);
258258
}
259259
}
260260
};

lib/schematype.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ SchemaType.prototype.doValidate = function(value, fn, scope, options) {
10611061
err = new ErrorConstructor(validatorProperties);
10621062
err[validatorErrorSymbol] = true;
10631063
if (options && options.parentStack) {
1064-
error.parentStack = options.parentStack;
1064+
err.parentStack = options.parentStack;
10651065
}
10661066
immediate(function() {
10671067
fn(err);

0 commit comments

Comments
 (0)