Skip to content

Commit 0a71c9b

Browse files
committed
Upgrade dependencies, 1st step
1 parent a044242 commit 0a71c9b

12 files changed

+1763
-6149
lines changed

.eslintrc.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,16 @@ module.exports = {
2323
plugins: ['@typescript-eslint/eslint-plugin'],
2424
parser: '@typescript-eslint/parser',
2525
parserOptions: {
26-
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
27-
sourceType: 'module', // Allows for the use of imports
26+
ecmaVersion: 2022,
27+
sourceType: 'module',
2828
tsconfigRootDir: __dirname,
2929
project: ['./tsconfig.eslint.json'],
3030
},
3131
rules: {
3232
'import/no-extraneous-dependencies': warn,
33-
34-
// Temporal?
35-
'no-console': warn,
36-
'no-return-await': warn,
33+
'no-console': error,
3734
'no-unused-vars': off,
38-
'@typescript-eslint/no-unused-vars': off,
35+
'@typescript-eslint/no-unused-vars': error,
3936
eqeqeq: [error, 'smart'],
4037
'no-else-return': [
4138
error,
@@ -59,7 +56,6 @@ module.exports = {
5956
},
6057
],
6158
camelcase: off,
62-
'@typescript-eslint/camelcase': off,
6359
'require-await': off,
6460
'@typescript-eslint/require-await': off,
6561
'@typescript-eslint/indent': off,
@@ -71,7 +67,6 @@ module.exports = {
7167
'@typescript-eslint/explicit-function-return-type': off,
7268
'@typescript-eslint/no-var-requires': off,
7369
'@typescript-eslint/no-empty-function': off,
74-
'@typescript-eslint/no-object-literal-type-assertion': off,
7570
'@typescript-eslint/no-floating-promises': error,
7671
},
7772
overrides: [
@@ -90,7 +85,10 @@ module.exports = {
9085
'tests/**/*.ts',
9186
'__tests__/**/*.js',
9287
'__tests__/**/*.ts',
93-
'jest.setup.js',
88+
'jest.*.js',
89+
'jest.*.ts',
90+
'.*.ts',
91+
'.*.js',
9492
],
9593

9694
// https://eslint.org/docs/user-guide/configuring#specifying-environments
@@ -99,15 +97,16 @@ module.exports = {
9997
},
10098

10199
// Can't extend in overrides: https://github.com/eslint/eslint/issues/8813
102-
// "extends": ["plugin:jest/recommended"]
100+
extends: ['plugin:jest/recommended'],
103101
plugins: ['jest'],
104102
rules: {
105103
'no-restricted-imports': off,
106-
'jest/no-disabled-tests': warn,
107-
'jest/no-focused-tests': error,
108-
'jest/no-identical-title': error,
109-
'jest/prefer-to-have-length': warn,
110-
'jest/valid-expect': error,
104+
'jest/expect-expect': [
105+
error,
106+
{
107+
assertFunctionNames: ['expect', 'fc.assert'],
108+
},
109+
],
111110
},
112111
},
113112
],

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,3 @@ repos: #The order matters, we want prospector to run after all the sorting was d
1919
# File normalization
2020
- id: end-of-file-fixer
2121
- id: trailing-whitespace
22-
- repo: https://github.com/prettier/prettier
23-
rev: '6b22977cb56127cc10e04425b0eca7c5eb304e6e' # Use the sha or tag you want to point at
24-
hooks:
25-
- id: prettier

.prettierrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/** @type {import("@types/prettier").Options} */
1+
//@ts-check
2+
/** @type {import("prettier").Options} */
23
const options = {
34
semi: true,
45
trailingComma: 'all',

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"recommendations": [
33
"dbaeumer.vscode-eslint",
4-
"esbenp.prettier-vscode",
54
"ghmcadams.lintlens",
65
"visualstudioexptteam.vscodeintellicode",
76
"wix.vscode-import-cost",

.vscode/settings.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
{
2-
"eslint.validate": ["typescript", "typescriptreact"],
2+
"eslint.validate": [
3+
"typescript",
4+
"typescriptreact"
5+
],
36
"editor.formatOnSave": true,
4-
"editor.defaultFormatter": "esbenp.prettier-vscode",
7+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
58
"[javascript]": {
6-
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
10+
},
11+
"jest.jestCommandLine": "npm test -- ",
12+
"jest.runMode": {
13+
"type": "on-demand"
714
}
815
}

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,10 @@ Example of typescript, eslint, and jest with property based testing.
55
Possibly, you might want to delete the `.pre-commit-config.yaml` file if you are not using python anywhere.
66

77
This is only tested with certain versions of node and npm, it might work with others, disable the `engine-strict=true` in the `.npmrc` file at your discretion.
8+
9+
10+
## Check upgrades
11+
12+
```bash
13+
npx npm-check -u
14+
```
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//@ts-check
2-
/** @type {Partial<import("@jest/types").Config.InitialOptions>} */
3-
const config = {
1+
import type { JestConfigWithTsJest } from 'ts-jest';
2+
3+
const config: JestConfigWithTsJest = {
44
preset: 'ts-jest',
55
testRegex: ['/tests/.*tests?.[jt]sx?', '/__tests__/.*tests?.[jt]sx?', '.*.(spec|test).[jt]sx?'],
66
// I dono't think we need to run the spec multiple times.. the functional test on tests/ maybe.
@@ -11,7 +11,7 @@ const config = {
1111
verbose: true,
1212
// Important to use the AfterEnv to have the jest timeout and all the other settings inside that file to be correctly understood
1313
// See the difference between setupFiles and setupFilesAfterEnv to see the difference.
14-
setupFilesAfterEnv: ['./jest.setup.js'],
14+
setupFilesAfterEnv: ['./jest.setup.ts'],
1515
};
1616

1717
module.exports = config;

jest.setup.js renamed to jest.setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* https://github.com/dubzzz/fast-check/blob/1ceb2b982b754b99aef8d763723206605b67451e/example/jest.setup.js
44
*/
55

6-
const fc = require('fast-check');
6+
import fc from 'fast-check';
77

88
// Default timeout of 60s
99
const JestTimeoutMs = 60000;
@@ -13,8 +13,8 @@ const verbose =
1313
process.env.DEBUG === undefined
1414
? fc.VerbosityLevel.None
1515
: process.env.DEBUG !== '*'
16-
? fc.VerbosityLevel.Verbose
17-
: fc.VerbosityLevel.VeryVerbose;
16+
? fc.VerbosityLevel.Verbose
17+
: fc.VerbosityLevel.VeryVerbose;
1818

1919
jest.setTimeout(JestTimeoutMs);
2020
fc.configureGlobal({

0 commit comments

Comments
 (0)