Skip to content

style: Sync tooling configuration from 4.0 branch #2553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .eslintrc

This file was deleted.

25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 2017
},
"plugins": [
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:prettier/recommended"
],
"env": {
"node": true,
"mocha": true,
"es6": true
},
"rules": {
"prettier/prettier": "error",

"no-console": "off",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"strict": ["error", "global"]
}
}
2 changes: 1 addition & 1 deletion .evergreen/run-ocsp-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ export NVM_DIR="${PROJECT_DIRECTORY}/node-artifacts/nvm"
MONGODB_UNIFIED_TOPOLOGY=${UNIFIED} \
OCSP_TLS_SHOULD_SUCCEED=${OCSP_TLS_SHOULD_SUCCEED} \
CA_FILE=${CA_FILE} \
npx mocha --opts '{}' test/manual/ocsp_support.test.js
npx mocha --no-config test/manual/ocsp_support.test.js
7 changes: 7 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extension": ["js"],
"file": "test/tools/runner",
"ui": "test/tools/runner/metadata_ui.js",
"recursive": true,
"timeout": 60000
}
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"tabWidth": 2,
"printWidth": 100,
"arrowParens": "avoid",
"trailingComma": "none"
}
2 changes: 1 addition & 1 deletion lib/cmap/connection_pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const VALID_POOL_OPTIONS = new Set([

function resolveOptions(options, defaults) {
const newOptions = Array.from(VALID_POOL_OPTIONS).reduce((obj, key) => {
if (options.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(options, key)) {
obj[key] = options[key];
}

Expand Down
1 change: 1 addition & 0 deletions lib/core/sdam/topology_description.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class TopologyDescription {
if (descriptionsWithError.length > 0) {
return descriptionsWithError[0].error;
}
return undefined;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/core/topologies/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ var eventHandler = function(self, event) {
event === 'timeout' ||
event === 'reconnect' ||
event === 'attemptReconnect' ||
'reconnectFailed'
event === 'reconnectFailed'
) {
// Remove server instance from accounting
if (
Expand Down
1 change: 1 addition & 0 deletions lib/gridfs/grid_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ var GridStore = function GridStore(db, id, filename, mode, options) {
},
set: function(value) {
if (!(this.mode[0] === 'w' && this.position === 0 && this.uploadDate == null)) {
// eslint-disable-next-line no-self-assign
this.internalChunkSize = this.internalChunkSize;
} else {
this.internalChunkSize = value;
Expand Down
2 changes: 1 addition & 1 deletion lib/operations/admin_ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function validateCollection(admin, collectionName, options, callback) {

// Decorate command with extra options
for (let i = 0; i < keys.length; i++) {
if (options.hasOwnProperty(keys[i]) && keys[i] !== 'session') {
if (Object.prototype.hasOwnProperty.call(options, keys[i]) && keys[i] !== 'session') {
command[keys[i]] = options[keys[i]];
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/operations/validate_collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ValidateCollectionOperation extends CommandOperation {
let command = { validate: collectionName };
const keys = Object.keys(options);
for (let i = 0; i < keys.length; i++) {
if (options.hasOwnProperty(keys[i]) && keys[i] !== 'session') {
if (Object.prototype.hasOwnProperty.call(options, keys[i]) && keys[i] !== 'session') {
command[keys[i]] = options[keys[i]];
}
}
Expand Down
5 changes: 4 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,10 @@ function deprecateOptions(config, fn) {
}

config.deprecatedOptions.forEach(deprecatedOption => {
if (options.hasOwnProperty(deprecatedOption) && !optionsWarned.has(deprecatedOption)) {
if (
Object.prototype.hasOwnProperty.call(options, deprecatedOption) &&
!optionsWarned.has(deprecatedOption)
) {
optionsWarned.add(deprecatedOption);
const msg = msgHandler(config.name, deprecatedOption);
emitDeprecationWarning(msg);
Expand Down
Loading