Skip to content

Commit 4db8d1b

Browse files
committed
eslint, vitest setup; successful shared/ tests pass
1 parent d372e75 commit 4db8d1b

38 files changed

+18948
-12
lines changed
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,21 @@ import eslint from '@eslint/js';
44
import tseslint from 'typescript-eslint';
55
import eslintConfigPrettier from 'eslint-config-prettier/flat';
66
import nodePlugin from 'eslint-plugin-n';
7+
import { fileURLToPath } from 'node:url';
8+
import path from 'node:path';
9+
10+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
711

812
export default tseslint.config(
913
eslint.configs.recommended,
1014
...tseslint.configs.recommended,
1115
{
16+
languageOptions: {
17+
parserOptions: {
18+
// Ensure consumers of this shared config get a stable tsconfig root
19+
tsconfigRootDir: __dirname
20+
}
21+
},
1222
linterOptions: {
1323
reportUnusedDisableDirectives: false
1424
},
@@ -21,7 +31,8 @@ export default tseslint.config(
2131
}
2232
},
2333
{
24-
ignores: ['src/spec.types.ts']
34+
// Ignore generated protocol types everywhere
35+
ignores: ['**/spec.types.ts']
2536
},
2637
{
2738
files: ['src/client/**/*.ts', 'src/server/**/*.ts'],
@@ -32,3 +43,4 @@ export default tseslint.config(
3243
},
3344
eslintConfigPrettier
3445
);
46+

common/eslint-config/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
22
"name": "@modelcontextprotocol/eslint-config",
33
"private": true,
4-
"main": "tsconfig.json",
4+
"main": "eslint.config.mjs",
55
"type": "module",
6+
"exports": {
7+
".": "./eslint.config.mjs"
8+
},
69
"dependencies": {
710
"typescript": "catalog:"
811
},

common/vitest-config/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"name": "@modelcontextprotocol/vitest-config",
33
"private": true,
4-
"main": "tsconfig.json",
4+
"main": "vitest.config.mjs",
55
"type": "module",
6+
"exports": {
7+
".": "./vitest.config.mjs",
8+
"./tsconfig.json": "./tsconfig.json"
9+
},
610
"dependencies": {
711
"typescript": "catalog:"
812
},
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ export default defineConfig({
88
include: ['test/**/*.test.ts']
99
}
1010
});
11+
12+

packages/client/eslint.config.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @ts-check
2+
3+
import baseConfig from '@modelcontextprotocol/eslint-config';
4+
5+
export default baseConfig;
6+
7+

0 commit comments

Comments
 (0)