From e9b17f885927c29d23b72146d63f039d50dbc2e5 Mon Sep 17 00:00:00 2001 From: spacexbt Date: Sun, 5 Jan 2025 20:20:13 +0100 Subject: [PATCH 1/4] Enable TypeScript strict mode and additional checks --- tsconfig.json | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 208ca01e..3aca19ce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,27 @@ { "compilerOptions": { - "target": "ES2022", - "module": "Node16", - "moduleResolution": "Node16", - "strict": true, + "target": "ES2020", + "module": "ES2020", + "lib": ["ES2020"], + "moduleResolution": "node", + "rootDir": ".", + "outDir": "dist", "esModuleInterop": true, + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictBindCallApply": true, + "strictPropertyInitialization": true, + "noImplicitThis": true, + "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true + "forceConsistentCasingInFileNames": true }, "include": ["src/**/*"], - "exclude": ["node_modules"] -} + "exclude": ["node_modules", "dist"] +} \ No newline at end of file From fd45e72b9e81a85463900e45319f609f99cf6a83 Mon Sep 17 00:00:00 2001 From: spacexbt Date: Sun, 5 Jan 2025 20:20:18 +0100 Subject: [PATCH 2/4] Enable TypeScript strict mode and additional checks --- tsconfig.json | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 3aca19ce..21695a91 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,27 +1 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "ES2020", - "lib": ["ES2020"], - "moduleResolution": "node", - "rootDir": ".", - "outDir": "dist", - "esModuleInterop": true, - "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "strictBindCallApply": true, - "strictPropertyInitialization": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist"] -} \ No newline at end of file +{"compilerOptions":{"target":"ES2020","module":"ES2020","lib":["ES2020"],"moduleResolution":"node","rootDir":".","outDir":"dist","esModuleInterop":true,"strict":true,"noImplicitAny":true,"strictNullChecks":true,"strictFunctionTypes":true,"strictBindCallApply":true,"strictPropertyInitialization":true,"noImplicitThis":true,"alwaysStrict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"skipLibCheck":true,"forceConsistentCasingInFileNames":true},"include":["src/**/*"],"exclude":["node_modules","dist"]} \ No newline at end of file From ad7c60820f1e10938503dd368518c949951a9559 Mon Sep 17 00:00:00 2001 From: spacexbt Date: Sun, 5 Jan 2025 20:20:42 +0100 Subject: [PATCH 3/4] Add ESLint configuration and update TypeScript config --- .eslintrc.json | 23 +++++++++++++++++++++++ .prettierrc | 7 +++++++ package.json | 27 +++++++++++++++++++++++++-- tsconfig.json | 28 +++++++++++++++++++++++++++- 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 .eslintrc.json create mode 100644 .prettierrc diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..6ecd2283 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,23 @@ +{ + "root": true, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint"], + "env": { + "node": true, + "es2020": true + }, + "rules": { + "@typescript-eslint/explicit-function-return-type": "error", + "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-unused-vars": "error" + } +} \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..494b947a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "trailingComma": "es5", + "singleQuote": true, + "printWidth": 100, + "tabWidth": 2 +} \ No newline at end of file diff --git a/package.json b/package.json index 9d5e5ee2..cdee51cd 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,12 @@ "build": "npm run build --workspaces", "watch": "npm run watch --workspaces", "publish-all": "npm publish --workspaces --access public", - "link-all": "npm link --workspaces" + "link-all": "npm link --workspaces", + "lint": "eslint . --ext .ts", + "lint:fix": "eslint . --ext .ts --fix", + "format": "prettier --write \"src/**/*.ts\"", + "test": "jest", + "prepare": "husky install" }, "dependencies": { "@modelcontextprotocol/server-everything": "*", @@ -29,5 +34,23 @@ "@modelcontextprotocol/server-filesystem": "*", "@modelcontextprotocol/server-everart": "*", "@modelcontextprotocol/server-sequential-thinking": "*" + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.0.0", + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^8.0.0", + "eslint-config-prettier": "^8.0.0", + "eslint-plugin-prettier": "^4.0.0", + "husky": "^7.0.0", + "jest": "^27.0.0", + "lint-staged": "^12.0.0", + "prettier": "^2.0.0", + "typescript": "^4.0.0" + }, + "lint-staged": { + "*.ts": [ + "eslint --fix", + "prettier --write" + ] } -} +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 21695a91..3aca19ce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1 +1,27 @@ -{"compilerOptions":{"target":"ES2020","module":"ES2020","lib":["ES2020"],"moduleResolution":"node","rootDir":".","outDir":"dist","esModuleInterop":true,"strict":true,"noImplicitAny":true,"strictNullChecks":true,"strictFunctionTypes":true,"strictBindCallApply":true,"strictPropertyInitialization":true,"noImplicitThis":true,"alwaysStrict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"noFallthroughCasesInSwitch":true,"skipLibCheck":true,"forceConsistentCasingInFileNames":true},"include":["src/**/*"],"exclude":["node_modules","dist"]} \ No newline at end of file +{ + "compilerOptions": { + "target": "ES2020", + "module": "ES2020", + "lib": ["ES2020"], + "moduleResolution": "node", + "rootDir": ".", + "outDir": "dist", + "esModuleInterop": true, + "strict": true, + "noImplicitAny": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "strictBindCallApply": true, + "strictPropertyInitialization": true, + "noImplicitThis": true, + "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist"] +} \ No newline at end of file From 89add8e20fd46096aaef1eec4d50c31eb19a4be4 Mon Sep 17 00:00:00 2001 From: spacexbt Date: Sun, 5 Jan 2025 20:20:47 +0100 Subject: [PATCH 4/4] Add Git hooks and Husky configuration --- .husky/commit-msg | 4 ++++ .husky/pre-commit | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 .husky/commit-msg create mode 100644 .husky/pre-commit diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 00000000..e8511eae --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx --no-install commitlint --edit $1 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..de26dc12 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +lint-staged