Skip to content

Commit 454bd1b

Browse files
authored
chore: enable TypeScript strict mode (#394)
Enable TypeScript strict mode for all source files and some tests. As part of that: - Update TypeScript itself to the latest version - Update the eslint plugins for TypeScript to the latest version - Update the eslint config to account for that - Update several dependencies to versions that ship TS definitions - Add devDependencies for several `@types/...` packages - Update the TypeScript target to ES2018 - This is much nicer to inspect when looking at the generated code, and in particular does not require transpiling async functions
1 parent 4748db6 commit 454bd1b

File tree

156 files changed

+2914
-1193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+2914
-1193
lines changed

config/eslintrc.base.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ module.exports = {
2121
'@typescript-eslint/no-explicit-any': 0,
2222
'@typescript-eslint/no-var-requires': 0, // seems necessary to import less files
2323
'@typescript-eslint/no-unused-vars': 2,
24+
'@typescript-eslint/explicit-module-boundary-types': 0,
25+
'@typescript-eslint/ban-types': 0,
2426
'mocha/no-skipped-tests': 1,
2527
'mocha/no-exclusive-tests': 2,
2628
'semi': 0,
2729
'@typescript-eslint/semi': [2, 'always'],
28-
'no-console': [1, { allow: ['warn', 'error', 'info'] }]
30+
'no-console': [1, { allow: ['warn', 'error', 'info'] }],
31+
'no-shadow': 0,
32+
'no-use-before-define': 0
2933
},
3034
overrides: [{
3135
files: ['**/*.js'],

config/tsconfig.base.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
"esModuleInterop": true,
44
"downlevelIteration": true,
55
"sourceMap": true,
6-
"strictNullChecks": false,
6+
7+
"strict": true,
8+
"noUnusedLocals": true,
9+
"noUnusedParameters": true,
10+
"noImplicitReturns": true,
11+
712
"declaration": true,
813
"removeComments": true,
9-
"target": "ES5"
14+
"target": "es2018",
15+
"lib": ["es2018"],
16+
"module": "commonjs",
17+
"moduleResolution": "node"
1018
}
1119
}

config/tsconfig.test.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"esModuleInterop": true,
4+
"downlevelIteration": true,
5+
"strict": false,
6+
"experimentalDecorators": true,
7+
"target": "es2018",
8+
"lib": ["es2018"],
9+
"module": "commonjs",
10+
"moduleResolution": "node"
11+
}
12+
}

0 commit comments

Comments
 (0)