diff --git a/client/eslint.config.js b/client/.eslintrc.js similarity index 100% rename from client/eslint.config.js rename to client/.eslintrc.js diff --git a/client/package.json b/client/package.json index f7fc82f9..a2711c62 100644 --- a/client/package.json +++ b/client/package.json @@ -96,7 +96,7 @@ "@umijs/fabric": "^4.0.1", "@umijs/lint": "^4.2.11", "cross-env": "^7.0.3", - "eslint": "^9.5.0", + "eslint": "^8.57.0", "express": "^4.19.2", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", @@ -106,7 +106,10 @@ "swagger-ui-dist": "^5.17.14", "ts-node": "^10.9.2", "typescript": "^5.4.5", - "@babel/eslint-plugin": "^7.24.7" + "eslint-plugin-react": "^7.34.3", + "@typescript-eslint/eslint-plugin": "^7.13.1", + "eslint-plugin-jest": "^28.6.0", + "eslint-plugin-react-hooks": "^4.6.2" }, "engines": { "node": ">=20.0.0" diff --git a/server/.eslintrc.json b/server/.eslintrc.json new file mode 100644 index 00000000..6b4efdc3 --- /dev/null +++ b/server/.eslintrc.json @@ -0,0 +1,124 @@ +{ + "env": { + "node": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint", "import", "prettier" + ], + "rules": { + "@typescript-eslint/no-explicit-any": "off", + // Possible errors + "no-empty": [ + "error", + { + "allowEmptyCatch": true + } + ], + + // Best practices + "curly": ["error", "all"], + "eqeqeq": [ + "error", + "always", + { + "null": "ignore" + } + ], + "no-caller": "error", + "no-new": "error", + "no-with": "error", + + // Stylistic issues + "brace-style": [ + "error", + "1tbs", + { + "allowSingleLine": true + } + ], + "func-call-spacing": ["error", "never"], + "indent": "off", + // "@typescript-eslint/indent": [ "error", 2, { + // "SwitchCase": 1 + // }], + "no-trailing-spaces": "error", + "key-spacing": [ + "error", + { + "beforeColon": false, + "afterColon": true + } + ], + "keyword-spacing": "error", + "no-bitwise": "error", + "space-before-function-paren": [ + "error", + { + "anonymous": "ignore", + "named": "never" + } + ], + "space-infix-ops": "error", + "space-unary-ops": [ + "error", + { + "words": false, + "nonwords": false + } + ], + + // Variables + "no-use-before-define": [ + "error", + { + "functions": false + } + ], + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "error", + // ES6+ + "sort-imports": [ + "error", + { + "ignoreCase": false, + "ignoreDeclarationSort": true, + "ignoreMemberSort": false + } + ], + "import/newline-after-import": ["error"], + "import/order": [ + "error", + { + "groups": ["builtin", "external", "internal", "parent", "sibling", "index"], + "newlines-between": "never" + } + ], + + // TS-specific + "@typescript-eslint/member-delimiter-style": [ + "error", + { + "multiline": { + "delimiter": "semi", + "requireLast": true + }, + "singleline": { + "delimiter": "semi", + "requireLast": false + } + } + ], + "@typescript-eslint/no-require-imports": "error" + } +} diff --git a/server/eslint.config.js b/server/eslint.config.js deleted file mode 100644 index 75ebbaec..00000000 --- a/server/eslint.config.js +++ /dev/null @@ -1,120 +0,0 @@ -module.exports = [ - { - env: { - node: true, - es2021: true, - }, - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - }, - plugins: ['@typescript-eslint', 'import', 'prettier'], - rules: { - '@typescript-eslint/no-explicit-any': 'off', - // Possible errors - 'no-empty': [ - 'error', - { - allowEmptyCatch: true, - }, - ], - - // Best practices - curly: ['error', 'all'], - eqeqeq: [ - 'error', - 'always', - { - null: 'ignore', - }, - ], - 'no-caller': 'error', - 'no-new': 'error', - 'no-with': 'error', - - // Stylistic issues - 'brace-style': [ - 'error', - '1tbs', - { - allowSingleLine: true, - }, - ], - 'func-call-spacing': ['error', 'never'], - indent: 'off', - // "@typescript-eslint/indent": [ "error", 2, { - // "SwitchCase": 1 - // }], - 'no-trailing-spaces': 'error', - 'key-spacing': [ - 'error', - { - beforeColon: false, - afterColon: true, - }, - ], - 'keyword-spacing': 'error', - 'no-bitwise': 'error', - 'space-before-function-paren': [ - 'error', - { - anonymous: 'ignore', - named: 'never', - }, - ], - 'space-infix-ops': 'error', - 'space-unary-ops': [ - 'error', - { - words: false, - nonwords: false, - }, - ], - - // Variables - 'no-use-before-define': [ - 'error', - { - functions: false, - }, - ], - 'no-unused-vars': 'off', - '@typescript-eslint/no-unused-vars': 'error', - // ES6+ - 'sort-imports': [ - 'error', - { - ignoreCase: false, - ignoreDeclarationSort: true, - ignoreMemberSort: false, - }, - ], - 'import/newline-after-import': ['error'], - 'import/order': [ - 'error', - { - groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], - 'newlines-between': 'never', - }, - ], - - // TS-specific - '@typescript-eslint/member-delimiter-style': [ - 'error', - { - multiline: { - delimiter: 'semi', - requireLast: true, - }, - singleline: { - delimiter: 'semi', - requireLast: false, - }, - }, - ], - '@typescript-eslint/no-require-imports': 'error', - }, - }, -]; diff --git a/server/package.json b/server/package.json index 8eccd946..04e5130c 100644 --- a/server/package.json +++ b/server/package.json @@ -64,9 +64,11 @@ "@types/shelljs": "^0.8.15", "@types/uuid": "^9.0.8", "@vitest/coverage-v8": "^1.6.0", - "eslint": "^9.5.0", + "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", + "@typescript-eslint/eslint-plugin": "^7.13.1", + "eslint-plugin-import": "^2.29.1", "node-mocks-http": "^1.14.1", "prettier": "^3.3.2", "ts-node": "^10.9.2",