Skip to content

Commit ed6bcdb

Browse files
authored
fix!: update eslint and drop support for Node 18 (#384)
1 parent 65db96d commit ed6bcdb

Some content is hidden

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

56 files changed

+3446
-3747
lines changed

.eslintrc.js

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

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ jobs:
1515
strategy:
1616
matrix:
1717
node-version:
18-
- 18.x
1918
- 20.x
20-
- 21.x
19+
- 22.x
2120

2221
os:
2322
- ubuntu-latest
@@ -43,7 +42,7 @@ jobs:
4342
strategy:
4443
matrix:
4544
node-version:
46-
- 18.x
45+
- 20.x
4746

4847
os:
4948
- windows-latest

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ cspell.schema.json
1313
tsconfig*.json
1414
**/coverage/**
1515
**/dist/**
16+
.release-please-manifest.json

eslint.config.mjs

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js';
4+
import nodePlugin from 'eslint-plugin-n';
5+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
6+
import tsEslint from 'typescript-eslint';
7+
8+
// mimic CommonJS variables -- not needed if using CommonJS
9+
// import { FlatCompat } from "@eslint/eslintrc";
10+
// const __dirname = fileURLToPath(new URL('.', import.meta.url));
11+
// const compat = new FlatCompat({baseDirectory: __dirname, recommendedConfig: eslint.configs.recommended});
12+
13+
export default tsEslint.config(
14+
eslint.configs.recommended,
15+
nodePlugin.configs['flat/recommended'],
16+
...tsEslint.configs.recommended,
17+
...tsEslint.configs.strict,
18+
...tsEslint.configs.stylistic,
19+
{
20+
ignores: [
21+
'.github/**/*.yaml',
22+
'.github/**/*.yml',
23+
'**/__snapshots__/**',
24+
'**/.vscode-test/**',
25+
'**/.yarn/**',
26+
'**/*.d.ts',
27+
'**/build/**',
28+
'**/coverage/**',
29+
'**/dist/**',
30+
'**/fixtures/**',
31+
'**/fixtures/**/*.js',
32+
'**/node_modules/**',
33+
'**/scripts/ts-json-schema-generator.cjs',
34+
'**/temp/**',
35+
'**/webpack*.js',
36+
'docs/docsV2/**',
37+
'package-lock.json',
38+
'packages/*/dist/**',
39+
'packages/*/out/**',
40+
'packages/client/server/**',
41+
'website/.docusaurus/**',
42+
'website/**',
43+
'website/build/**',
44+
'website/node_modules/**',
45+
],
46+
},
47+
{
48+
plugins: {
49+
'simple-import-sort': simpleImportSort,
50+
},
51+
rules: {
52+
'simple-import-sort/imports': 'error',
53+
'simple-import-sort/exports': 'error',
54+
},
55+
},
56+
{
57+
files: ['**/*.{ts,cts,mts,tsx}'],
58+
rules: {
59+
// Note: you must disable the base rule as it can report incorrect errors
60+
'no-unused-vars': 'off',
61+
'@typescript-eslint/unified-signatures': 'off', // The signatures come from VS Code, it is better to have them match the source.
62+
'@typescript-eslint/no-empty-interface': 'off',
63+
'@typescript-eslint/no-empty-function': 'off',
64+
'@typescript-eslint/no-non-null-assertion': 'error',
65+
'@typescript-eslint/prefer-literal-enum-member': 'off',
66+
'@typescript-eslint/consistent-type-imports': ['error'],
67+
'@typescript-eslint/no-unused-vars': [
68+
'error',
69+
{
70+
args: 'all',
71+
argsIgnorePattern: '^_',
72+
caughtErrors: 'all',
73+
caughtErrorsIgnorePattern: '^_',
74+
destructuredArrayIgnorePattern: '^_',
75+
varsIgnorePattern: '^_',
76+
ignoreRestSiblings: true,
77+
},
78+
],
79+
'n/no-missing-import': [
80+
'off', // disabled because it is not working correctly
81+
{
82+
tryExtensions: ['.d.ts', '.d.mts', '.d.cts', '.ts', '.cts', '.mts', '.js', '.cjs', '.mjs'],
83+
},
84+
],
85+
},
86+
},
87+
{
88+
files: ['**/*.test.*', '**/__mocks__/**', '**/test/**', '**/test.*', '**/rollup.config.mjs', '**/build.mjs'],
89+
rules: {
90+
'n/no-extraneous-require': 'off', // Mostly for __mocks__ and test files
91+
'n/no-extraneous-import': 'off',
92+
'n/no-unpublished-import': 'off',
93+
'@typescript-eslint/no-explicit-any': 'off', // any is allowed in tests
94+
'@typescript-eslint/no-useless-constructor': 'off', // useful for tests
95+
'@typescript-eslint/no-dynamic-delete': 'off', // useful for tests
96+
},
97+
},
98+
{
99+
files: ['**/jest.config.*', '**/__mocks__/**'],
100+
rules: {
101+
'n/no-extraneous-require': 'off',
102+
'no-undef': 'off',
103+
},
104+
},
105+
{
106+
files: ['**/*.json'],
107+
rules: {
108+
'@typescript-eslint/no-unused-expressions': 'off',
109+
},
110+
},
111+
);

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
/* eslint-disable @typescript-eslint/no-var-requires */
1+
/* eslint-disable @typescript-eslint/no-require-imports */
22
module.exports = require('./dist/index');

package.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"lint": "pnpm run lint:eslint --fix && pnpm run lint:prettier",
2020
"lint:ci": "pnpm run lint:eslint && pnpm run lint:prettier-ci",
2121
"lint:eslint": "eslint .",
22-
"lint:prettier": "prettier -w \"**/*.{yaml,yml,md}\"",
22+
"lint:prettier": "prettier -w .",
2323
"lint:prettier-ci": "prettier -c \"**/*.{yaml,yml,md}\"",
2424
"lint:spelling": "cspell --dot \"**\"",
2525
"prepare": "pnpm run build",
@@ -49,27 +49,25 @@
4949
"url": "https://github.com/streetsidesoftware/jest-mock-vscode.git"
5050
},
5151
"devDependencies": {
52+
"@eslint/js": "^9.9.0",
5253
"@jest/globals": "^29.7.0",
53-
"@tsconfig/node18": "^18.2.4",
54-
"@types/node": "^18.19.44",
55-
"@types/vscode": "^1.92.0",
56-
"@typescript-eslint/eslint-plugin": "^7.18.0",
57-
"@typescript-eslint/parser": "^7.18.0",
58-
"eslint": "^8.57.0",
59-
"eslint-config-prettier": "^9.1.0",
60-
"eslint-plugin-import": "^2.29.1",
61-
"eslint-plugin-jest": "^28.8.0",
62-
"eslint-plugin-node": "^11.1.0",
63-
"eslint-plugin-prettier": "^5.2.1",
64-
"eslint-plugin-promise": "^7.1.0",
54+
"@tsconfig/node20": "^20.1.4",
55+
"@types/node": "^20.14.15",
56+
"eslint": "^9.9.0",
57+
"eslint-plugin-n": "^17.10.2",
58+
"eslint-plugin-simple-import-sort": "^12.1.1",
6559
"inject-markdown": "^3.1.0",
6660
"jest": "^29.7.0",
6761
"prettier": "^3.3.3",
6862
"rfdc": "^1.4.1",
6963
"ts-jest": "^29.2.4",
70-
"typescript": "^5.5.4"
64+
"typescript": "^5.5.4",
65+
"typescript-eslint": "^8.1.0"
7166
},
7267
"dependencies": {
7368
"vscode-uri": "^3.0.8"
69+
},
70+
"peerDependencies": {
71+
"@types/vscode": "^1.92.0"
7472
}
7573
}

0 commit comments

Comments
 (0)