From ec6059063259925bcea2b68c0516ea2c36d8a94c Mon Sep 17 00:00:00 2001 From: Joe Winter Date: Wed, 16 Oct 2024 13:04:34 +0100 Subject: [PATCH 1/2] env problems --- frontend/.eslintrc.cjs | 30 +++++++++++++ frontend/jsconfig.json | 5 ++- frontend/package-lock.json | 92 ++++++++++++++++++++++++++++++++++++++ frontend/src/socket.js | 6 ++- 4 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 frontend/.eslintrc.cjs diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs new file mode 100644 index 0000000..170bffa --- /dev/null +++ b/frontend/.eslintrc.cjs @@ -0,0 +1,30 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:react/jsx-runtime", + "plugin:react-hooks/recommended", + ], + ignorePatterns: ["dist", ".eslintrc.cjs"], + parserOptions: { ecmaVersion: "latest", sourceType: "module" }, + settings: { react: { version: "18.2" } }, + plugins: ["react-refresh"], + rules: { + "react-refresh/only-export-components": [ + "warn", + { allowConstantExport: true }, + ], + "react/prop-types": "off", + }, + // Test Settings + overrides: [ + { + env: { jest: true }, + files: ["tests/**"], + plugins: ["vitest"], + extends: ["plugin:vitest/recommended"], + }, + ], +}; diff --git a/frontend/jsconfig.json b/frontend/jsconfig.json index 70cdf8d..6414431 100644 --- a/frontend/jsconfig.json +++ b/frontend/jsconfig.json @@ -1,7 +1,10 @@ { "compilerOptions": { "checkJs": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + "module": "es2022", + "moduleResolution": "Node", + "types": ["vite/client"] }, "exclude": ["node_modules", "**/node_modules/*"] } \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d219579..c38bd80 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1318,6 +1318,13 @@ "win32" ] }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==", + "dev": true, + "license": "MIT" + }, "node_modules/@swc/core": { "version": "1.7.35", "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.7.35.tgz", @@ -3142,6 +3149,52 @@ "dev": true, "license": "MIT" }, + "node_modules/engine.io-client": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.6.1.tgz", + "integrity": "sha512-aYuoak7I+R83M/BBPIOs2to51BmFIpC1wZe6zZzMrT2llVsHy5cvcmdsJgP2Qz6smHu+sD9oexiSUAVd8OfBPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.17.1", + "xmlhttprequest-ssl": "~2.1.1" + } + }, + "node_modules/engine.io-client/node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", @@ -6338,6 +6391,36 @@ "node": ">=8" } }, + "node_modules/socket.io-client": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.8.0.tgz", + "integrity": "sha512-C0jdhD5yQahMws9alf/yvtsMGTaIDBnZ8Rb5HU56svyq0l5LIrGzIDZZD5pHQlmzxLuU91Gz+VpQMKgCTNYtkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.2", + "engine.io-client": "~6.6.1", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "dev": true, + "license": "MIT", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -7549,6 +7632,15 @@ "dev": true, "license": "MIT" }, + "node_modules/xmlhttprequest-ssl": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.1.tgz", + "integrity": "sha512-ptjR8YSJIXoA3Mbv5po7RtSYHO6mZr8s7i5VGmEk7QY2pQWyT1o0N+W1gKbOyJPUCGXGnuw0wqe8f0L6Y0ny7g==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", diff --git a/frontend/src/socket.js b/frontend/src/socket.js index 1aa3e89..4402841 100644 --- a/frontend/src/socket.js +++ b/frontend/src/socket.js @@ -1,4 +1,6 @@ import { io } from "socket.io-client"; -const SOCKET_URL = import.meta.env.SOCKET_BACKEND_URL; +const SOCKET_URL = import.meta.env.VITE_SOCKET_BACKEND_URL; +console.log("URL",SOCKET_URL) -export const socket = io(SOCKET_URL) +// export const socket = io(SOCKET_URL) +export const socket = io("http://localhost:3001") From 26bb75a0d3c0943d94df03fbe08e94d7ff1d64e5 Mon Sep 17 00:00:00 2001 From: Sam Hoile Date: Wed, 16 Oct 2024 13:12:36 +0100 Subject: [PATCH 2/2] fixed .env --- frontend/src/socket.js | 5 ++--- frontend/vite.config.js | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/socket.js b/frontend/src/socket.js index 4402841..ce2528d 100644 --- a/frontend/src/socket.js +++ b/frontend/src/socket.js @@ -1,6 +1,5 @@ import { io } from "socket.io-client"; const SOCKET_URL = import.meta.env.VITE_SOCKET_BACKEND_URL; -console.log("URL",SOCKET_URL) +console.log("SOCKET_URL",SOCKET_URL) -// export const socket = io(SOCKET_URL) -export const socket = io("http://localhost:3001") +export const socket = io(SOCKET_URL) diff --git a/frontend/vite.config.js b/frontend/vite.config.js index b59a898..46d1250 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -1,10 +1,11 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' -// https://vitejs.dev/config/ + export default defineConfig({ plugins: [react()], - test: {globals: true, + test: { + globals: true, environment: "jsdom" } })