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/.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 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 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