From 13c82def4db62d0769e5b3d8793a2b75197474d6 Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Mon, 19 Feb 2024 14:53:39 -0800 Subject: [PATCH 01/11] standardize configs across apps --- .eslintrc.js | 32 +++++++++++++ .eslintrc.json | 31 ------------- .gitignore | 112 +++------------------------------------------- .prettierrc.json | 5 ++- .stylelintrc.json | 5 ++- 5 files changed, 46 insertions(+), 139 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 .eslintrc.json diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..41ccbc6 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,32 @@ +module.exports = { + env: { + node: true, + browser: true, + "shared-node-browser": true, + es2021: true, + jest: true, + }, + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:react-hooks/recommended", + ], + overrides: [], + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + ecmaFeatures: { + jsx: true, + }, + }, + plugins: ["react"], + rules: { + "react/prop-types": "off", + }, + ignorePatterns: ["dist/*"], + settings: { + react: { + version: "detect", + }, + }, +}; diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index c24000e..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "env": { - "node": true, - "browser": true, - "es2021": true, - "shared-node-browser": true, - "jest": true - }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended" - ], - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": "latest", - "sourceType": "module" - }, - "plugins": ["react"], - "rules": { - "react/prop-types": "off" - }, - "ignorePatterns": ["dist/*"], - "settings": { - "react": { - "version": "detect" - } - } -} diff --git a/.gitignore b/.gitignore index bce4729..8ca7429 100644 --- a/.gitignore +++ b/.gitignore @@ -1,108 +1,8 @@ -PWABuilder/* - -.vscode/* - -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file +node_modules +dist +PWA_Builder +PWA_Builder/ +PWA_Builder/* +.vscode/settings.json .env .env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port diff --git a/.prettierrc.json b/.prettierrc.json index 0967ef4..fbeb22b 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1 +1,4 @@ -{} +{ + "bracketSpacing": false, + "trailingComma": "all" +} diff --git a/.stylelintrc.json b/.stylelintrc.json index eb9a523..010d13b 100644 --- a/.stylelintrc.json +++ b/.stylelintrc.json @@ -2,6 +2,9 @@ "extends": "stylelint-config-standard", "rules": { "selector-class-pattern": null, - "selector-id-pattern": null + "selector-id-pattern": null, + "custom-property-pattern": null, + "keyframes-name-pattern": null, + "declaration-block-no-redundant-longhand-properties": null } } From bf5e702acd19fe165b847d8199d4889049fafa5f Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Mon, 19 Feb 2024 14:57:08 -0800 Subject: [PATCH 02/11] run prettier with new config --- src/App.js | 20 +- src/components/consequence.js | 4 +- src/components/gameLost.js | 2 +- src/components/gameWon.js | 4 +- src/components/info.js | 2 +- src/components/inventory.js | 18 +- src/components/location.js | 18 +- src/components/restart.js | 4 +- src/components/resume.js | 4 +- src/components/stats.js | 2 +- src/index.js | 4 +- src/init.js | 6 +- src/items.js | 54 +- src/locations.js | 20 +- src/locations.test.js | 248 ++++---- src/reducer.js | 48 +- src/reducer.test.js | 1080 ++++++++++++++++----------------- webpack.config.js | 56 +- 18 files changed, 809 insertions(+), 785 deletions(-) diff --git a/src/App.js b/src/App.js index 4e0d472..0b9d7a1 100644 --- a/src/App.js +++ b/src/App.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, {useState} from "react"; import "./App.css"; import Inventory from "./components/inventory"; import Location from "./components/location"; @@ -8,13 +8,13 @@ import GameLost from "./components/gameLost"; import Info from "./components/info"; import Restart from "./components/restart"; import Resume from "./components/resume"; -import { reducer } from "./reducer"; -import { init } from "./init"; +import {reducer} from "./reducer"; +import {init} from "./init"; function handleBeforeInstallPrompt( event, setInstallPromptEvent, - setShowInstallButton + setShowInstallButton, ) { console.log("handleBeforeInstallPrompt"); if (event) setInstallPromptEvent(event); @@ -42,22 +42,22 @@ function App() { handleBeforeInstallPrompt( event, setInstallPromptEvent, - setShowInstallButton - ) + setShowInstallButton, + ), ); return () => window.removeEventListener("beforeinstallprompt", (event) => handleBeforeInstallPrompt( event, setInstallPromptEvent, - setShowInstallButton - ) + setShowInstallButton, + ), ); }, []); React.useEffect(() => { window.addEventListener("appinstalled", () => - handleAppInstalled(setInstallPromptEvent, setShowInstallButton) + handleAppInstalled(setInstallPromptEvent, setShowInstallButton), ); return () => window.removeEventListener("appinstalled", handleAppInstalled); }, []); @@ -81,7 +81,7 @@ function App() { } // If yes, update state - dispatchGameState({ action: "resume", savedState: savedState }); + dispatchGameState({action: "resume", savedState: savedState}); setShowMap(savedState.showMap ?? true); setShowPhoto(savedState.showPhoto ?? true); diff --git a/src/components/consequence.js b/src/components/consequence.js index 979bff1..108c451 100644 --- a/src/components/consequence.js +++ b/src/components/consequence.js @@ -1,7 +1,7 @@ import React from "react"; -import { locations } from "../locations"; +import {locations} from "../locations"; -export default function Consequence({ setCurrentDisplay, gameState }) { +export default function Consequence({setCurrentDisplay, gameState}) { return (
{gameState.consequenceText}
diff --git a/src/components/gameLost.js b/src/components/gameLost.js index 1a64191..303932d 100644 --- a/src/components/gameLost.js +++ b/src/components/gameLost.js @@ -19,7 +19,7 @@ export default function GameLost({ ; } @@ -141,7 +141,7 @@ function MapLocation({ direction, connections, gameState, dispatchGameState }) { ); } -function Map({ gameState, dispatchGameState, setCurrentDisplay, showPhoto }) { +function Map({gameState, dispatchGameState, setCurrentDisplay, showPhoto}) { const connections = locations[gameState.playerLocation].getConnections(gameState); diff --git a/src/components/restart.js b/src/components/restart.js index df75930..97db6eb 100644 --- a/src/components/restart.js +++ b/src/components/restart.js @@ -1,6 +1,6 @@ import React from "react"; -export default function Restart({ setCurrentDisplay, dispatchGameState }) { +export default function Restart({setCurrentDisplay, dispatchGameState}) { return (
Restart?
@@ -8,7 +8,7 @@ export default function Restart({ setCurrentDisplay, dispatchGameState }) {