-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintcache
1 lines (1 loc) · 15.8 KB
/
.eslintcache
1
[{"/Users/kennyveldt/github/personal-site/src/reportWebVitals.js":"1","/Users/kennyveldt/github/personal-site/src/components/instruction.jsx":"2","/Users/kennyveldt/github/personal-site/src/components/arrows.jsx":"3","/Users/kennyveldt/github/personal-site/src/components/contact.jsx":"4","/Users/kennyveldt/github/personal-site/src/components/profile.jsx":"5","/Users/kennyveldt/github/personal-site/src/components/projects.jsx":"6","/Users/kennyveldt/github/personal-site/src/components/table.jsx":"7","/Users/kennyveldt/github/personal-site/src/index.js":"8","/Users/kennyveldt/github/personal-site/src/App.js":"9"},{"size":362,"mtime":1661313849913,"results":"10","hashOfConfig":"11"},{"size":317,"mtime":1661314029677,"results":"12","hashOfConfig":"11"},{"size":432,"mtime":1661314014644,"results":"13","hashOfConfig":"11"},{"size":713,"mtime":1661314023961,"results":"14","hashOfConfig":"11"},{"size":1972,"mtime":1661315028142,"results":"15","hashOfConfig":"11"},{"size":4758,"mtime":1661314042895,"results":"16","hashOfConfig":"11"},{"size":276,"mtime":1661314059874,"results":"17","hashOfConfig":"11"},{"size":504,"mtime":1661313849913,"results":"18","hashOfConfig":"11"},{"size":10284,"mtime":1661314104273,"results":"19","hashOfConfig":"11"},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},"1ei3pfj",{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"37"},{"filePath":"38","messages":"39","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"40","usedDeprecatedRules":"41"},"/Users/kennyveldt/github/personal-site/src/reportWebVitals.js",[],["42","43"],"/Users/kennyveldt/github/personal-site/src/components/instruction.jsx",[],"/Users/kennyveldt/github/personal-site/src/components/arrows.jsx",[],"/Users/kennyveldt/github/personal-site/src/components/contact.jsx",[],"/Users/kennyveldt/github/personal-site/src/components/profile.jsx",[],"/Users/kennyveldt/github/personal-site/src/components/projects.jsx",[],"/Users/kennyveldt/github/personal-site/src/components/table.jsx",[],"/Users/kennyveldt/github/personal-site/src/index.js",[],["44","45"],"/Users/kennyveldt/github/personal-site/src/App.js",["46","47","48","49"],"import React, { useState, useEffect, useReducer } from \"react\";\nimport cs from \"classnames\";\nimport Profile from \"./components/profile\";\nimport Arrows from \"./components/arrows\";\nimport Table from \"./components/table\";\nimport Contact from \"./components/contact\";\nimport Instruction from \"./components/instruction\";\nimport Projects from \"./components/projects\";\n\nimport \"./css/App.css\";\nimport \"./css/arrows.css\";\nimport \"./css/mobile.css\";\nimport \"./css/table.css\";\n\nconst TICK_RATE = 100;\nconst GRID_SIZE = 35;\nconst GRID = [];\n\nfor (let i = 0; i <= GRID_SIZE; i++) {\n GRID.push(i);\n}\n\nconst DIRECTIONS = {\n UP: \"UP\",\n BOTTOM: \"BOTTOM\",\n RIGHT: \"RIGHT\",\n LEFT: \"LEFT\",\n};\n\nconst DIRECTION_TICKS = {\n UP: (x, y) => ({ x, y: y - 1 }),\n BOTTOM: (x, y) => ({ x, y: y + 1 }),\n RIGHT: (x, y) => ({ x: x + 1, y }),\n LEFT: (x, y) => ({ x: x - 1, y }),\n};\n\nconst KEY_CODES_MAPPER = {\n 38: \"UP\",\n 39: \"RIGHT\",\n 37: \"LEFT\",\n 40: \"BOTTOM\",\n};\n\nconst getRandomNumberFromRange = (min, max) =>\n Math.floor(Math.random() * (max - min + 1) + min);\n\nconst getRandomCoordinate = () => ({\n x: getRandomNumberFromRange(1, GRID_SIZE - 1),\n y: getRandomNumberFromRange(1, GRID_SIZE - 1),\n});\n\nconst getMiddleCooridinate = () => ({\n x: Math.floor((GRID_SIZE + 1) / 2),\n y: Math.floor((GRID_SIZE + 1) / 2),\n});\n\nconst isBorder = (x, y) =>\n x === 0 || y === 0 || x === GRID_SIZE || y === GRID_SIZE;\n\nconst isPosition = (x, y, diffX, diffY) => x === diffX && y === diffY;\n\nconst isSnake = (x, y, snakeCoordinates) =>\n snakeCoordinates.filter((coordinate) =>\n isPosition(coordinate.x, coordinate.y, x, y)\n ).length;\n\nconst getSnakeHead = (snake) => snake.coordinates[0];\n\nconst getSnakeWithoutStub = (snake) =>\n snake.coordinates.slice(0, snake.coordinates.length - 1);\n\nconst getSnakeTail = (snake) => snake.coordinates.slice(1);\n\nconst getIsSnakeOutside = (snake) =>\n getSnakeHead(snake).x >= GRID_SIZE ||\n getSnakeHead(snake).y >= GRID_SIZE ||\n getSnakeHead(snake).x <= 0 ||\n getSnakeHead(snake).y <= 0;\n\nconst getIsSnakeClumy = (snake) =>\n isSnake(getSnakeHead(snake).x, getSnakeHead(snake).y, getSnakeTail(snake));\n\nconst getIsSnakeEating = ({ snake, snack }) =>\n isPosition(\n getSnakeHead(snake).x,\n getSnakeHead(snake).y,\n snack.coordinate.x,\n snack.coordinate.y\n );\nconst getIsSnakeGettingResume = ({ snake, resume }) =>\n isPosition(\n getSnakeHead(snake).x,\n getSnakeHead(snake).y,\n resume.coordinate.x,\n resume.coordinate.y\n );\nconst getIsSnakeGettingProjects = ({ snake, projects }) =>\n isPosition(\n getSnakeHead(snake).x,\n getSnakeHead(snake).y,\n projects.coordinate.x,\n projects.coordinate.y\n );\n\nconst getCellCs = (isGameOver, snake, snack, resume, projects, x, y) =>\n cs(\"grid-cell\", {\n \"grid-cell-border\": isBorder(x, y),\n \"grid-cell-snake\": isSnake(x, y, snake.coordinates),\n \"grid-cell-snack\": isPosition(x, y, snack.coordinate.x, snack.coordinate.y),\n \"grid-cell-resume\": isPosition(\n x,\n y,\n resume.coordinate.x,\n resume.coordinate.y\n ),\n \"grid-cell-projects\": isPosition(\n x,\n y,\n projects.coordinate.x,\n projects.coordinate.y\n ),\n \"grid-cell-hit\":\n isGameOver &&\n isPosition(x, y, getSnakeHead(snake).x, getSnakeHead(snake).y),\n });\n\nconst reducer = (state, action) => {\n switch (action.type) {\n case \"SNAKE_CHANGE_DIRECTION\":\n return {\n ...state,\n playground: {\n ...state.playground,\n direction: action.direction,\n },\n };\n case \"SNAKE_MOVE\":\n console.log(\"moving\");\n const isSnakeEating = getIsSnakeEating(state);\n const isSnakeResume = getIsSnakeGettingResume(state);\n const isSnakeProjects = getIsSnakeGettingProjects(state);\n\n const snakeHead = DIRECTION_TICKS[state.playground.direction](\n getSnakeHead(state.snake).x,\n getSnakeHead(state.snake).y\n );\n // making the tail longer\n const snakeTail =\n isSnakeEating || isSnakeResume || isSnakeProjects\n ? state.snake.coordinates\n : getSnakeWithoutStub(state.snake);\n const snackCoordinate = isSnakeEating\n ? getRandomCoordinate()\n : state.snack.coordinate;\n const resumeCoordinate = isSnakeResume\n ? getRandomCoordinate()\n : state.resume.coordinate;\n const projectsCoordinate = isSnakeProjects\n ? getRandomCoordinate()\n : state.projects.coordinate;\n\n return {\n ...state,\n snake: {\n coordinates: [snakeHead, ...snakeTail],\n },\n snack: {\n coordinate: snackCoordinate,\n },\n resume: {\n coordinate: resumeCoordinate,\n },\n projects: {\n coordinate: projectsCoordinate,\n },\n };\n\n case \"GAME_OVER\":\n return {\n ...state,\n playground: {\n ...state.playground,\n isGameOver: true,\n },\n };\n default:\n throw new Error();\n }\n};\n\nconst initialState = {\n playground: {\n direction: DIRECTIONS.RIGHT,\n isGameOver: false,\n },\n snake: {\n coordinates: [getMiddleCooridinate()],\n },\n snack: {\n coordinate: getRandomCoordinate(),\n },\n resume: {\n coordinate: getRandomCoordinate(),\n },\n profile: {\n coordinate: getRandomCoordinate(),\n },\n projects: {\n coordinate: getRandomCoordinate(),\n },\n};\nconst App = () => {\n const [state, dispatch] = useReducer(reducer, initialState);\n const [showProfile, setShowProfile] = useState(false);\n const [showProjects, setShowProjects] = useState(false);\n const [started, setStarted] = useState(false);\n const [resumeCount, setResumeCount] = useState(0);\n const [projectCount, setProjectCount] = useState(0);\n const [width, setWidth] = useState(window.innerWidth);\n const [showReadyText, setShowReadyText] = useState(false);\n const [timer, setTimer] = useState(0);\n useEffect(() => {\n if (timer > 0) {\n setTimeout(() => {\n console.log(\"startTime, \", timer);\n setTimer(timer - 1);\n }, 1000);\n }\n if (timer === 0 && showReadyText) {\n console.log(\"done\");\n setShowReadyText(false);\n continueGame();\n }\n }, [timer, showReadyText]);\n const onChangeDirection = (event) => {\n if (KEY_CODES_MAPPER[event.keyCode]) {\n dispatch({\n type: \"SNAKE_CHANGE_DIRECTION\",\n direction: KEY_CODES_MAPPER[event.keyCode],\n });\n }\n };\n useEffect(() => {\n console.log(\"started\" + started);\n }, [started]);\n useEffect(() => {\n console.log(\"width\" + width);\n console.log(\"started\" + started);\n\n // if (width > 420) {\n // setStarted(true);\n // }\n }, [width, started]);\n useEffect(() => {\n setResumeCount(resumeCount + 1);\n if (resumeCount >= 1) {\n setShowProfile(true);\n }\n }, [state.resume.coordinate]);\n\n useEffect(() => {\n setProjectCount(projectCount + 1);\n if (projectCount >= 1) {\n setShowProjects(true);\n }\n }, [state.projects.coordinate]);\n\n useEffect(() => {\n if (width > 420) {\n setStarted(true);\n }\n window.addEventListener(\"keyup\", onChangeDirection, false);\n\n return () => window.removeEventListener(\"keyup\", onChangeDirection, false);\n }, []);\n\n useEffect(() => {\n if (started && showProfile === false && showProjects === false) {\n const onTick = () => {\n getIsSnakeOutside(state.snake) || getIsSnakeClumy(state.snake)\n ? dispatch({ type: \"GAME_OVER\" })\n : dispatch({ type: \"SNAKE_MOVE\" });\n };\n const interval = setInterval(onTick, TICK_RATE);\n return () => clearInterval(interval);\n }\n }, [state, started]);\n //show resume\n\n function endGame() {\n dispatch({ type: \"GAME_OVER\" });\n }\n function switchDirection(direction) {\n dispatch({\n type: \"SNAKE_CHANGE_DIRECTION\",\n direction: direction,\n });\n }\n const continueGame = () => {\n dispatch({ type: \"SNAKE_MOVE\" });\n };\n return (\n <div className=\"app\">\n <h1 className=\"title\">Kenny Ng, Software Engineer</h1>\n <Grid\n snake={state.snake}\n snack={state.snack}\n resume={state.resume}\n isGameOver={state.playground.isGameOver}\n projects={state.projects}\n />\n <Profile\n showProfile={showProfile}\n setShowProfile={setShowProfile}\n endGame={endGame}\n continueGame={continueGame}\n showReadyText={showReadyText}\n setShowReadyText={setShowReadyText}\n timer={timer}\n setTimer={setTimer}\n />\n <Projects\n showProjects={showProjects}\n setShowProjects={setShowProjects}\n endGame={endGame}\n continueGame={continueGame}\n showReadyText={showReadyText}\n setShowReadyText={setShowReadyText}\n timer={timer}\n setTimer={setTimer}\n />\n <Arrows switchDirection={switchDirection} />\n <Table />\n <Contact />\n <Instruction />\n <div\n className={width < 420 ? \"profile\" : \"profile-hidden\"}\n id=\"welcoming-msg\"\n >\n <h1>Hi!</h1>\n <p>\n {\" \"}\n I am Kenny and welcome to my site! Use our provided virtual keyboard\n ↓ to play the snake game and learn about me!{\" \"}\n </p>\n <div id=\"start-div\">\n <h1\n onClick={() => {\n setStarted(true);\n setWidth(9999);\n }}\n id=\"btn\"\n >\n Start!\n </h1>\n </div>\n </div>\n </div>\n );\n};\n\nconst Grid = ({ isGameOver, snake, snack, resume, projects }) => (\n <div>\n {GRID.map((y) => (\n <Row\n y={y}\n key={y}\n snake={snake}\n snack={snack}\n resume={resume}\n projects={projects}\n isGameOver={isGameOver}\n />\n ))}\n </div>\n);\n\nconst Row = ({ isGameOver, snake, snack, resume, projects, y }) => (\n <div className=\"grid-row\">\n {GRID.map((x) => (\n <Cell\n x={x}\n y={y}\n key={x}\n snake={snake}\n snack={snack}\n projects={projects}\n resume={resume}\n isGameOver={isGameOver}\n />\n ))}\n </div>\n);\n\nconst Cell = ({ isGameOver, snake, snack, resume, projects, x, y }) => (\n <div\n className={getCellCs(isGameOver, snake, snack, projects, resume, x, y)}\n />\n);\n\nexport default App;\n",["50","51"],{"ruleId":"52","replacedBy":"53"},{"ruleId":"54","replacedBy":"55"},{"ruleId":"52","replacedBy":"56"},{"ruleId":"54","replacedBy":"57"},{"ruleId":"58","severity":1,"message":"59","line":259,"column":6,"nodeType":"60","endLine":259,"endColumn":31,"suggestions":"61"},{"ruleId":"58","severity":1,"message":"62","line":266,"column":6,"nodeType":"60","endLine":266,"endColumn":33,"suggestions":"63"},{"ruleId":"58","severity":1,"message":"64","line":275,"column":6,"nodeType":"60","endLine":275,"endColumn":8,"suggestions":"65"},{"ruleId":"58","severity":1,"message":"66","line":287,"column":6,"nodeType":"60","endLine":287,"endColumn":22,"suggestions":"67"},{"ruleId":"52","replacedBy":"68"},{"ruleId":"54","replacedBy":"69"},"no-native-reassign",["70"],"no-negated-in-lhs",["71"],["70"],["71"],"react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'resumeCount'. Either include it or remove the dependency array. You can also do a functional update 'setResumeCount(r => ...)' if you only need 'resumeCount' in the 'setResumeCount' call.","ArrayExpression",["72"],"React Hook useEffect has a missing dependency: 'projectCount'. Either include it or remove the dependency array. You can also do a functional update 'setProjectCount(p => ...)' if you only need 'projectCount' in the 'setProjectCount' call.",["73"],"React Hook useEffect has a missing dependency: 'width'. Either include it or remove the dependency array.",["74"],"React Hook useEffect has missing dependencies: 'showProfile' and 'showProjects'. Either include them or remove the dependency array.",["75"],["70"],["71"],"no-global-assign","no-unsafe-negation",{"desc":"76","fix":"77"},{"desc":"78","fix":"79"},{"desc":"80","fix":"81"},{"desc":"82","fix":"83"},"Update the dependencies array to be: [resumeCount, state.resume.coordinate]",{"range":"84","text":"85"},"Update the dependencies array to be: [projectCount, state.projects.coordinate]",{"range":"86","text":"87"},"Update the dependencies array to be: [width]",{"range":"88","text":"89"},"Update the dependencies array to be: [state, started, showProfile, showProjects]",{"range":"90","text":"91"},[6779,6804],"[resumeCount, state.resume.coordinate]",[6936,6963],"[projectCount, state.projects.coordinate]",[7190,7192],"[width]",[7595,7611],"[state, started, showProfile, showProjects]"]