@tomsd/mongodbclient 3.0.13 → 4.0.0
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/README.md +1 -4
- package/dist/esm/mongodbclient.d.ts +5 -10
- package/dist/esm/mongodbclient.js +39 -27
- package/dist/mongodbclient.cjs.js +47 -27
- package/dist/mongodbclient.esm.js +47 -35
- package/package.json +5 -2
- package/.eslintrc-love-temp.cjs +0 -416
- package/.eslintrc.json +0 -17
- package/tsup.config.js +0 -12
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ See [mongodbclient.netlify.app](https://mongodbclient.netlify.app/) for details.
|
|
|
8
8
|

|
|
9
9
|

|
|
10
10
|

|
|
11
|
-

|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
``` sh
|
|
@@ -49,9 +49,6 @@ const items = [
|
|
|
49
49
|
const names = await mdbc.distinct("name");
|
|
50
50
|
console.log(`distinct names: ${names.length}`); // 4
|
|
51
51
|
|
|
52
|
-
const { storageSize } = await mdbc.stats();
|
|
53
|
-
console.log(`storageSize: ${storageSize}`);
|
|
54
|
-
|
|
55
52
|
const itemLength = await mdbc.count();
|
|
56
53
|
console.log(`count: ${itemLength}`); // 4
|
|
57
54
|
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* (c) 2020 tom
|
|
4
|
-
* License: MIT
|
|
5
|
-
*/
|
|
6
|
-
import type { Db, Collection, CollStats, DeleteResult, Document, InsertManyResult, UpdateResult, WithId } from "mongodb";
|
|
7
|
-
declare const MongoClient: any;
|
|
1
|
+
import type { Db, Collection, DeleteResult, Document, InsertManyResult, UpdateResult, WithId } from "mongodb";
|
|
2
|
+
import { MongoClient } from "mongodb";
|
|
8
3
|
export declare class MongoConnection {
|
|
9
4
|
private readonly _client;
|
|
10
5
|
private readonly _db;
|
|
11
6
|
private readonly _collection;
|
|
12
|
-
constructor(client:
|
|
13
|
-
get client():
|
|
7
|
+
constructor(client: MongoClient, db: Db, collection: Collection);
|
|
8
|
+
get client(): MongoClient;
|
|
14
9
|
get db(): Db;
|
|
15
10
|
get collection(): Collection;
|
|
16
11
|
}
|
|
@@ -28,7 +23,7 @@ export declare class MClient {
|
|
|
28
23
|
read(condition?: any, opt?: any): Promise<Array<WithId<Document>>>;
|
|
29
24
|
distinct(key: string, condition?: any): Promise<any[]>;
|
|
30
25
|
remove(condition: any): Promise<DeleteResult>;
|
|
31
|
-
stats(): Promise<
|
|
26
|
+
stats(): Promise<Document | null>;
|
|
32
27
|
count(condition?: any): Promise<number>;
|
|
33
28
|
insertMany(items: any[]): Promise<InsertManyResult<Document>>;
|
|
34
29
|
dbStats(): Promise<Document>;
|
|
@@ -8,8 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { v4 as uuidv4 } from "uuid";
|
|
11
|
-
|
|
12
|
-
const MongoClient = require("mongodb").MongoClient;
|
|
11
|
+
import { MongoClient, ServerApiVersion } from "mongodb";
|
|
13
12
|
export class MongoConnection {
|
|
14
13
|
constructor(client, db, collection) {
|
|
15
14
|
this._client = client;
|
|
@@ -48,11 +47,12 @@ export class MClient {
|
|
|
48
47
|
}
|
|
49
48
|
getConnected() {
|
|
50
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const client = new MongoClient(this.m_uri, {
|
|
52
|
-
|
|
50
|
+
const client = new MongoClient(this.m_uri, {
|
|
51
|
+
serverApi: ServerApiVersion.v1,
|
|
52
|
+
});
|
|
53
|
+
return yield client.connect().then((client) => {
|
|
53
54
|
const db = client.db(this.m_db);
|
|
54
55
|
const collection = db.collection(this.m_collection);
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
56
56
|
return new MongoConnection(client, db, collection);
|
|
57
57
|
});
|
|
58
58
|
});
|
|
@@ -65,7 +65,7 @@ export class MClient {
|
|
|
65
65
|
return yield connection.collection.updateOne({ _id: savingObj._id }, { $set: savingObj }, { upsert: true, writeConcern: { w: 1 } });
|
|
66
66
|
}
|
|
67
67
|
finally {
|
|
68
|
-
connection.client.close();
|
|
68
|
+
yield connection.client.close();
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
}
|
|
@@ -73,11 +73,12 @@ export class MClient {
|
|
|
73
73
|
return __awaiter(this, arguments, void 0, function* (condition = {}, opt) {
|
|
74
74
|
const connection = yield this.getConnected();
|
|
75
75
|
try {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
return yield connection.collection
|
|
77
|
+
.find(condition, opt)
|
|
78
|
+
.toArray();
|
|
78
79
|
}
|
|
79
80
|
finally {
|
|
80
|
-
connection.client.close();
|
|
81
|
+
yield connection.client.close();
|
|
81
82
|
}
|
|
82
83
|
});
|
|
83
84
|
}
|
|
@@ -85,13 +86,10 @@ export class MClient {
|
|
|
85
86
|
return __awaiter(this, arguments, void 0, function* (key, condition = {}) {
|
|
86
87
|
const connection = yield this.getConnected();
|
|
87
88
|
try {
|
|
88
|
-
|
|
89
|
-
return (yield connection.collection.distinct(key,
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
91
|
-
condition));
|
|
89
|
+
return (yield connection.collection.distinct(key, condition));
|
|
92
90
|
}
|
|
93
91
|
finally {
|
|
94
|
-
connection.client.close();
|
|
92
|
+
yield connection.client.close();
|
|
95
93
|
}
|
|
96
94
|
});
|
|
97
95
|
}
|
|
@@ -99,13 +97,12 @@ export class MClient {
|
|
|
99
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
98
|
const connection = yield this.getConnected();
|
|
101
99
|
try {
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
103
100
|
return yield connection.collection.deleteMany(condition, {
|
|
104
101
|
writeConcern: { w: 1 },
|
|
105
102
|
});
|
|
106
103
|
}
|
|
107
104
|
finally {
|
|
108
|
-
connection.client.close();
|
|
105
|
+
yield connection.client.close();
|
|
109
106
|
}
|
|
110
107
|
});
|
|
111
108
|
}
|
|
@@ -113,10 +110,29 @@ export class MClient {
|
|
|
113
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
114
111
|
const connection = yield this.getConnected();
|
|
115
112
|
try {
|
|
116
|
-
|
|
113
|
+
const [collStats] = yield connection.collection
|
|
114
|
+
.aggregate([
|
|
115
|
+
{
|
|
116
|
+
$collStats: {
|
|
117
|
+
latencyStats: {
|
|
118
|
+
histograms: true,
|
|
119
|
+
},
|
|
120
|
+
count: {},
|
|
121
|
+
queryExecStats: {},
|
|
122
|
+
storageStats: {
|
|
123
|
+
scale: 1,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
])
|
|
128
|
+
.toArray();
|
|
129
|
+
return collStats;
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
return null;
|
|
117
133
|
}
|
|
118
134
|
finally {
|
|
119
|
-
connection.client.close();
|
|
135
|
+
yield connection.client.close();
|
|
120
136
|
}
|
|
121
137
|
});
|
|
122
138
|
}
|
|
@@ -124,13 +140,10 @@ export class MClient {
|
|
|
124
140
|
return __awaiter(this, arguments, void 0, function* (condition = {}) {
|
|
125
141
|
const connection = yield this.getConnected();
|
|
126
142
|
try {
|
|
127
|
-
|
|
128
|
-
return (yield connection.collection.countDocuments(
|
|
129
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
130
|
-
condition));
|
|
143
|
+
return (yield connection.collection.countDocuments(condition));
|
|
131
144
|
}
|
|
132
145
|
finally {
|
|
133
|
-
connection.client.close();
|
|
146
|
+
yield connection.client.close();
|
|
134
147
|
}
|
|
135
148
|
});
|
|
136
149
|
}
|
|
@@ -139,13 +152,12 @@ export class MClient {
|
|
|
139
152
|
const connection = yield this.getConnected();
|
|
140
153
|
const savingItems = items.map((item) => (Object.assign({ _id: uuidv4() }, item)));
|
|
141
154
|
try {
|
|
142
|
-
// eslint-disable-next-line
|
|
143
155
|
return yield connection.collection.insertMany(savingItems, {
|
|
144
156
|
writeConcern: { w: 1 },
|
|
145
157
|
});
|
|
146
158
|
}
|
|
147
159
|
finally {
|
|
148
|
-
connection.client.close();
|
|
160
|
+
yield connection.client.close();
|
|
149
161
|
}
|
|
150
162
|
});
|
|
151
163
|
}
|
|
@@ -156,7 +168,7 @@ export class MClient {
|
|
|
156
168
|
return yield connection.db.stats();
|
|
157
169
|
}
|
|
158
170
|
finally {
|
|
159
|
-
connection.client.close();
|
|
171
|
+
yield connection.client.close();
|
|
160
172
|
}
|
|
161
173
|
});
|
|
162
174
|
}
|
|
@@ -167,7 +179,7 @@ export class MClient {
|
|
|
167
179
|
return yield connection.db.collections();
|
|
168
180
|
}
|
|
169
181
|
finally {
|
|
170
|
-
connection.client.close();
|
|
182
|
+
yield connection.client.close();
|
|
171
183
|
}
|
|
172
184
|
});
|
|
173
185
|
}
|
|
@@ -25,7 +25,7 @@ __export(mongodbclient_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(mongodbclient_exports);
|
|
27
27
|
var import_uuid = require("uuid");
|
|
28
|
-
var
|
|
28
|
+
var import_mongodb = require("mongodb");
|
|
29
29
|
var MongoConnection = class {
|
|
30
30
|
_client;
|
|
31
31
|
_db;
|
|
@@ -67,8 +67,10 @@ var MClient = class {
|
|
|
67
67
|
return await this.getConnected();
|
|
68
68
|
}
|
|
69
69
|
async getConnected() {
|
|
70
|
-
const client = new MongoClient(this.m_uri, {
|
|
71
|
-
|
|
70
|
+
const client = new import_mongodb.MongoClient(this.m_uri, {
|
|
71
|
+
serverApi: import_mongodb.ServerApiVersion.v1
|
|
72
|
+
});
|
|
73
|
+
return await client.connect().then((client2) => {
|
|
72
74
|
const db = client2.db(this.m_db);
|
|
73
75
|
const collection = db.collection(this.m_collection);
|
|
74
76
|
return new MongoConnection(client2, db, collection);
|
|
@@ -87,15 +89,18 @@ var MClient = class {
|
|
|
87
89
|
{ upsert: true, writeConcern: { w: 1 } }
|
|
88
90
|
);
|
|
89
91
|
} finally {
|
|
90
|
-
connection.client.close();
|
|
92
|
+
await connection.client.close();
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
async read(condition = {}, opt) {
|
|
94
96
|
const connection = await this.getConnected();
|
|
95
97
|
try {
|
|
96
|
-
return await connection.collection.find(
|
|
98
|
+
return await connection.collection.find(
|
|
99
|
+
condition,
|
|
100
|
+
opt
|
|
101
|
+
).toArray();
|
|
97
102
|
} finally {
|
|
98
|
-
connection.client.close();
|
|
103
|
+
await connection.client.close();
|
|
99
104
|
}
|
|
100
105
|
}
|
|
101
106
|
async distinct(key, condition = {}) {
|
|
@@ -103,40 +108,57 @@ var MClient = class {
|
|
|
103
108
|
try {
|
|
104
109
|
return await connection.collection.distinct(
|
|
105
110
|
key,
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
107
111
|
condition
|
|
108
112
|
);
|
|
109
113
|
} finally {
|
|
110
|
-
connection.client.close();
|
|
114
|
+
await connection.client.close();
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
async remove(condition) {
|
|
114
118
|
const connection = await this.getConnected();
|
|
115
119
|
try {
|
|
116
|
-
return await connection.collection.deleteMany(
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
return await connection.collection.deleteMany(
|
|
121
|
+
condition,
|
|
122
|
+
{
|
|
123
|
+
writeConcern: { w: 1 }
|
|
124
|
+
}
|
|
125
|
+
);
|
|
119
126
|
} finally {
|
|
120
|
-
connection.client.close();
|
|
127
|
+
await connection.client.close();
|
|
121
128
|
}
|
|
122
129
|
}
|
|
123
130
|
async stats() {
|
|
124
131
|
const connection = await this.getConnected();
|
|
125
132
|
try {
|
|
126
|
-
|
|
133
|
+
const [collStats] = await connection.collection.aggregate([
|
|
134
|
+
{
|
|
135
|
+
$collStats: {
|
|
136
|
+
latencyStats: {
|
|
137
|
+
histograms: true
|
|
138
|
+
},
|
|
139
|
+
count: {},
|
|
140
|
+
queryExecStats: {},
|
|
141
|
+
storageStats: {
|
|
142
|
+
scale: 1
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
]).toArray();
|
|
147
|
+
return collStats;
|
|
148
|
+
} catch (e) {
|
|
149
|
+
return null;
|
|
127
150
|
} finally {
|
|
128
|
-
connection.client.close();
|
|
151
|
+
await connection.client.close();
|
|
129
152
|
}
|
|
130
153
|
}
|
|
131
154
|
async count(condition = {}) {
|
|
132
155
|
const connection = await this.getConnected();
|
|
133
156
|
try {
|
|
134
157
|
return await connection.collection.countDocuments(
|
|
135
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
136
158
|
condition
|
|
137
159
|
);
|
|
138
160
|
} finally {
|
|
139
|
-
connection.client.close();
|
|
161
|
+
await connection.client.close();
|
|
140
162
|
}
|
|
141
163
|
}
|
|
142
164
|
async insertMany(items) {
|
|
@@ -146,11 +168,14 @@ var MClient = class {
|
|
|
146
168
|
...item
|
|
147
169
|
}));
|
|
148
170
|
try {
|
|
149
|
-
return await connection.collection.insertMany(
|
|
150
|
-
|
|
151
|
-
|
|
171
|
+
return await connection.collection.insertMany(
|
|
172
|
+
savingItems,
|
|
173
|
+
{
|
|
174
|
+
writeConcern: { w: 1 }
|
|
175
|
+
}
|
|
176
|
+
);
|
|
152
177
|
} finally {
|
|
153
|
-
connection.client.close();
|
|
178
|
+
await connection.client.close();
|
|
154
179
|
}
|
|
155
180
|
}
|
|
156
181
|
async dbStats() {
|
|
@@ -158,7 +183,7 @@ var MClient = class {
|
|
|
158
183
|
try {
|
|
159
184
|
return await connection.db.stats();
|
|
160
185
|
} finally {
|
|
161
|
-
connection.client.close();
|
|
186
|
+
await connection.client.close();
|
|
162
187
|
}
|
|
163
188
|
}
|
|
164
189
|
async getCollections() {
|
|
@@ -166,7 +191,7 @@ var MClient = class {
|
|
|
166
191
|
try {
|
|
167
192
|
return await connection.db.collections();
|
|
168
193
|
} finally {
|
|
169
|
-
connection.client.close();
|
|
194
|
+
await connection.client.close();
|
|
170
195
|
}
|
|
171
196
|
}
|
|
172
197
|
};
|
|
@@ -176,8 +201,3 @@ var mongodbclient_default = MClient;
|
|
|
176
201
|
MClient,
|
|
177
202
|
MongoConnection
|
|
178
203
|
});
|
|
179
|
-
/*!
|
|
180
|
-
* @license mongodbclient
|
|
181
|
-
* (c) 2020 tom
|
|
182
|
-
* License: MIT
|
|
183
|
-
*/
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
1
|
// src/mongodbclient.ts
|
|
10
2
|
import { v4 as uuidv4 } from "uuid";
|
|
11
|
-
|
|
3
|
+
import { MongoClient, ServerApiVersion } from "mongodb";
|
|
12
4
|
var MongoConnection = class {
|
|
13
5
|
_client;
|
|
14
6
|
_db;
|
|
@@ -50,8 +42,10 @@ var MClient = class {
|
|
|
50
42
|
return await this.getConnected();
|
|
51
43
|
}
|
|
52
44
|
async getConnected() {
|
|
53
|
-
const client = new MongoClient(this.m_uri, {
|
|
54
|
-
|
|
45
|
+
const client = new MongoClient(this.m_uri, {
|
|
46
|
+
serverApi: ServerApiVersion.v1
|
|
47
|
+
});
|
|
48
|
+
return await client.connect().then((client2) => {
|
|
55
49
|
const db = client2.db(this.m_db);
|
|
56
50
|
const collection = db.collection(this.m_collection);
|
|
57
51
|
return new MongoConnection(client2, db, collection);
|
|
@@ -70,15 +64,18 @@ var MClient = class {
|
|
|
70
64
|
{ upsert: true, writeConcern: { w: 1 } }
|
|
71
65
|
);
|
|
72
66
|
} finally {
|
|
73
|
-
connection.client.close();
|
|
67
|
+
await connection.client.close();
|
|
74
68
|
}
|
|
75
69
|
}
|
|
76
70
|
async read(condition = {}, opt) {
|
|
77
71
|
const connection = await this.getConnected();
|
|
78
72
|
try {
|
|
79
|
-
return await connection.collection.find(
|
|
73
|
+
return await connection.collection.find(
|
|
74
|
+
condition,
|
|
75
|
+
opt
|
|
76
|
+
).toArray();
|
|
80
77
|
} finally {
|
|
81
|
-
connection.client.close();
|
|
78
|
+
await connection.client.close();
|
|
82
79
|
}
|
|
83
80
|
}
|
|
84
81
|
async distinct(key, condition = {}) {
|
|
@@ -86,40 +83,57 @@ var MClient = class {
|
|
|
86
83
|
try {
|
|
87
84
|
return await connection.collection.distinct(
|
|
88
85
|
key,
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
90
86
|
condition
|
|
91
87
|
);
|
|
92
88
|
} finally {
|
|
93
|
-
connection.client.close();
|
|
89
|
+
await connection.client.close();
|
|
94
90
|
}
|
|
95
91
|
}
|
|
96
92
|
async remove(condition) {
|
|
97
93
|
const connection = await this.getConnected();
|
|
98
94
|
try {
|
|
99
|
-
return await connection.collection.deleteMany(
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
return await connection.collection.deleteMany(
|
|
96
|
+
condition,
|
|
97
|
+
{
|
|
98
|
+
writeConcern: { w: 1 }
|
|
99
|
+
}
|
|
100
|
+
);
|
|
102
101
|
} finally {
|
|
103
|
-
connection.client.close();
|
|
102
|
+
await connection.client.close();
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
async stats() {
|
|
107
106
|
const connection = await this.getConnected();
|
|
108
107
|
try {
|
|
109
|
-
|
|
108
|
+
const [collStats] = await connection.collection.aggregate([
|
|
109
|
+
{
|
|
110
|
+
$collStats: {
|
|
111
|
+
latencyStats: {
|
|
112
|
+
histograms: true
|
|
113
|
+
},
|
|
114
|
+
count: {},
|
|
115
|
+
queryExecStats: {},
|
|
116
|
+
storageStats: {
|
|
117
|
+
scale: 1
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]).toArray();
|
|
122
|
+
return collStats;
|
|
123
|
+
} catch (e) {
|
|
124
|
+
return null;
|
|
110
125
|
} finally {
|
|
111
|
-
connection.client.close();
|
|
126
|
+
await connection.client.close();
|
|
112
127
|
}
|
|
113
128
|
}
|
|
114
129
|
async count(condition = {}) {
|
|
115
130
|
const connection = await this.getConnected();
|
|
116
131
|
try {
|
|
117
132
|
return await connection.collection.countDocuments(
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
119
133
|
condition
|
|
120
134
|
);
|
|
121
135
|
} finally {
|
|
122
|
-
connection.client.close();
|
|
136
|
+
await connection.client.close();
|
|
123
137
|
}
|
|
124
138
|
}
|
|
125
139
|
async insertMany(items) {
|
|
@@ -129,11 +143,14 @@ var MClient = class {
|
|
|
129
143
|
...item
|
|
130
144
|
}));
|
|
131
145
|
try {
|
|
132
|
-
return await connection.collection.insertMany(
|
|
133
|
-
|
|
134
|
-
|
|
146
|
+
return await connection.collection.insertMany(
|
|
147
|
+
savingItems,
|
|
148
|
+
{
|
|
149
|
+
writeConcern: { w: 1 }
|
|
150
|
+
}
|
|
151
|
+
);
|
|
135
152
|
} finally {
|
|
136
|
-
connection.client.close();
|
|
153
|
+
await connection.client.close();
|
|
137
154
|
}
|
|
138
155
|
}
|
|
139
156
|
async dbStats() {
|
|
@@ -141,7 +158,7 @@ var MClient = class {
|
|
|
141
158
|
try {
|
|
142
159
|
return await connection.db.stats();
|
|
143
160
|
} finally {
|
|
144
|
-
connection.client.close();
|
|
161
|
+
await connection.client.close();
|
|
145
162
|
}
|
|
146
163
|
}
|
|
147
164
|
async getCollections() {
|
|
@@ -149,7 +166,7 @@ var MClient = class {
|
|
|
149
166
|
try {
|
|
150
167
|
return await connection.db.collections();
|
|
151
168
|
} finally {
|
|
152
|
-
connection.client.close();
|
|
169
|
+
await connection.client.close();
|
|
153
170
|
}
|
|
154
171
|
}
|
|
155
172
|
};
|
|
@@ -159,8 +176,3 @@ export {
|
|
|
159
176
|
MongoConnection,
|
|
160
177
|
mongodbclient_default as default
|
|
161
178
|
};
|
|
162
|
-
/*!
|
|
163
|
-
* @license mongodbclient
|
|
164
|
-
* (c) 2020 tom
|
|
165
|
-
* License: MIT
|
|
166
|
-
*/
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomsd/mongodbclient",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "It's a handy mongodb client for easy-use.",
|
|
5
5
|
"main": "dist/mongodbclient.cjs.js",
|
|
6
6
|
"module": "dist/mongodbclient.esm.js",
|
|
7
7
|
"types": "dist/esm/mongodbclient.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
8
11
|
"scripts": {
|
|
9
12
|
"build": "tsup && tsc --project tsconfig.esm.json",
|
|
10
13
|
"format": "npm run format:src && npm run format:test",
|
|
@@ -40,7 +43,7 @@
|
|
|
40
43
|
"url": "https://github.com/tomsdoo/mongodbclient"
|
|
41
44
|
},
|
|
42
45
|
"dependencies": {
|
|
43
|
-
"mongodb": "
|
|
46
|
+
"mongodb": "6.6.2",
|
|
44
47
|
"uuid": "9.0.1"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
package/.eslintrc-love-temp.cjs
DELETED
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
const rules = {
|
|
2
|
-
'@typescript-eslint/adjacent-overload-signatures': ['error'],
|
|
3
|
-
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
|
|
4
|
-
'@typescript-eslint/await-thenable': ['error'],
|
|
5
|
-
'@typescript-eslint/ban-ts-comment': ['error', {
|
|
6
|
-
'ts-expect-error': 'allow-with-description',
|
|
7
|
-
'ts-ignore': true,
|
|
8
|
-
'ts-nocheck': true,
|
|
9
|
-
'ts-check': false,
|
|
10
|
-
minimumDescriptionLength: 3
|
|
11
|
-
}],
|
|
12
|
-
'@typescript-eslint/ban-tslint-comment': ['error'],
|
|
13
|
-
'@typescript-eslint/ban-types': ['error', {
|
|
14
|
-
extendDefaults: false,
|
|
15
|
-
types: {
|
|
16
|
-
String: {
|
|
17
|
-
message: 'Use string instead',
|
|
18
|
-
fixWith: 'string'
|
|
19
|
-
},
|
|
20
|
-
Boolean: {
|
|
21
|
-
message: 'Use boolean instead',
|
|
22
|
-
fixWith: 'boolean'
|
|
23
|
-
},
|
|
24
|
-
Number: {
|
|
25
|
-
message: 'Use number instead',
|
|
26
|
-
fixWith: 'number'
|
|
27
|
-
},
|
|
28
|
-
Symbol: {
|
|
29
|
-
message: 'Use symbol instead',
|
|
30
|
-
fixWith: 'symbol'
|
|
31
|
-
},
|
|
32
|
-
BigInt: {
|
|
33
|
-
message: 'Use bigint instead',
|
|
34
|
-
fixWith: 'bigint'
|
|
35
|
-
},
|
|
36
|
-
Function: {
|
|
37
|
-
message: [
|
|
38
|
-
'The `Function` type accepts any function-like value.',
|
|
39
|
-
'It provides no type safety when calling the function, which can be a common source of bugs.',
|
|
40
|
-
'It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.',
|
|
41
|
-
'If you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
|
|
42
|
-
].join('\n')
|
|
43
|
-
},
|
|
44
|
-
// object typing
|
|
45
|
-
Object: {
|
|
46
|
-
message: [
|
|
47
|
-
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.',
|
|
48
|
-
'- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.',
|
|
49
|
-
'- If you want a type meaning "any value", you probably want `unknown` instead.'
|
|
50
|
-
].join('\n')
|
|
51
|
-
},
|
|
52
|
-
'{}': {
|
|
53
|
-
message: [
|
|
54
|
-
'`{}` actually means "any non-nullish value".',
|
|
55
|
-
'- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.',
|
|
56
|
-
'- If you want a type meaning "any value", you probably want `unknown` instead.'
|
|
57
|
-
].join('\n')
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}],
|
|
61
|
-
'@typescript-eslint/block-spacing': ['error', 'always'],
|
|
62
|
-
'@typescript-eslint/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
63
|
-
'@typescript-eslint/class-literal-property-style': ['error', 'fields'],
|
|
64
|
-
'@typescript-eslint/comma-dangle': ['error', {
|
|
65
|
-
arrays: 'never',
|
|
66
|
-
objects: 'never',
|
|
67
|
-
imports: 'never',
|
|
68
|
-
exports: 'never',
|
|
69
|
-
functions: 'never',
|
|
70
|
-
enums: 'ignore',
|
|
71
|
-
generics: 'ignore',
|
|
72
|
-
tuples: 'ignore'
|
|
73
|
-
}],
|
|
74
|
-
'@typescript-eslint/comma-spacing': ['error', { before: false, after: true }],
|
|
75
|
-
'@typescript-eslint/consistent-generic-constructors': ['error', 'constructor'],
|
|
76
|
-
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
|
|
77
|
-
'@typescript-eslint/consistent-type-assertions': [
|
|
78
|
-
'error',
|
|
79
|
-
{
|
|
80
|
-
assertionStyle: 'as',
|
|
81
|
-
objectLiteralTypeAssertions: 'never'
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
85
|
-
'@typescript-eslint/consistent-type-exports': ['error', {
|
|
86
|
-
fixMixedExportsWithInlineTypeSpecifier: true
|
|
87
|
-
}],
|
|
88
|
-
'@typescript-eslint/consistent-type-imports': ['error', {
|
|
89
|
-
prefer: 'type-imports',
|
|
90
|
-
disallowTypeAnnotations: true,
|
|
91
|
-
fixStyle: 'inline-type-imports'
|
|
92
|
-
}],
|
|
93
|
-
'@typescript-eslint/dot-notation': ['error',
|
|
94
|
-
{
|
|
95
|
-
allowIndexSignaturePropertyAccess: false,
|
|
96
|
-
allowKeywords: true,
|
|
97
|
-
allowPattern: '',
|
|
98
|
-
allowPrivateClassPropertyAccess: false,
|
|
99
|
-
allowProtectedClassPropertyAccess: false
|
|
100
|
-
}
|
|
101
|
-
],
|
|
102
|
-
'@typescript-eslint/explicit-function-return-type': ['error', {
|
|
103
|
-
allowExpressions: true,
|
|
104
|
-
allowHigherOrderFunctions: true,
|
|
105
|
-
allowTypedFunctionExpressions: true,
|
|
106
|
-
allowDirectConstAssertionInArrowFunctions: true
|
|
107
|
-
}],
|
|
108
|
-
'@typescript-eslint/func-call-spacing': ['error', 'never'],
|
|
109
|
-
'@typescript-eslint/indent': ['error', 2, {
|
|
110
|
-
SwitchCase: 1,
|
|
111
|
-
VariableDeclarator: 1,
|
|
112
|
-
outerIIFEBody: 1,
|
|
113
|
-
MemberExpression: 1,
|
|
114
|
-
FunctionDeclaration: { parameters: 1, body: 1 },
|
|
115
|
-
FunctionExpression: { parameters: 1, body: 1 },
|
|
116
|
-
CallExpression: { arguments: 1 },
|
|
117
|
-
ArrayExpression: 1,
|
|
118
|
-
ObjectExpression: 1,
|
|
119
|
-
ImportDeclaration: 1,
|
|
120
|
-
flatTernaryExpressions: false,
|
|
121
|
-
ignoreComments: false,
|
|
122
|
-
ignoredNodes: [
|
|
123
|
-
'TemplateLiteral *',
|
|
124
|
-
'JSXElement',
|
|
125
|
-
'JSXElement > *',
|
|
126
|
-
'JSXAttribute',
|
|
127
|
-
'JSXIdentifier',
|
|
128
|
-
'JSXNamespacedName',
|
|
129
|
-
'JSXMemberExpression',
|
|
130
|
-
'JSXSpreadAttribute',
|
|
131
|
-
'JSXExpressionContainer',
|
|
132
|
-
'JSXOpeningElement',
|
|
133
|
-
'JSXClosingElement',
|
|
134
|
-
'JSXFragment',
|
|
135
|
-
'JSXOpeningFragment',
|
|
136
|
-
'JSXClosingFragment',
|
|
137
|
-
'JSXText',
|
|
138
|
-
'JSXEmptyExpression',
|
|
139
|
-
'JSXSpreadChild'
|
|
140
|
-
],
|
|
141
|
-
offsetTernaryExpressions: true
|
|
142
|
-
}],
|
|
143
|
-
'@typescript-eslint/key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
144
|
-
'@typescript-eslint/keyword-spacing': ['error', { before: true, after: true }],
|
|
145
|
-
'@typescript-eslint/lines-between-class-members': ['error', 'always', { exceptAfterOverload: true, exceptAfterSingleLine: true }],
|
|
146
|
-
'@typescript-eslint/member-delimiter-style': [
|
|
147
|
-
'error',
|
|
148
|
-
{
|
|
149
|
-
multiline: { delimiter: 'none' },
|
|
150
|
-
singleline: { delimiter: 'comma', requireLast: false }
|
|
151
|
-
}
|
|
152
|
-
],
|
|
153
|
-
'@typescript-eslint/method-signature-style': ['error'],
|
|
154
|
-
'@typescript-eslint/naming-convention': ['error', {
|
|
155
|
-
selector: 'variableLike',
|
|
156
|
-
leadingUnderscore: 'allow',
|
|
157
|
-
trailingUnderscore: 'allow',
|
|
158
|
-
format: ['camelCase', 'PascalCase', 'UPPER_CASE']
|
|
159
|
-
}],
|
|
160
|
-
'@typescript-eslint/no-array-constructor': ['error'],
|
|
161
|
-
'@typescript-eslint/no-base-to-string': ['error'],
|
|
162
|
-
'@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: false, ignoreVoidOperator: false }],
|
|
163
|
-
'@typescript-eslint/no-dupe-class-members': ['error'],
|
|
164
|
-
'@typescript-eslint/no-dynamic-delete': ['error'],
|
|
165
|
-
'@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],
|
|
166
|
-
'@typescript-eslint/no-extra-non-null-assertion': ['error'],
|
|
167
|
-
'@typescript-eslint/no-extra-parens': ['error', 'functions'],
|
|
168
|
-
'@typescript-eslint/no-extraneous-class': ['error', { allowWithDecorator: true }],
|
|
169
|
-
'@typescript-eslint/no-floating-promises': ['error'],
|
|
170
|
-
'@typescript-eslint/no-for-in-array': ['error'],
|
|
171
|
-
'@typescript-eslint/no-implied-eval': ['error'],
|
|
172
|
-
'@typescript-eslint/no-invalid-void-type': ['error'],
|
|
173
|
-
'@typescript-eslint/no-loss-of-precision': ['error'],
|
|
174
|
-
'@typescript-eslint/no-misused-new': ['error'],
|
|
175
|
-
'@typescript-eslint/no-misused-promises': ['error'],
|
|
176
|
-
'@typescript-eslint/no-namespace': ['error'],
|
|
177
|
-
'@typescript-eslint/no-non-null-asserted-optional-chain': ['error'],
|
|
178
|
-
'@typescript-eslint/no-non-null-assertion': ['error'],
|
|
179
|
-
'@typescript-eslint/no-redeclare': ['error', { builtinGlobals: false }],
|
|
180
|
-
'@typescript-eslint/no-this-alias': ['error', { allowDestructuring: true }],
|
|
181
|
-
'@typescript-eslint/no-throw-literal': ['error'],
|
|
182
|
-
'@typescript-eslint/no-unnecessary-boolean-literal-compare': ['error'],
|
|
183
|
-
'@typescript-eslint/no-unnecessary-type-assertion': ['error'],
|
|
184
|
-
'@typescript-eslint/no-unnecessary-type-constraint': ['error'],
|
|
185
|
-
'@typescript-eslint/no-unsafe-argument': ['error'],
|
|
186
|
-
'@typescript-eslint/no-unused-expressions': ['error', {
|
|
187
|
-
allowShortCircuit: true,
|
|
188
|
-
allowTernary: true,
|
|
189
|
-
allowTaggedTemplates: true,
|
|
190
|
-
enforceForJSX: false
|
|
191
|
-
}],
|
|
192
|
-
'@typescript-eslint/no-unused-vars': ['error', {
|
|
193
|
-
args: 'none',
|
|
194
|
-
caughtErrors: 'none',
|
|
195
|
-
ignoreRestSiblings: true,
|
|
196
|
-
vars: 'all'
|
|
197
|
-
}],
|
|
198
|
-
'@typescript-eslint/no-use-before-define': ['error', {
|
|
199
|
-
functions: false,
|
|
200
|
-
classes: false,
|
|
201
|
-
enums: false,
|
|
202
|
-
variables: false,
|
|
203
|
-
typedefs: false
|
|
204
|
-
}],
|
|
205
|
-
'@typescript-eslint/no-useless-constructor': ['error'],
|
|
206
|
-
'@typescript-eslint/no-var-requires': ['error'],
|
|
207
|
-
'@typescript-eslint/non-nullable-type-assertion-style': ['error'],
|
|
208
|
-
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
|
|
209
|
-
'@typescript-eslint/prefer-function-type': ['error'],
|
|
210
|
-
'@typescript-eslint/prefer-includes': ['error'],
|
|
211
|
-
'@typescript-eslint/prefer-nullish-coalescing': ['error', { ignoreConditionalTests: false, ignoreMixedLogicalExpressions: false }],
|
|
212
|
-
'@typescript-eslint/prefer-optional-chain': ['error'],
|
|
213
|
-
'@typescript-eslint/prefer-promise-reject-errors': ['error'],
|
|
214
|
-
'@typescript-eslint/prefer-readonly': ['error'],
|
|
215
|
-
'@typescript-eslint/prefer-reduce-type-parameter': ['error'],
|
|
216
|
-
'@typescript-eslint/prefer-return-this-type': ['error'],
|
|
217
|
-
'@typescript-eslint/prefer-ts-expect-error': ['error'],
|
|
218
|
-
'@typescript-eslint/promise-function-async': ['error'],
|
|
219
|
-
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
|
|
220
|
-
'@typescript-eslint/require-array-sort-compare': ['error', { ignoreStringArrays: true }],
|
|
221
|
-
'@typescript-eslint/restrict-plus-operands': ['error', { skipCompoundAssignments: false }],
|
|
222
|
-
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true }],
|
|
223
|
-
'@typescript-eslint/return-await': ['error', 'always'],
|
|
224
|
-
'@typescript-eslint/semi': ['error', 'never'],
|
|
225
|
-
'@typescript-eslint/space-before-blocks': ['error', 'always'],
|
|
226
|
-
'@typescript-eslint/space-before-function-paren': ['error', 'always'],
|
|
227
|
-
'@typescript-eslint/space-infix-ops': ['error'],
|
|
228
|
-
'@typescript-eslint/strict-boolean-expressions': ['error', {
|
|
229
|
-
allowString: false,
|
|
230
|
-
allowNumber: false,
|
|
231
|
-
allowNullableObject: false,
|
|
232
|
-
allowNullableBoolean: false,
|
|
233
|
-
allowNullableString: false,
|
|
234
|
-
allowNullableNumber: false,
|
|
235
|
-
allowAny: false
|
|
236
|
-
}],
|
|
237
|
-
'@typescript-eslint/triple-slash-reference': ['error', { lib: 'never', path: 'never', types: 'never' }],
|
|
238
|
-
'@typescript-eslint/type-annotation-spacing': ['error'],
|
|
239
|
-
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: false }],
|
|
240
|
-
|
|
241
|
-
'accessor-pairs': ['error', { setWithoutGet: true, getWithoutSet: false, enforceForClassMembers: true }],
|
|
242
|
-
'array-bracket-spacing': ['error', 'never'],
|
|
243
|
-
'array-callback-return': ['error', {
|
|
244
|
-
allowImplicit: false,
|
|
245
|
-
allowVoid: false,
|
|
246
|
-
checkForEach: false
|
|
247
|
-
}],
|
|
248
|
-
'arrow-spacing': ['error', { before: true, after: true }],
|
|
249
|
-
'comma-style': ['error', 'last'],
|
|
250
|
-
'computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
|
|
251
|
-
'constructor-super': ['error'],
|
|
252
|
-
curly: ['error', 'multi-line'],
|
|
253
|
-
'default-case-last': ['error'],
|
|
254
|
-
'dot-location': ['error', 'property'],
|
|
255
|
-
'eol-last': ['error'],
|
|
256
|
-
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
257
|
-
'generator-star-spacing': ['error', { before: true, after: true }],
|
|
258
|
-
'multiline-ternary': ['error', 'always-multiline'],
|
|
259
|
-
'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
|
|
260
|
-
'new-parens': ['error'],
|
|
261
|
-
'no-async-promise-executor': ['error'],
|
|
262
|
-
'no-caller': ['error'],
|
|
263
|
-
'no-case-declarations': ['error'],
|
|
264
|
-
'no-class-assign': ['error'],
|
|
265
|
-
'no-compare-neg-zero': ['error'],
|
|
266
|
-
'no-cond-assign': ['error'],
|
|
267
|
-
'no-const-assign': ['error'],
|
|
268
|
-
'no-constant-condition': ['error', { checkLoops: false }],
|
|
269
|
-
'no-control-regex': ['error'],
|
|
270
|
-
'no-debugger': ['error'],
|
|
271
|
-
'no-delete-var': ['error'],
|
|
272
|
-
'no-dupe-args': ['error'],
|
|
273
|
-
'no-dupe-keys': ['error'],
|
|
274
|
-
'no-duplicate-case': ['error'],
|
|
275
|
-
'no-useless-backreference': ['error'],
|
|
276
|
-
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
277
|
-
'no-empty-character-class': ['error'],
|
|
278
|
-
'no-empty-pattern': ['error'],
|
|
279
|
-
'no-eval': ['error'],
|
|
280
|
-
'no-ex-assign': ['error'],
|
|
281
|
-
'no-extend-native': ['error'],
|
|
282
|
-
'no-extra-bind': ['error'],
|
|
283
|
-
'no-extra-boolean-cast': ['error'],
|
|
284
|
-
'no-fallthrough': ['error'],
|
|
285
|
-
'no-floating-decimal': ['error'],
|
|
286
|
-
'no-func-assign': ['error'],
|
|
287
|
-
'no-global-assign': ['error'],
|
|
288
|
-
'no-import-assign': ['error'],
|
|
289
|
-
'no-invalid-regexp': ['error'],
|
|
290
|
-
'no-irregular-whitespace': ['error'],
|
|
291
|
-
'no-iterator': ['error'],
|
|
292
|
-
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
|
293
|
-
'no-lone-blocks': ['error'],
|
|
294
|
-
'no-misleading-character-class': ['error'],
|
|
295
|
-
'no-prototype-builtins': ['error'],
|
|
296
|
-
'no-useless-catch': ['error'],
|
|
297
|
-
'no-mixed-operators': ['error', {
|
|
298
|
-
groups: [
|
|
299
|
-
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
|
|
300
|
-
['&&', '||'],
|
|
301
|
-
['in', 'instanceof']
|
|
302
|
-
],
|
|
303
|
-
allowSamePrecedence: true
|
|
304
|
-
}],
|
|
305
|
-
'no-mixed-spaces-and-tabs': ['error'],
|
|
306
|
-
'no-multi-spaces': ['error'],
|
|
307
|
-
'no-multi-str': ['error'],
|
|
308
|
-
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
309
|
-
'no-new': ['error'],
|
|
310
|
-
'no-new-func': ['error'],
|
|
311
|
-
'no-new-object': ['error'],
|
|
312
|
-
'no-new-symbol': ['error'],
|
|
313
|
-
'no-new-wrappers': ['error'],
|
|
314
|
-
'no-obj-calls': ['error'],
|
|
315
|
-
'no-octal': ['error'],
|
|
316
|
-
'no-octal-escape': ['error'],
|
|
317
|
-
'no-proto': ['error'],
|
|
318
|
-
'no-regex-spaces': ['error'],
|
|
319
|
-
'no-return-assign': ['error', 'except-parens'],
|
|
320
|
-
'no-self-assign': ['error', { props: true }],
|
|
321
|
-
'no-self-compare': ['error'],
|
|
322
|
-
'no-sequences': ['error'],
|
|
323
|
-
'no-shadow-restricted-names': ['error'],
|
|
324
|
-
'no-sparse-arrays': ['error'],
|
|
325
|
-
'no-tabs': ['error'],
|
|
326
|
-
'no-template-curly-in-string': ['error'],
|
|
327
|
-
'no-this-before-super': ['error'],
|
|
328
|
-
'no-trailing-spaces': ['error'],
|
|
329
|
-
'no-undef-init': ['error'],
|
|
330
|
-
'no-unexpected-multiline': ['error'],
|
|
331
|
-
'no-unmodified-loop-condition': ['error'],
|
|
332
|
-
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
333
|
-
'no-unreachable': ['error'],
|
|
334
|
-
'no-unreachable-loop': ['error'],
|
|
335
|
-
'no-unsafe-finally': ['error'],
|
|
336
|
-
'no-unsafe-negation': ['error'],
|
|
337
|
-
'no-useless-call': ['error'],
|
|
338
|
-
'no-useless-computed-key': ['error'],
|
|
339
|
-
'no-useless-escape': ['error'],
|
|
340
|
-
'no-useless-rename': ['error'],
|
|
341
|
-
'no-useless-return': ['error'],
|
|
342
|
-
'no-var': ['warn'],
|
|
343
|
-
'no-void': ['error', { allowAsStatement: true }],
|
|
344
|
-
'no-whitespace-before-property': ['error'],
|
|
345
|
-
'no-with': ['error'],
|
|
346
|
-
'object-curly-newline': ['error', { multiline: true, consistent: true }],
|
|
347
|
-
'object-property-newline': ['error', { allowMultiplePropertiesPerLine: true, allowAllPropertiesOnSameLine: false }],
|
|
348
|
-
'object-shorthand': ['warn', 'properties'],
|
|
349
|
-
'one-var': ['error', { initialized: 'never' }],
|
|
350
|
-
'operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before', '|>': 'before' } }],
|
|
351
|
-
'padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
|
|
352
|
-
'prefer-const': ['error', { destructuring: 'all', ignoreReadBeforeAssign: false }],
|
|
353
|
-
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
|
|
354
|
-
'quote-props': ['error', 'as-needed'],
|
|
355
|
-
'rest-spread-spacing': ['error', 'never'],
|
|
356
|
-
'semi-spacing': ['error', { before: false, after: true }],
|
|
357
|
-
'space-in-parens': ['error', 'never'],
|
|
358
|
-
'space-unary-ops': ['error', { words: true, nonwords: false }],
|
|
359
|
-
'spaced-comment': ['error', 'always', {
|
|
360
|
-
line: { markers: ['*package', '!', '/', ',', '='] },
|
|
361
|
-
block: { balanced: true, markers: ['*package', '!', ',', ':', '::', 'flow-include'], exceptions: ['*'] }
|
|
362
|
-
}],
|
|
363
|
-
'symbol-description': ['error'],
|
|
364
|
-
'template-curly-spacing': ['error', 'never'],
|
|
365
|
-
'template-tag-spacing': ['error', 'never'],
|
|
366
|
-
'unicode-bom': ['error', 'never'],
|
|
367
|
-
'use-isnan': ['error', {
|
|
368
|
-
enforceForSwitchCase: true,
|
|
369
|
-
enforceForIndexOf: true
|
|
370
|
-
}],
|
|
371
|
-
'valid-typeof': ['error', { requireStringLiterals: true }],
|
|
372
|
-
'wrap-iife': ['error', 'any', { functionPrototypeMethods: true }],
|
|
373
|
-
'yield-star-spacing': ['error', 'both'],
|
|
374
|
-
yoda: ['error', 'never'],
|
|
375
|
-
|
|
376
|
-
'import/export': ['error'],
|
|
377
|
-
'import/first': ['error'],
|
|
378
|
-
'import/no-absolute-path': ['error', { esmodule: true, commonjs: true, amd: false }],
|
|
379
|
-
'import/no-duplicates': ['error'],
|
|
380
|
-
'import/no-named-default': ['error'],
|
|
381
|
-
'import/no-webpack-loader-syntax': ['error'],
|
|
382
|
-
|
|
383
|
-
'n/handle-callback-err': ['error', '^(err|error)$'],
|
|
384
|
-
'n/no-callback-literal': ['error'],
|
|
385
|
-
'n/no-deprecated-api': ['error'],
|
|
386
|
-
'n/no-exports-assign': ['error'],
|
|
387
|
-
'n/no-new-require': ['error'],
|
|
388
|
-
'n/no-path-concat': ['error'],
|
|
389
|
-
'n/process-exit-as-throw': ['error'],
|
|
390
|
-
|
|
391
|
-
'promise/param-names': ['error']
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
// const eslintRuleNames = [...(new TSESLint.Linter()).getRules().keys()]
|
|
395
|
-
// const namesOfEslintRulesForWhichWeAreUsingTsEquivalents = eslintRuleNames
|
|
396
|
-
// .filter(name => Object.hasOwn(rules, `@typescript-eslint/${name}`))
|
|
397
|
-
|
|
398
|
-
const config = {
|
|
399
|
-
plugins: [
|
|
400
|
-
'@typescript-eslint',
|
|
401
|
-
'import',
|
|
402
|
-
'n',
|
|
403
|
-
'promise'
|
|
404
|
-
],
|
|
405
|
-
parser: '@typescript-eslint/parser',
|
|
406
|
-
parserOptions: {
|
|
407
|
-
project: true
|
|
408
|
-
},
|
|
409
|
-
rules: {
|
|
410
|
-
// ...Object.fromEntries(namesOfEslintRulesForWhichWeAreUsingTsEquivalents.map(name => [name, ['off']])),
|
|
411
|
-
...rules
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
module.exports = config;
|
package/.eslintrc.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"es2021": true,
|
|
4
|
-
"node": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"./.eslintrc-love-temp.cjs",
|
|
8
|
-
"prettier"
|
|
9
|
-
],
|
|
10
|
-
"overrides": [],
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"ecmaVersion": "latest",
|
|
13
|
-
"sourceType": "module",
|
|
14
|
-
"project": "./tsconfig.base.json"
|
|
15
|
-
},
|
|
16
|
-
"rules": {}
|
|
17
|
-
}
|
package/tsup.config.js
DELETED