Skip to content

Commit

Permalink
Refactor ESLint configurations and update dependencies
Browse files Browse the repository at this point in the history
The old ESLint configurations have been deleted and replaced with new ones, both for the server side and the client side. Additionally, the versions of 'eslint' package were downgraded and new dependencies such as '@typescript-eslint/eslint-plugin', 'eslint-plugin-import', 'eslint-plugin-react', 'eslint-plugin-jest', and 'eslint-plugin-react-hooks' were added to facilitate ESLint configurations and to enforce code styles.
  • Loading branch information
manu committed Jun 20, 2024
1 parent 0df2ffe commit 1a63f22
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 123 deletions.
File renamed without changes.
7 changes: 5 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
124 changes: 124 additions & 0 deletions server/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
120 changes: 0 additions & 120 deletions server/eslint.config.js

This file was deleted.

4 changes: 3 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 1a63f22

Please sign in to comment.