mongoose 7.6.0 → 7.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/model.js CHANGED
@@ -1060,40 +1060,45 @@ Model.prototype.$__deleteOne = function $__deleteOne(options, cb) {
1060
1060
  };
1061
1061
 
1062
1062
  /**
1063
- * Returns another Model instance.
1063
+ * Returns the model instance used to create this document if no `name` specified.
1064
+ * If `name` specified, returns the model with the given `name`.
1064
1065
  *
1065
1066
  * #### Example:
1066
1067
  *
1067
- * const doc = new Tank;
1068
- * await doc.model('User').findById(id);
1068
+ * const doc = new Tank({});
1069
+ * doc.$model() === Tank; // true
1070
+ * await doc.$model('User').findById(id);
1069
1071
  *
1070
- * @param {String} name model name
1071
- * @method model
1072
+ * @param {String} [name] model name
1073
+ * @method $model
1072
1074
  * @api public
1073
1075
  * @return {Model}
1074
1076
  */
1075
1077
 
1076
- Model.prototype.model = function model(name) {
1078
+ Model.prototype.$model = function $model(name) {
1079
+ if (arguments.length === 0) {
1080
+ return this.constructor;
1081
+ }
1077
1082
  return this[modelDbSymbol].model(name);
1078
1083
  };
1079
1084
 
1080
1085
  /**
1081
- * Returns another Model instance.
1086
+ * Returns the model instance used to create this document if no `name` specified.
1087
+ * If `name` specified, returns the model with the given `name`.
1082
1088
  *
1083
1089
  * #### Example:
1084
1090
  *
1085
- * const doc = new Tank;
1086
- * await doc.model('User').findById(id);
1091
+ * const doc = new Tank({});
1092
+ * doc.$model() === Tank; // true
1093
+ * await doc.$model('User').findById(id);
1087
1094
  *
1088
- * @param {String} name model name
1089
- * @method $model
1095
+ * @param {String} [name] model name
1096
+ * @method model
1090
1097
  * @api public
1091
1098
  * @return {Model}
1092
1099
  */
1093
1100
 
1094
- Model.prototype.$model = function $model(name) {
1095
- return this[modelDbSymbol].model(name);
1096
- };
1101
+ Model.prototype.model = Model.prototype.$model;
1097
1102
 
1098
1103
  /**
1099
1104
  * Returns a document with `_id` only if at least one document exists in the database that matches
@@ -3780,6 +3785,7 @@ Model.buildBulkWriteOperations = function buildBulkWriteOperations(documents, op
3780
3785
  }
3781
3786
 
3782
3787
  setDefaultOptions();
3788
+ const discriminatorKey = this.schema.options.discriminatorKey;
3783
3789
 
3784
3790
  const writeOperations = documents.reduce((accumulator, document, i) => {
3785
3791
  if (!options.skipValidation) {
@@ -3810,6 +3816,12 @@ Model.buildBulkWriteOperations = function buildBulkWriteOperations(documents, op
3810
3816
 
3811
3817
  _applyCustomWhere(document, where);
3812
3818
 
3819
+ // Set the discriminator key, so bulk write casting knows which
3820
+ // schema to use re: gh-13907
3821
+ if (document[discriminatorKey] != null && !(discriminatorKey in where)) {
3822
+ where[discriminatorKey] = document[discriminatorKey];
3823
+ }
3824
+
3813
3825
  document.$__version(where, delta);
3814
3826
  const writeOperation = { updateOne: { filter: where, update: changes } };
3815
3827
  utils.injectTimestampsOption(writeOperation.updateOne, options.timestamps);
@@ -4752,8 +4764,6 @@ Model.compile = function compile(name, schema, collectionName, connection, base)
4752
4764
 
4753
4765
  schema._preCompile();
4754
4766
 
4755
- model.prototype.$__setSchema(schema);
4756
-
4757
4767
  const _userProvidedOptions = schema._userProvidedOptions || {};
4758
4768
 
4759
4769
  const collectionOptions = {
@@ -4766,13 +4776,16 @@ Model.compile = function compile(name, schema, collectionName, connection, base)
4766
4776
  collectionOptions.autoCreate = schema.options.autoCreate;
4767
4777
  }
4768
4778
 
4769
- model.prototype.collection = connection.collection(
4779
+ const collection = connection.collection(
4770
4780
  collectionName,
4771
4781
  collectionOptions
4772
4782
  );
4773
4783
 
4774
- model.prototype.$collection = model.prototype.collection;
4775
- model.prototype[modelCollectionSymbol] = model.prototype.collection;
4784
+ model.prototype.collection = collection;
4785
+ model.prototype.$collection = collection;
4786
+ model.prototype[modelCollectionSymbol] = collection;
4787
+
4788
+ model.prototype.$__setSchema(schema);
4776
4789
 
4777
4790
  // apply methods and statics
4778
4791
  applyMethods(model, schema);
@@ -4781,8 +4794,8 @@ Model.compile = function compile(name, schema, collectionName, connection, base)
4781
4794
  applyStaticHooks(model, schema.s.hooks, schema.statics);
4782
4795
 
4783
4796
  model.schema = model.prototype.$__schema;
4784
- model.collection = model.prototype.collection;
4785
- model.$__collection = model.collection;
4797
+ model.collection = collection;
4798
+ model.$__collection = collection;
4786
4799
 
4787
4800
  // Create custom query constructor
4788
4801
  model.Query = function() {
package/lib/query.js CHANGED
@@ -1680,7 +1680,7 @@ Query.prototype.setOptions = function(options, overwrite) {
1680
1680
 
1681
1681
  const printRawResultDeprecationWarning = util.deprecate(
1682
1682
  function printRawResultDeprecationWarning() {},
1683
- 'The `rawResult` option for Mongoose queries is deprecated. Use `includeResultMetadata: false` as a replacement for `rawResult: true`.'
1683
+ 'The `rawResult` option for Mongoose queries is deprecated. Use `includeResultMetadata: true` as a replacement for `rawResult: true`.'
1684
1684
  );
1685
1685
 
1686
1686
  /*!
@@ -55,6 +55,12 @@ function SubdocumentPath(schema, path, options) {
55
55
  this.$isSingleNested = true;
56
56
  this.base = schema.base;
57
57
  SchemaType.call(this, path, options, 'Embedded');
58
+
59
+ if (schema._applyDiscriminators != null) {
60
+ for (const disc of schema._applyDiscriminators.keys()) {
61
+ this.discriminator(disc, schema._applyDiscriminators.get(disc));
62
+ }
63
+ }
58
64
  }
59
65
 
60
66
  /*!
@@ -88,6 +88,12 @@ function DocumentArrayPath(key, schema, options, schemaOptions) {
88
88
 
89
89
  this.$embeddedSchemaType.caster = this.Constructor;
90
90
  this.$embeddedSchemaType.schema = this.schema;
91
+
92
+ if (schema._applyDiscriminators != null) {
93
+ for (const disc of schema._applyDiscriminators.keys()) {
94
+ this.discriminator(disc, schema._applyDiscriminators.get(disc));
95
+ }
96
+ }
91
97
  }
92
98
 
93
99
  /**
package/lib/schema.js CHANGED
@@ -37,6 +37,8 @@ const isPOJO = utils.isPOJO;
37
37
 
38
38
  let id = 0;
39
39
 
40
+ const numberRE = /^\d+$/;
41
+
40
42
  /**
41
43
  * Schema constructor.
42
44
  *
@@ -723,19 +725,6 @@ Schema.prototype.add = function add(obj, prefix) {
723
725
  for (const key in val[0].discriminators) {
724
726
  schemaType.discriminator(key, val[0].discriminators[key]);
725
727
  }
726
- } else if (val[0] != null && val[0].instanceOfSchema && val[0]._applyDiscriminators instanceof Map) {
727
- const applyDiscriminators = val[0]._applyDiscriminators;
728
- const schemaType = this.path(prefix + key);
729
- for (const disc of applyDiscriminators.keys()) {
730
- schemaType.discriminator(disc, applyDiscriminators.get(disc));
731
- }
732
- }
733
- else if (val != null && val.instanceOfSchema && val._applyDiscriminators instanceof Map) {
734
- const applyDiscriminators = val._applyDiscriminators;
735
- const schemaType = this.path(prefix + key);
736
- for (const disc of applyDiscriminators.keys()) {
737
- schemaType.discriminator(disc, applyDiscriminators.get(disc));
738
- }
739
728
  }
740
729
  } else if (Object.keys(val).length < 1) {
741
730
  // Special-case: {} always interpreted as Mixed path so leaf at this node
@@ -1017,7 +1006,7 @@ Schema.prototype.path = function(path, obj) {
1017
1006
 
1018
1007
  // subpaths?
1019
1008
  return /\.\d+\.?.*$/.test(path)
1020
- ? getPositionalPath(this, path)
1009
+ ? getPositionalPath(this, path, cleanPath)
1021
1010
  : undefined;
1022
1011
  }
1023
1012
 
@@ -1634,7 +1623,7 @@ Schema.prototype.pathType = function(path) {
1634
1623
  }
1635
1624
 
1636
1625
  if (/\.\d+\.|\.\d+$/.test(path)) {
1637
- return getPositionalPathType(this, path);
1626
+ return getPositionalPathType(this, path, cleanPath);
1638
1627
  }
1639
1628
  return 'adhocOrUndefined';
1640
1629
  };
@@ -1678,7 +1667,7 @@ Schema.prototype.setupTimestamp = function(timestamps) {
1678
1667
  * @api private
1679
1668
  */
1680
1669
 
1681
- function getPositionalPathType(self, path) {
1670
+ function getPositionalPathType(self, path, cleanPath) {
1682
1671
  const subpaths = path.split(/\.(\d+)\.|\.(\d+)$/).filter(Boolean);
1683
1672
  if (subpaths.length < 2) {
1684
1673
  return self.paths.hasOwnProperty(subpaths[0]) ?
@@ -1729,7 +1718,7 @@ function getPositionalPathType(self, path) {
1729
1718
  val = val.schema.path(subpath);
1730
1719
  }
1731
1720
 
1732
- self.subpaths[path] = val;
1721
+ self.subpaths[cleanPath] = val;
1733
1722
  if (val) {
1734
1723
  return 'real';
1735
1724
  }
@@ -1744,9 +1733,9 @@ function getPositionalPathType(self, path) {
1744
1733
  * ignore
1745
1734
  */
1746
1735
 
1747
- function getPositionalPath(self, path) {
1748
- getPositionalPathType(self, path);
1749
- return self.subpaths[path];
1736
+ function getPositionalPath(self, path, cleanPath) {
1737
+ getPositionalPathType(self, path, cleanPath);
1738
+ return self.subpaths[cleanPath];
1750
1739
  }
1751
1740
 
1752
1741
  /**
@@ -2638,6 +2627,9 @@ Schema.prototype._getSchema = function(path) {
2638
2627
  // Re: gh-5628, because `schema.path()` doesn't take $ into account.
2639
2628
  parts[i] = '0';
2640
2629
  }
2630
+ if (numberRE.test(parts[i])) {
2631
+ parts[i] = '$';
2632
+ }
2641
2633
  }
2642
2634
  return search(parts, _this);
2643
2635
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mongoose",
3
3
  "description": "Mongoose MongoDB ODM",
4
- "version": "7.6.0",
4
+ "version": "7.6.2",
5
5
  "author": "Guillermo Rauch <guillermo@learnboost.com>",
6
6
  "keywords": [
7
7
  "mongodb",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "bson": "^5.4.0",
22
+ "bson": "^5.5.0",
23
23
  "kareem": "2.5.1",
24
24
  "mongodb": "5.9.0",
25
25
  "mpath": "0.9.0",
@@ -39,7 +39,6 @@
39
39
  "axios": "1.1.3",
40
40
  "babel-loader": "8.2.5",
41
41
  "benchmark": "2.1.4",
42
- "bluebird": "3.7.2",
43
42
  "broken-link-checker": "^0.7.8",
44
43
  "buffer": "^5.6.0",
45
44
  "cheerio": "1.0.0-rc.12",
@@ -130,14 +129,6 @@
130
129
  },
131
130
  "homepage": "https://mongoosejs.com",
132
131
  "browser": "./dist/browser.umd.js",
133
- "mocha": {
134
- "extension": [
135
- "test.js"
136
- ],
137
- "watch-files": [
138
- "test/**/*.js"
139
- ]
140
- },
141
132
  "config": {
142
133
  "mongodbMemoryServer": {
143
134
  "disablePostinstall": true
@@ -75,6 +75,7 @@ declare module 'mongoose' {
75
75
 
76
76
  /** Returns the model with the given name on this document's associated connection. */
77
77
  $model<ModelType = Model<unknown>>(name: string): ModelType;
78
+ $model<ModelType = Model<DocType>>(): ModelType;
78
79
 
79
80
  /**
80
81
  * A string containing the current operation that Mongoose is executing
@@ -191,6 +192,10 @@ declare module 'mongoose' {
191
192
  markModified<T extends keyof DocType>(path: T, scope?: any): void;
192
193
  markModified(path: string, scope?: any): void;
193
194
 
195
+ /** Returns the model with the given name on this document's associated connection. */
196
+ model<ModelType = Model<unknown>>(name: string): ModelType;
197
+ model<ModelType = Model<DocType>>(): ModelType;
198
+
194
199
  /** Returns the list of paths that have been modified. */
195
200
  modifiedPaths(options?: { includeChildren?: boolean }): Array<string>;
196
201
 
@@ -219,7 +219,7 @@ type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueT
219
219
  PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt ? bigint :
220
220
  PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
221
221
  IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
222
- PathValueType extends MapConstructor ? Map<string, ResolvePathType<Options['of']>> :
222
+ PathValueType extends MapConstructor | 'Map' ? Map<string, ResolvePathType<Options['of']>> :
223
223
  IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolvePathType<Options['of']>> :
224
224
  PathValueType extends ArrayConstructor ? any[] :
225
225
  PathValueType extends typeof Schema.Types.Mixed ? any:
package/types/models.d.ts CHANGED
@@ -32,7 +32,9 @@ declare module 'mongoose' {
32
32
  PopulateOption,
33
33
  SessionOption {
34
34
  limit?: number;
35
+ // @deprecated, use includeResultMetadata instead
35
36
  rawResult?: boolean;
37
+ includeResultMetadata?: boolean;
36
38
  ordered?: boolean;
37
39
  lean?: boolean;
38
40
  throwOnValidationError?: boolean;
@@ -360,6 +362,34 @@ declare module 'mongoose' {
360
362
  init(): Promise<THydratedDocumentType>;
361
363
 
362
364
  /** Inserts one or more new documents as a single `insertMany` call to the MongoDB server. */
365
+ insertMany(
366
+ docs: Array<TRawDocType>
367
+ ): Promise<Array<THydratedDocumentType>>;
368
+ insertMany(
369
+ docs: Array<TRawDocType>,
370
+ options: InsertManyOptions & { lean: true; }
371
+ ): Promise<Array<Require_id<TRawDocType>>>;
372
+ insertMany(
373
+ doc: Array<TRawDocType>,
374
+ options: InsertManyOptions & { ordered: false; rawResult: true; }
375
+ ): Promise<mongodb.InsertManyResult<Require_id<TRawDocType>> & {
376
+ mongoose: {
377
+ validationErrors: (CastError | Error.ValidatorError)[];
378
+ results: Array<
379
+ Error |
380
+ Object |
381
+ THydratedDocumentType
382
+ >
383
+ }
384
+ }>;
385
+ insertMany(
386
+ docs: Array<TRawDocType>,
387
+ options: InsertManyOptions & { lean: true, rawResult: true; }
388
+ ): Promise<mongodb.InsertManyResult<Require_id<TRawDocType>>>;
389
+ insertMany(
390
+ docs: Array<TRawDocType>,
391
+ options: InsertManyOptions & { rawResult: true; }
392
+ ): Promise<mongodb.InsertManyResult<Require_id<THydratedDocumentType>>>;
363
393
  insertMany<DocContents = TRawDocType>(
364
394
  docs: Array<DocContents | TRawDocType>,
365
395
  options: InsertManyOptions & { lean: true; }
@@ -373,7 +403,7 @@ declare module 'mongoose' {
373
403
  options: InsertManyOptions & { ordered: false; rawResult: true; }
374
404
  ): Promise<mongodb.InsertManyResult<Require_id<DocContents>> & {
375
405
  mongoose: {
376
- validationErrors: Error[];
406
+ validationErrors: (CastError | Error.ValidatorError)[];
377
407
  results: Array<
378
408
  Error |
379
409
  Object |
package/types/query.d.ts CHANGED
@@ -124,9 +124,14 @@ declare module 'mongoose' {
124
124
  overwriteDiscriminatorKey?: boolean;
125
125
  projection?: ProjectionType<DocType>;
126
126
  /**
127
+ * @deprecated use includeResultMetadata instead.
127
128
  * if true, returns the raw result from the MongoDB driver
128
129
  */
129
130
  rawResult?: boolean;
131
+ /**
132
+ * if ture, includes meta data for the result from the MongoDB driver
133
+ */
134
+ includeResultMetadata?: boolean;
130
135
  readPreference?: string | mongodb.ReadPreferenceMode;
131
136
  /**
132
137
  * An alias for the `new` option. `returnOriginal: false` is equivalent to `new: true`.
package/.eslintrc.js DELETED
@@ -1,236 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- extends: [
5
- 'eslint:recommended'
6
- ],
7
- ignorePatterns: [
8
- 'tools',
9
- 'dist',
10
- 'website.js',
11
- 'test/files/*',
12
- 'benchmarks',
13
- '*.min.js',
14
- '**/docs/js/native.js',
15
- '!.*',
16
- 'node_modules',
17
- '.git'
18
- ],
19
- overrides: [
20
- {
21
- files: [
22
- '**/*.{ts,tsx}',
23
- '**/*.md/*.ts',
24
- '**/*.md/*.typescript'
25
- ],
26
- extends: [
27
- 'plugin:@typescript-eslint/eslint-recommended',
28
- 'plugin:@typescript-eslint/recommended'
29
- ],
30
- plugins: [
31
- '@typescript-eslint'
32
- ],
33
- rules: {
34
- '@typescript-eslint/triple-slash-reference': 'off',
35
- '@typescript-eslint/no-non-null-assertion': 'off',
36
- '@typescript-eslint/no-empty-function': 'off',
37
- 'spaced-comment': [
38
- 'error',
39
- 'always',
40
- {
41
- block: {
42
- markers: [
43
- '!'
44
- ],
45
- balanced: true
46
- },
47
- markers: [
48
- '/'
49
- ]
50
- }
51
- ],
52
- '@typescript-eslint/no-explicit-any': 'off',
53
- '@typescript-eslint/ban-types': 'off',
54
- '@typescript-eslint/no-unused-vars': 'off',
55
- '@typescript-eslint/explicit-module-boundary-types': 'off',
56
- '@typescript-eslint/indent': [
57
- 'warn',
58
- 2,
59
- {
60
- SwitchCase: 1,
61
- ignoredNodes: ['TSTypeParameterInstantiation']
62
- }
63
- ],
64
- '@typescript-eslint/prefer-optional-chain': 'error',
65
- '@typescript-eslint/brace-style': 'error',
66
- '@typescript-eslint/no-dupe-class-members': 'error',
67
- '@typescript-eslint/no-redeclare': 'error',
68
- '@typescript-eslint/type-annotation-spacing': 'error',
69
- '@typescript-eslint/object-curly-spacing': [
70
- 'error',
71
- 'always'
72
- ],
73
- '@typescript-eslint/semi': 'error',
74
- '@typescript-eslint/space-before-function-paren': [
75
- 'error',
76
- 'never'
77
- ],
78
- '@typescript-eslint/space-infix-ops': 'off'
79
- }
80
- },
81
- {
82
- files: [
83
- '**/docs/js/**/*.js'
84
- ],
85
- env: {
86
- node: false,
87
- browser: true
88
- }
89
- }
90
- // // eslint-plugin-markdown has been disabled because of out-standing issues, see https://github.com/eslint/eslint-plugin-markdown/issues/214
91
- // {
92
- // files: ['**/*.md'],
93
- // processor: 'markdown/markdown'
94
- // },
95
- // {
96
- // files: ['**/*.md/*.js', '**/*.md/*.javascript', '**/*.md/*.ts', '**/*.md/*.typescript'],
97
- // parserOptions: {
98
- // ecmaFeatures: {
99
- // impliedStrict: true
100
- // },
101
- // sourceType: 'module', // required to allow "import" statements
102
- // ecmaVersion: 'latest' // required to allow top-level await
103
- // },
104
- // rules: {
105
- // 'no-undef': 'off',
106
- // 'no-unused-expressions': 'off',
107
- // 'no-unused-vars': 'off',
108
- // 'no-redeclare': 'off',
109
- // '@typescript-eslint/no-redeclare': 'off'
110
- // }
111
- // }
112
- ],
113
- plugins: [
114
- 'mocha-no-only'
115
- // 'markdown'
116
- ],
117
- parserOptions: {
118
- ecmaVersion: 2020
119
- },
120
- env: {
121
- node: true,
122
- es6: true,
123
- es2020: true
124
- },
125
- rules: {
126
- 'comma-style': 'error',
127
- indent: [
128
- 'error',
129
- 2,
130
- {
131
- SwitchCase: 1,
132
- VariableDeclarator: 2
133
- }
134
- ],
135
- 'keyword-spacing': 'error',
136
- 'no-whitespace-before-property': 'error',
137
- 'no-buffer-constructor': 'warn',
138
- 'no-console': 'off',
139
- 'no-constant-condition': 'off',
140
- 'no-multi-spaces': 'error',
141
- 'func-call-spacing': 'error',
142
- 'no-trailing-spaces': 'error',
143
- 'no-undef': 'error',
144
- 'no-unneeded-ternary': 'error',
145
- 'no-const-assign': 'error',
146
- 'no-useless-rename': 'error',
147
- 'no-dupe-keys': 'error',
148
- 'space-in-parens': [
149
- 'error',
150
- 'never'
151
- ],
152
- 'spaced-comment': [
153
- 'error',
154
- 'always',
155
- {
156
- block: {
157
- markers: [
158
- '!'
159
- ],
160
- balanced: true
161
- }
162
- }
163
- ],
164
- 'key-spacing': [
165
- 'error',
166
- {
167
- beforeColon: false,
168
- afterColon: true
169
- }
170
- ],
171
- 'comma-spacing': [
172
- 'error',
173
- {
174
- before: false,
175
- after: true
176
- }
177
- ],
178
- 'array-bracket-spacing': 1,
179
- 'arrow-spacing': [
180
- 'error',
181
- {
182
- before: true,
183
- after: true
184
- }
185
- ],
186
- 'object-curly-spacing': [
187
- 'error',
188
- 'always'
189
- ],
190
- 'comma-dangle': [
191
- 'error',
192
- 'never'
193
- ],
194
- 'no-unreachable': 'error',
195
- quotes: [
196
- 'error',
197
- 'single'
198
- ],
199
- 'quote-props': [
200
- 'error',
201
- 'as-needed'
202
- ],
203
- semi: 'error',
204
- 'no-extra-semi': 'error',
205
- 'semi-spacing': 'error',
206
- 'no-spaced-func': 'error',
207
- 'no-throw-literal': 'error',
208
- 'space-before-blocks': 'error',
209
- 'space-before-function-paren': [
210
- 'error',
211
- 'never'
212
- ],
213
- 'space-infix-ops': 'error',
214
- 'space-unary-ops': 'error',
215
- 'no-var': 'warn',
216
- 'prefer-const': 'warn',
217
- strict: [
218
- 'error',
219
- 'global'
220
- ],
221
- 'no-restricted-globals': [
222
- 'error',
223
- {
224
- name: 'context',
225
- message: 'Don\'t use Mocha\'s global context'
226
- }
227
- ],
228
- 'no-prototype-builtins': 'off',
229
- 'mocha-no-only/mocha-no-only': [
230
- 'error'
231
- ],
232
- 'no-empty': 'off',
233
- 'eol-last': 'warn',
234
- 'no-multiple-empty-lines': ['warn', { max: 2 }]
235
- }
236
- };
@@ -1,69 +0,0 @@
1
- 'use strict';
2
- // this file is named ".cjs" instead of ".js" because markdownlint-cli2 only looks for ".cjs" or ".mjs"
3
-
4
- // use aliases instead of "MD000" naming
5
-
6
- module.exports = {
7
- ignores: [
8
- // the following are ignored because they are just redirects
9
- 'History.md',
10
- 'SECURITY.md',
11
- 'migrating_to_5.md', // this does not affect "docs/migrating_to_5.md"
12
-
13
- // ignored for now, but should be changes later
14
- '.github/PULL_REQUEST_TEMPLATE.md',
15
-
16
- // ignore changelog because it uses different heading style than other documents and older versions use different formatting
17
- 'CHANGELOG.md',
18
-
19
- // exclude node_modules because it isnt excluded by default
20
- 'node_modules'
21
- ]
22
- };
23
-
24
- module.exports.config = {
25
- // disable default rules
26
- default: false,
27
-
28
- // alt-text for images
29
- accessibility: true,
30
- // consistent blank lines
31
- blank_lines: true,
32
- // consistent unordered lists
33
- bullet: { style: 'asterisk' },
34
- // consistent and read-able code
35
- code: true,
36
- // consistent emphasis characters
37
- emphasis: { style: 'asterisk' },
38
- // ensure consistent header usage
39
- headers: { style: 'atx' },
40
- // ensure consistent "hr" usage
41
- hr: { style: '---' },
42
- // disable disalloing html tags, because
43
- // mongoose currently uses html tags directly for heading ID's and style
44
- html: false,
45
- // consistent indentation
46
- indentation: true,
47
- // consistent links and good links
48
- links: true,
49
- // enabled by "links"
50
- // mongoose currently does not wrap plain links in "<>"
51
- 'no-bare-urls': false,
52
- // consistent ordered lists
53
- ol: true,
54
- // consistent whitespace usage
55
- whitespace: true
56
-
57
- // atx: undefined, // covered by "headers"
58
- // atx_closed: undefined, // covered by "headers"
59
- // blockquote: true, // covered by "whitespace"
60
- // hard_tab: undefined, // covered by "whitespace"
61
- // headings: undefined, // covered by "headers"
62
- // images: true, // covered by "accessibility" and "links"
63
- // language: undefined, // covered by "code"
64
- // line_length: undefined, // mongoose currently uses a mix of max-line-length and relying on editor auto-wrap
65
- // spaces: undefined, // covered by "atx", "atx_closed", "headers"
66
- // spelling: undefined, // mongoose currently only uses short-form language specifiers and so does not need this
67
- // ul: undefined, // covered by "whitespace" and "bullet"
68
- // url: undefined, // covered by "links"
69
- };