Skip to content

Commit 79df553

Browse files
author
Thomas Reggi
authoredOct 21, 2020
test: removes destructuring, spread, rest syntax and adds lint rules
NODE-2851
1 parent a6e7caf commit 79df553

File tree

5 files changed

+5320
-3757
lines changed

5 files changed

+5320
-3757
lines changed
 

‎.eslintrc.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"ecmaVersion": 2017
55
},
66
"plugins": [
7-
"prettier"
7+
"prettier",
8+
"es"
89
],
910
"extends": [
1011
"eslint:recommended",
@@ -17,9 +18,12 @@
1718
},
1819
"rules": {
1920
"prettier/prettier": "error",
20-
21+
"es/no-destructuring": "error",
22+
"es/no-rest-spread-properties": "error",
23+
"es/no-spread-elements": "error",
2124
"no-console": "off",
2225
"eqeqeq": ["error", "always", { "null": "ignore" }],
2326
"strict": ["error", "global"]
24-
}
27+
},
28+
"ignorePatterns": ["test/benchmarks/*.js", "test/examples/*.js"]
2529
}

‎package-lock.json

+5,304-3,749
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"coveralls": "^2.11.6",
3939
"eslint": "^7.10.0",
4040
"eslint-config-prettier": "^6.11.0",
41+
"eslint-plugin-es": "^3.0.1",
4142
"eslint-plugin-prettier": "^3.1.3",
4243
"istanbul": "^0.4.5",
4344
"jsdoc": "3.5.5",

‎test/functional/readpreference.test.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const setupDatabase = require('./shared').setupDatabase;
66
const withMonitoredClient = require('./shared').withMonitoredClient;
77
const expect = require('chai').expect;
88
const ReadPreference = require('../../lib/core/topologies/read_preference');
9-
const { withClient } = require('./shared');
9+
const withClient = require('./shared').withClient;
1010

1111
describe('ReadPreference', function() {
1212
before(function() {
@@ -702,7 +702,9 @@ describe('ReadPreference', function() {
702702
return withClient(client, (client, done) => {
703703
const db = client.db(configuration.db);
704704
const args = methods[operation];
705-
const [parentId, method] = operation.split('#');
705+
const split = operation.split('#');
706+
const parentId = split[0];
707+
const method = split[1];
706708
const collection = db.collection(collectionName);
707709
const parent = parentId === 'Collection' ? collection : parentId === 'Db' ? db : null;
708710
const selectServerSpy = this.sinon.spy(Topology.prototype, 'selectServer');
@@ -720,7 +722,8 @@ describe('ReadPreference', function() {
720722
}
721723
done();
722724
};
723-
parent[method].apply(parent, [...args, callback]);
725+
args.push(callback);
726+
parent[method].apply(parent, args);
724727
});
725728
}
726729
});

‎test/node-next/es2018/cursor_async_iterator.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
const { expect } = require('chai');
4-
const { MongoError } = require('../../../index');
3+
const expect = require('chai').expect;
4+
const MongoError = require('../../../index').MongoError;
55

66
describe('Cursor Async Iterator Tests', function() {
77
let client, collection;

0 commit comments

Comments
 (0)
Please sign in to comment.