Skip to content

Commit

Permalink
Merge pull request #11998 from hasezoey/eslint-eollast
Browse files Browse the repository at this point in the history
add eslint rule `eol-last` to change EOL to be consistent
  • Loading branch information
AbdelrahmanHafez committed Jun 28, 2022
2 parents 2353c14 + e6128d1 commit d488b66
Show file tree
Hide file tree
Showing 147 changed files with 149 additions and 148 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.json
Expand Up @@ -186,6 +186,7 @@
"mocha-no-only/mocha-no-only": [
"error"
],
"no-empty": "off"
"no-empty": "off",
"eol-last": "warn"
}
}
}
2 changes: 1 addition & 1 deletion lib/cast.js
Expand Up @@ -374,4 +374,4 @@ function _cast(val, numbertype, context) {
}
}
}
}
}
2 changes: 1 addition & 1 deletion lib/cast/date.js
Expand Up @@ -38,4 +38,4 @@ module.exports = function castDate(value) {
}

assert.ok(false);
};
};
2 changes: 1 addition & 1 deletion lib/cast/decimal128.js
Expand Up @@ -33,4 +33,4 @@ module.exports = function castDecimal128(value) {
}

assert.ok(false);
};
};
2 changes: 1 addition & 1 deletion lib/cast/objectid.js
Expand Up @@ -26,4 +26,4 @@ module.exports = function castObjectId(value) {
}

return new ObjectId(value);
};
};
2 changes: 1 addition & 1 deletion lib/drivers/node-mongodb-native/index.js
Expand Up @@ -9,4 +9,4 @@ exports.Collection = require('./collection');
exports.Decimal128 = require('./decimal128');
exports.ObjectId = require('./objectid');
exports.ReadPreference = require('./ReadPreference');
exports.getConnection = () => require('./connection');
exports.getConnection = () => require('./connection');
2 changes: 1 addition & 1 deletion lib/error/parallelValidate.js
Expand Up @@ -28,4 +28,4 @@ Object.defineProperty(ParallelValidateError.prototype, 'name', {
* exports
*/

module.exports = ParallelValidateError;
module.exports = ParallelValidateError;
2 changes: 1 addition & 1 deletion lib/helpers/aggregate/prepareDiscriminatorPipeline.js
Expand Up @@ -34,4 +34,4 @@ module.exports = function prepareDiscriminatorPipeline(pipeline, schema, prefix)
originalPipeline.unshift({ $match: match });
}
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/aggregate/stringifyFunctionOperators.js
Expand Up @@ -47,4 +47,4 @@ function handleAccumulator(operator) {
operator.$accumulator[key] = String(operator.$accumulator[key]);
}
}
}
}
2 changes: 1 addition & 1 deletion lib/helpers/arrayDepth.js
Expand Up @@ -30,4 +30,4 @@ function arrayDepth(arr) {
res.max = res.max + 1;

return res;
}
}
2 changes: 1 addition & 1 deletion lib/helpers/cursor/eachAsync.js
Expand Up @@ -189,4 +189,4 @@ function createEachAsyncMultiError(aggregatedErrors) {
}

return new EachAsyncMultiError(aggregatedErrors);
}
}
2 changes: 1 addition & 1 deletion lib/helpers/discriminator/areDiscriminatorValuesEqual.js
Expand Up @@ -13,4 +13,4 @@ module.exports = function areDiscriminatorValuesEqual(a, b) {
return a.toString() === b.toString();
}
return false;
};
};
Expand Up @@ -9,4 +9,4 @@ module.exports = function checkEmbeddedDiscriminatorKeyProjection(userProjection
addedPaths[0] === _discriminatorKey) {
selected.splice(selected.indexOf(_discriminatorKey), 1);
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/discriminator/getConstructor.js
Expand Up @@ -22,4 +22,4 @@ module.exports = function getConstructor(Constructor, value) {
}

return Constructor;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/discriminator/getDiscriminatorByValue.js
Expand Up @@ -24,4 +24,4 @@ module.exports = function getDiscriminatorByValue(discriminators, value) {
}
}
return null;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/discriminator/getSchemaDiscriminatorByValue.js
Expand Up @@ -23,4 +23,4 @@ module.exports = function getSchemaDiscriminatorByValue(schema, value) {
}
}
return null;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/document/handleSpreadDoc.js
Expand Up @@ -32,4 +32,4 @@ module.exports = function handleSpreadDoc(v, includeExtraKeys) {
}

return v;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/each.js
Expand Up @@ -22,4 +22,4 @@ module.exports = function each(arr, cb, done) {
}
});
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/get.js
Expand Up @@ -61,4 +61,4 @@ function getProperty(obj, prop) {
return obj.get(prop);
}
return obj[prop];
}
}
2 changes: 1 addition & 1 deletion lib/helpers/getConstructorName.js
Expand Up @@ -12,4 +12,4 @@ module.exports = function getConstructorName(val) {
return void 0;
}
return val.constructor.name;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/getDefaultBulkwriteResult.js
Expand Up @@ -24,4 +24,4 @@ function getDefaultBulkwriteResult() {
};
}

module.exports = getDefaultBulkwriteResult;
module.exports = getDefaultBulkwriteResult;
2 changes: 1 addition & 1 deletion lib/helpers/indexes/applySchemaCollation.js
Expand Up @@ -10,4 +10,4 @@ module.exports = function applySchemaCollation(indexKeys, indexOptions, schemaOp
if (schemaOptions.hasOwnProperty('collation') && !indexOptions.hasOwnProperty('collation')) {
indexOptions.collation = schemaOptions.collation;
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/indexes/decorateDiscriminatorIndexOptions.js
Expand Up @@ -11,4 +11,4 @@ module.exports = function decorateDiscriminatorIndexOptions(schema, indexOptions
indexOptions.partialFilterExpression[discriminatorKey] = discriminatorName;
}
return indexOptions;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/indexes/isDefaultIdIndex.js
Expand Up @@ -15,4 +15,4 @@ module.exports = function isDefaultIdIndex(index) {

const key = get(index, 'key', {});
return Object.keys(key).length === 1 && key.hasOwnProperty('_id');
};
};
2 changes: 1 addition & 1 deletion lib/helpers/indexes/isTextIndex.js
Expand Up @@ -13,4 +13,4 @@ module.exports = function isTextIndex(indexKeys) {
}

return isTextIndex;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/isMongooseObject.js
Expand Up @@ -19,4 +19,4 @@ module.exports = function(v) {
v.$isMongooseMap // Map
)
);
};
};
2 changes: 1 addition & 1 deletion lib/helpers/isObject.js
Expand Up @@ -13,4 +13,4 @@ module.exports = function(arg) {
Buffer.isBuffer(arg) ||
Object.prototype.toString.call(arg) === '[object Object]'
);
};
};
2 changes: 1 addition & 1 deletion lib/helpers/isPromise.js
Expand Up @@ -3,4 +3,4 @@ function isPromise(val) {
return !!val && (typeof val === 'object' || typeof val === 'function') && typeof val.then === 'function';
}

module.exports = isPromise;
module.exports = isPromise;
2 changes: 1 addition & 1 deletion lib/helpers/model/applyHooks.js
Expand Up @@ -135,4 +135,4 @@ function applyHooks(model, schema, options) {
objToDecorate[`$__${method}`] = middleware.
createWrapper(method, originalMethod, null, customMethodOptions);
}
}
}
2 changes: 1 addition & 1 deletion lib/helpers/model/applyStaticHooks.js
Expand Up @@ -68,4 +68,4 @@ module.exports = function applyStaticHooks(model, hooks, statics) {
};
}
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/once.js
Expand Up @@ -9,4 +9,4 @@ module.exports = function once(fn) {
called = true;
return fn.apply(null, arguments);
};
};
};
2 changes: 1 addition & 1 deletion lib/helpers/path/flattenObjectWithDottedPaths.js
Expand Up @@ -35,4 +35,4 @@ module.exports = function flattenObjectWithDottedPaths(obj) {

flattenObjectWithDottedPaths(obj[key]);
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/path/parentPaths.js
Expand Up @@ -15,4 +15,4 @@ module.exports = function parentPaths(path) {
}

return ret;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/path/setDottedPath.js
Expand Up @@ -30,4 +30,4 @@ module.exports = function setDottedPath(obj, path, val) {
if (!specialProperties.has(last)) {
cur[last] = val;
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/pluralize.js
Expand Up @@ -91,4 +91,4 @@ function pluralize(str) {
}
}
return str;
}
}
2 changes: 1 addition & 1 deletion lib/helpers/populate/SkipPopulateValue.js
Expand Up @@ -7,4 +7,4 @@ module.exports = function SkipPopulateValue(val) {

this.val = val;
return this;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/populate/assignRawDocsToIdStructure.js
Expand Up @@ -106,4 +106,4 @@ function assignRawDocsToIdStructure(rawIds, resultDocs, resultOrder, options, re
rawIds[i] = doc;
});
}
}
}
2 changes: 1 addition & 1 deletion lib/helpers/populate/assignVals.js
Expand Up @@ -320,4 +320,4 @@ function isPopulatedObject(obj) {

function noop(v) {
return v;
}
}
2 changes: 1 addition & 1 deletion lib/helpers/populate/createPopulateQueryFilter.js
Expand Up @@ -77,4 +77,4 @@ function _formatMatch(match) {
return Object.assign({}, match[0]);
}
return Object.assign({}, match);
}
}
2 changes: 1 addition & 1 deletion lib/helpers/populate/getModelsMapForPopulate.js
Expand Up @@ -726,4 +726,4 @@ function _findRefPathForDiscriminators(doc, modelSchema, data, options, normaliz
}

return modelNames;
}
}
2 changes: 1 addition & 1 deletion lib/helpers/populate/leanPopulateMap.js
Expand Up @@ -4,4 +4,4 @@
* ignore
*/

module.exports = new WeakMap();
module.exports = new WeakMap();
2 changes: 1 addition & 1 deletion lib/helpers/populate/lookupLocalFields.js
Expand Up @@ -37,4 +37,4 @@ module.exports = function lookupLocalFields(cur, path, val) {
}

return cur[path];
};
};
2 changes: 1 addition & 1 deletion lib/helpers/populate/markArraySubdocsPopulated.js
Expand Up @@ -39,4 +39,4 @@ module.exports = function markArraySubdocsPopulated(doc, populated) {
}
}
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/populate/modelNamesFromRefPath.js
Expand Up @@ -65,4 +65,4 @@ module.exports = function modelNamesFromRefPath(refPath, doc, populatedPath, mod
modelNames = utils.array.flatten(modelNames);

return modelNames;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/populate/removeDeselectedForeignField.js
Expand Up @@ -28,4 +28,4 @@ module.exports = function removeDeselectedForeignField(foreignFields, options, d
}
}
}
};
};
2 changes: 1 addition & 1 deletion lib/helpers/populate/validateRef.js
Expand Up @@ -16,4 +16,4 @@ function validateRef(ref, path) {

throw new MongooseError('Invalid ref at path "' + path + '". Got ' +
util.inspect(ref, { depth: 0 }));
}
}
2 changes: 1 addition & 1 deletion lib/helpers/printJestWarning.js
Expand Up @@ -14,4 +14,4 @@ if (typeof jest !== 'undefined' && process.nextTick.toString().indexOf('nextTick
'with Jest\'s mock timers enabled. Please make sure you read ' +
'Mongoose\'s docs on configuring Jest to test Node.js apps: ' +
'https://mongoosejs.com/docs/jest.html');
}
}
2 changes: 1 addition & 1 deletion lib/helpers/projection/applyProjection.js
Expand Up @@ -74,4 +74,4 @@ function applyInclusiveProjection(doc, projection, hasIncludedChildren, projecti
}
}
return ret;
}
}
2 changes: 1 addition & 1 deletion lib/helpers/projection/hasIncludedChildren.js
Expand Up @@ -33,4 +33,4 @@ module.exports = function hasIncludedChildren(fields) {
}

return hasIncludedChildren;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/projection/parseProjection.js
Expand Up @@ -30,4 +30,4 @@ module.exports = function parseProjection(v, retainMinusPaths) {
}

return ret;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/query/applyGlobalOption.js
Expand Up @@ -26,4 +26,4 @@ function applyGlobalOption(options, model, optionName) {
} else if (utils.hasUserDefinedProperty(model.base.options, optionName)) {
options[optionName] = model.base.options[optionName];
}
}
}
2 changes: 1 addition & 1 deletion lib/helpers/query/applyQueryMiddleware.js
Expand Up @@ -75,4 +75,4 @@ function _getContexts(hook) {
ret.document = hook.document;
}
return ret;
}
}
2 changes: 1 addition & 1 deletion lib/helpers/query/cast$expr.js
Expand Up @@ -279,4 +279,4 @@ function isLiteral(val) {
return val.$literal != null;
}
return true;
}
}
2 changes: 1 addition & 1 deletion lib/helpers/query/castFilterPath.js
Expand Up @@ -51,4 +51,4 @@ module.exports = function castFilterPath(query, schematype, val) {
}

return val;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/query/sanitizeFilter.js
Expand Up @@ -35,4 +35,4 @@ module.exports = function sanitizeFilter(filter) {
}

return filter;
};
};
2 changes: 1 addition & 1 deletion lib/helpers/query/sanitizeProjection.js
Expand Up @@ -11,4 +11,4 @@ module.exports = function sanitizeProjection(projection) {
projection[keys[i]] = 1;
}
}
};
};

0 comments on commit d488b66

Please sign in to comment.