Skip to content

Commit

Permalink
Add missing empty lines at the end and remove excluding needed files …
Browse files Browse the repository at this point in the history
…from tsconfigs
  • Loading branch information
neu5 committed Sep 18, 2023
1 parent e380f40 commit 6dae68d
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 28 deletions.
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
node_modules/
dist/
packages/**/refactor.ts
packages/client/**/scene/*.ts
packages/server/**/scene/*.ts
packages/server/**/utils/*.ts
45 changes: 37 additions & 8 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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"
}
}
}
18 changes: 13 additions & 5 deletions packages/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
10 changes: 5 additions & 5 deletions packages/server/src/scene/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 11 additions & 4 deletions packages/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
2 changes: 1 addition & 1 deletion packages/types/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ interface ClientEvents {
"client:start the race": () => void;
}

export type { ActionTypes, ClientEvents, PlayerFromServer, PlayersFromServer, UI };
export type { ActionTypes, ClientEvents, PlayerFromServer, PlayersFromServer, UI };
2 changes: 1 addition & 1 deletion packages/types/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ interface ServerEvents {
"server:user disconnected": (data: { userID: string }) => void;
}

export type { ServerEvents };
export type { ServerEvents };
2 changes: 1 addition & 1 deletion packages/types/src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ type User = {

type UsersList = Array<User>;

export type { RoomList, User, UsersList };
export type { RoomList, User, UsersList };

0 comments on commit 6dae68d

Please sign in to comment.