Skip to content

Commit 33fc392

Browse files
authored
Update tests and linter to run properly (#219)
* Fix test config. * Update ESLint config file to v9 format.
1 parent 54172ad commit 33fc392

File tree

5 files changed

+65
-28
lines changed

5 files changed

+65
-28
lines changed

.eslintrc

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

eslint.config.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import js from "@eslint/js";
2+
import tseslint from "@typescript-eslint/eslint-plugin";
3+
import tsparser from "@typescript-eslint/parser";
4+
import prettier from "eslint-config-prettier";
5+
6+
export default [
7+
js.configs.recommended,
8+
{
9+
files: ["**/*.ts", "**/*.tsx"],
10+
languageOptions: {
11+
parser: tsparser,
12+
parserOptions: {
13+
ecmaVersion: 2022,
14+
sourceType: "module",
15+
},
16+
},
17+
plugins: {
18+
"@typescript-eslint": tseslint,
19+
},
20+
rules: {
21+
...tseslint.configs.recommended.rules,
22+
"@typescript-eslint/explicit-function-return-type": "warn",
23+
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
24+
"@typescript-eslint/no-explicit-any": "warn",
25+
},
26+
},
27+
{
28+
files: ["**/*.ts", "**/*.tsx"],
29+
rules: prettier.rules,
30+
},
31+
{
32+
ignores: ["dist/**", "node_modules/**"],
33+
},
34+
];

jest.config.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
module.exports = {
2-
preset: 'ts-jest',
3-
testEnvironment: 'node',
1+
export default {
2+
preset: "ts-jest/presets/default-esm",
3+
extensionsToTreatAsEsm: [".ts"],
4+
testEnvironment: "node",
45
transform: {
5-
'^.+\\.tsx?$': ['ts-jest', {
6-
tsconfig: 'tsconfig.json',
7-
}],
6+
"^.+\\.tsx?$": [
7+
"ts-jest",
8+
{
9+
useESM: true,
10+
tsconfig: {
11+
module: "ESNext",
12+
verbatimModuleSyntax: false,
13+
},
14+
},
15+
],
816
},
9-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
17+
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
1018
moduleNameMapper: {
11-
'^~/(.*)$': '<rootDir>/src/$1'
12-
}
19+
"^~/(.*)\.js$": "<rootDir>/src/$1.ts",
20+
"^~/(.*)$": "<rootDir>/src/$1",
21+
"^(\\.{1,2}/.*)\\.js$": "$1",
22+
},
23+
modulePaths: ["<rootDir>/src"],
1324
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"start:http": "node dist/cli.js",
2121
"dev": "cross-env NODE_ENV=development tsup --watch",
2222
"dev:cli": "cross-env NODE_ENV=development tsup --watch -- --stdio",
23-
"lint": "eslint . --ext .ts",
23+
"lint": "eslint .",
2424
"format": "prettier --write \"src/**/*.ts\"",
2525
"inspect": "pnpx @modelcontextprotocol/inspector",
2626
"prepack": "pnpm build",
@@ -67,6 +67,7 @@
6767
"devDependencies": {
6868
"@changesets/changelog-github": "^0.5.1",
6969
"@changesets/cli": "^2.29.2",
70+
"@eslint/js": "^9.33.0",
7071
"@types/express": "^5.0.0",
7172
"@types/jest": "^29.5.14",
7273
"@types/js-yaml": "^4.0.9",

pnpm-lock.yaml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)