From 6dae68db431e7d33cd53b4dd259cb72c1532d038 Mon Sep 17 00:00:00 2001 From: Jakub Kasprzyk Date: Mon, 18 Sep 2023 10:00:23 +0200 Subject: [PATCH] Add missing empty lines at the end and remove excluding needed files from tsconfigs --- .eslintignore | 3 -- .eslintrc | 45 ++++++++++++++++++++++++------ packages/client/tsconfig.json | 18 ++++++++---- packages/server/src/scene/scene.ts | 10 +++---- packages/server/tsconfig.json | 15 +++++++--- packages/types/src/client.ts | 2 +- packages/types/src/server.ts | 2 +- packages/types/src/shared.ts | 2 +- 8 files changed, 69 insertions(+), 28 deletions(-) diff --git a/.eslintignore b/.eslintignore index 5ad2764..6bf8f2d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,6 +1,3 @@ node_modules/ dist/ packages/**/refactor.ts -packages/client/**/scene/*.ts -packages/server/**/scene/*.ts -packages/server/**/utils/*.ts diff --git a/.eslintrc b/.eslintrc index aacfae1..3567b98 100644 --- a/.eslintrc +++ b/.eslintrc @@ -10,11 +10,22 @@ "parserOptions": { "ecmaVersion": 2021, "requireConfigFile": false, - "project": ["packages/**/tsconfig.json"] + "project": [ + "packages/**/tsconfig.json" + ] }, - "plugins": ["import", "@typescript-eslint"], - "extends": ["airbnb-typescript"], + "plugins": [ + "import", + "@typescript-eslint" + ], + "extends": [ + "airbnb-typescript" + ], "rules": { + "eol-last": [ + "error", + "always" + ], "import/no-unresolved": 2, "import/no-commonjs": 2, "no-console": 0, @@ -27,16 +38,34 @@ "ts": "never" } ], - "import/no-extraneous-dependencies": ["error", { "devDependencies": true }], - "no-param-reassign": ["error", { "props": false }], - "sort-imports": ["error", { "ignoreDeclarationSort": true }], + "import/no-extraneous-dependencies": [ + "error", + { + "devDependencies": true + } + ], + "no-param-reassign": [ + "error", + { + "props": false + } + ], + "sort-imports": [ + "error", + { + "ignoreDeclarationSort": true + } + ], "@typescript-eslint/indent": "off", "@typescript-eslint/quotes": "off", "@typescript-eslint/comma-dangle": "off", "@typescript-eslint/consistent-type-imports": [ "error", - { "prefer": "type-imports", "disallowTypeAnnotations": true } + { + "prefer": "type-imports", + "disallowTypeAnnotations": true + } ], "react/jsx-filename-extension": "off" } -} +} \ No newline at end of file diff --git a/packages/client/tsconfig.json b/packages/client/tsconfig.json index b1e31c9..df4502f 100644 --- a/packages/client/tsconfig.json +++ b/packages/client/tsconfig.json @@ -14,11 +14,19 @@ "sourceMap": true, "skipLibCheck": true, "isolatedModules": true, - "types": ["node"], + "types": [ + "node" + ], "paths": { - "~/*": ["./*"] + "~/*": [ + "./*" + ] } }, - "include": ["src/**/*.ts"], - "exclude": ["src/refactor.ts", "src/scene/*.ts"] -} + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "src/refactor.ts" + ] +} \ No newline at end of file diff --git a/packages/server/src/scene/scene.ts b/packages/server/src/scene/scene.ts index e022666..d0412f7 100644 --- a/packages/server/src/scene/scene.ts +++ b/packages/server/src/scene/scene.ts @@ -162,25 +162,25 @@ const startRace = async ({ loop = setInterval(() => { physicsWorld.fixedStep(); - playersMap.forEach(({ actions, vehicle }) => { + playersMap.forEach(({ actions: playersActions, vehicle }) => { if (!vehicle) { return; } - if (actions.accelerate) { + if (playersActions.accelerate) { vehicle.physicalVehicle.setWheelForce(maxForce, 2); vehicle.physicalVehicle.setWheelForce(maxForce, 3); - } else if (actions.brake) { + } else if (playersActions.brake) { vehicle.physicalVehicle.setWheelForce(-maxForce / 2, 2); vehicle.physicalVehicle.setWheelForce(-maxForce / 2, 3); } else { vehicle.physicalVehicle.setWheelForce(0, 2); vehicle.physicalVehicle.setWheelForce(0, 3); } - if (actions.left) { + if (playersActions.left) { vehicle.physicalVehicle.setSteeringValue(maxSteerVal, 0); vehicle.physicalVehicle.setSteeringValue(maxSteerVal, 1); - } else if (actions.right) { + } else if (playersActions.right) { vehicle.physicalVehicle.setSteeringValue(-maxSteerVal, 0); vehicle.physicalVehicle.setSteeringValue(-maxSteerVal, 1); } else { diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index d1e182f..405c92a 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -10,8 +10,15 @@ "esModuleInterop": true, "skipLibCheck": true, "isolatedModules": true, - "types": ["node", "express"] + "types": [ + "node", + "express" + ] }, - "include": ["src/**/*.ts"], - "exclude": ["src/refactor.ts", "src/scene/*.ts", "src/utils/*.ts"] -} + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "src/refactor.ts" + ] +} \ No newline at end of file diff --git a/packages/types/src/client.ts b/packages/types/src/client.ts index 0cd09e0..b191de9 100644 --- a/packages/types/src/client.ts +++ b/packages/types/src/client.ts @@ -34,4 +34,4 @@ interface ClientEvents { "client:start the race": () => void; } -export type { ActionTypes, ClientEvents, PlayerFromServer, PlayersFromServer, UI }; \ No newline at end of file +export type { ActionTypes, ClientEvents, PlayerFromServer, PlayersFromServer, UI }; diff --git a/packages/types/src/server.ts b/packages/types/src/server.ts index 8cf8e64..cb37dce 100644 --- a/packages/types/src/server.ts +++ b/packages/types/src/server.ts @@ -21,4 +21,4 @@ interface ServerEvents { "server:user disconnected": (data: { userID: string }) => void; } -export type { ServerEvents }; \ No newline at end of file +export type { ServerEvents }; diff --git a/packages/types/src/shared.ts b/packages/types/src/shared.ts index 7de8e10..7e00b24 100644 --- a/packages/types/src/shared.ts +++ b/packages/types/src/shared.ts @@ -13,4 +13,4 @@ type User = { type UsersList = Array; -export type { RoomList, User, UsersList }; \ No newline at end of file +export type { RoomList, User, UsersList };