Skip to content

Commit

Permalink
feat: convert the entire codebase to TypeScript
Browse files Browse the repository at this point in the history
This is the first stage of converting the entire codebase over to
TypeScript. The goals of this step were to preserve history as
well as functional output of the compilation step. Here is a
summary of the commits involved:

 - move all files to `src`, preserving history
   this also maintains a copy of the original js source in the `lib`
   folder (without history) so we can compare the transpiled output
   for potential issues
 - add type information to all types
 - move index to `src` folder for ease of future testing
 - run tests against transpiled module code
 - fix all linting issues with ts conversion
 - remove move script and save ts-convert script for later use
 - fix running manual tests with ts codebase
 - ensure we run the ts pipeline before publish
 - bump typescript version, fix last outstanding issue
 - `prepublish` => `prepublishOnly`

NODE-1452
  • Loading branch information
mbroadst committed Jul 3, 2020
1 parent 2fda204 commit 272bc18
Show file tree
Hide file tree
Showing 267 changed files with 5,326 additions and 3,580 deletions.
48 changes: 33 additions & 15 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
{
"extends": ["eslint:recommended", "plugin:prettier/recommended", "plugin:jsdoc/recommended"],
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018
},
"plugins": [
"@typescript-eslint",
"prettier",
"promise",
"jsdoc"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:jsdoc/recommended"
],
"env": {
"node": true,
"mocha": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"plugins": ["prettier", "promise", "jsdoc"],
"rules": {
"prettier/prettier": "error",

Expand All @@ -20,7 +34,6 @@
],
"jsdoc/require-jsdoc": "off",
"jsdoc/no-undefined-types": "off",

"jsdoc/require-param": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-returns": "off",
Expand All @@ -31,16 +44,21 @@
"no-console": "off",
"eqeqeq": ["error", "always", { "null": "ignore" }],
"strict": ["error", "global"],
"promise/no-native": "error"
"promise/no-native": "error",

// TBD
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-var-requires": "off",
"no-var": "off",
"prefer-const": "off",
"prefer-spread": "off",
"prefer-rest-params": "off"
},
"overrides": [
{
"files": ["test/**/*.js"],
"rules": {
"promise/no-native": "off"
}
}
],
"settings": {
"jsdoc": {
"check-types": false,
Expand Down
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
npm run check:ocsp
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ build/Release
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
yarn.lock
lib/
8 changes: 8 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extension": ["js"],
"require": "ts-node/register",
"file": "test/tools/runner",
"ui": "test/tools/runner/metadata_ui.js",
"recursive": true,
"timeout": 60000
}
76 changes: 0 additions & 76 deletions index.js

This file was deleted.

28 changes: 0 additions & 28 deletions lib/cmap/auth/defaultAuthProviders.js

This file was deleted.

19 changes: 0 additions & 19 deletions lib/cmap/wire_protocol/constants.js

This file was deleted.

18 changes: 0 additions & 18 deletions lib/cmap/wire_protocol/index.js

This file was deleted.

10 changes: 0 additions & 10 deletions lib/constants.js

This file was deleted.

13 changes: 0 additions & 13 deletions lib/cursor/index.js

This file was deleted.

25 changes: 0 additions & 25 deletions lib/operations/delete_many.js

This file was deleted.

25 changes: 0 additions & 25 deletions lib/operations/delete_one.js

This file was deleted.

23 changes: 0 additions & 23 deletions lib/operations/drop_indexes.js

This file was deleted.

39 changes: 0 additions & 39 deletions lib/operations/index_exists.js

This file was deleted.

Loading

0 comments on commit 272bc18

Please sign in to comment.