Skip to content

Commit 028cd45

Browse files
authored
feat(node): drop support for node 16 (#71)
BREAKING CHANGE: Please use Node 18 or higher
1 parent b865c84 commit 028cd45

25 files changed

+3559
-8579
lines changed

.eslintrc

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
node-version: [16.x, 20.x]
16+
node-version: [18.x, 22.x]
1717
steps:
1818
- uses: actions/checkout@v2
1919
- uses: actions/setup-node@v2

.prettierrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
{
2-
"singleQuote": true,
3-
"printWidth": 150
4-
}
1+
{ "singleQuote": true }

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"args": [
3838
"--no-timeout",
3939
"--colors",
40+
"--bail",
4041
"${workspaceFolder}/dist/test/helpers/**/*.js",
4142
"${workspaceFolder}/dist/test/integration/**/*.js"
4243
],

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"editor.codeActionsOnSave": {
3-
"source.fixAll.eslint": true
3+
"source.fixAll.eslint": "explicit"
44
},
55
"eslint.validate": [
66
"javascript",
77
"typescript"
88
],
99
"typescript.tsdk": "node_modules\\typescript\\lib",
1010
"cSpell.words": [
11+
"tseslint",
1112
"Typesafe"
1213
]
1314
}

eslint.config.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
4+
import pluginChaiFriendly from 'eslint-plugin-chai-friendly';
5+
6+
export default tseslint.config(
7+
eslint.configs.recommended,
8+
tseslint.configs.recommendedTypeChecked,
9+
eslintPluginPrettierRecommended,
10+
{
11+
languageOptions: {
12+
parserOptions: {
13+
projectService: true,
14+
tsconfigRootDir: import.meta.dirname,
15+
},
16+
},
17+
rules: {
18+
'@typescript-eslint/no-explicit-any': ['off'],
19+
'@typescript-eslint/no-use-before-define': ['off'],
20+
'@typescript-eslint/no-empty-object-type': ['off'],
21+
'@typescript-eslint/no-unsafe-function-type': 'off',
22+
'@typescript-eslint/no-restricted-types': [
23+
'error',
24+
{
25+
types: {
26+
String: {
27+
message: 'Use string instead',
28+
fixWith: 'string',
29+
},
30+
Boolean: {
31+
message: 'Use boolean instead',
32+
fixWith: 'boolean',
33+
},
34+
Number: {
35+
message: 'Use number instead',
36+
fixWith: 'number',
37+
},
38+
Symbol: {
39+
message: 'Use symbol instead',
40+
fixWith: 'symbol',
41+
},
42+
43+
// object typing
44+
Object: {
45+
message:
46+
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.\n- If you want a type meaning "any object", you probably want `Record<string, unknown>` instead.\n- If you want a type meaning "any value", you probably want `unknown` instead.',
47+
},
48+
object: {
49+
message:
50+
'The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).\nConsider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys.',
51+
},
52+
},
53+
},
54+
],
55+
},
56+
},
57+
{
58+
plugins: { 'chai-friendly': pluginChaiFriendly },
59+
files: ['test/**/*.@(ts|js|mts|cts)'],
60+
rules: {
61+
'no-unused-expressions': 'off', // disable original rule
62+
'@typescript-eslint/no-unused-expressions': 'off', // disable original rule
63+
'chai-friendly/no-unused-expressions': 'error',
64+
},
65+
},
66+
{
67+
ignores: [
68+
'testResources/**/*.ts',
69+
'reports',
70+
'.nyc_output',
71+
'dist',
72+
'eslint.config.js',
73+
],
74+
},
75+
);

0 commit comments

Comments
 (0)