-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 8.96 KB
/
.eslintcache
1
[{"/home/daksh4469/Desktop/sortingviz/src/index.js":"1","/home/daksh4469/Desktop/sortingviz/src/reportWebVitals.js":"2","/home/daksh4469/Desktop/sortingviz/src/App.js":"3","/home/daksh4469/Desktop/sortingviz/src/Main.js":"4"},{"size":500,"mtime":1607020426312,"results":"5","hashOfConfig":"6"},{"size":362,"mtime":1606815723786,"results":"7","hashOfConfig":"6"},{"size":204,"mtime":1606899582545,"results":"8","hashOfConfig":"6"},{"size":6363,"mtime":1607020844646,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"13ph3eg",{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"14"},{"filePath":"15","messages":"16","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"17","usedDeprecatedRules":"14"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"20"},"/home/daksh4469/Desktop/sortingviz/src/index.js",[],"/home/daksh4469/Desktop/sortingviz/src/reportWebVitals.js",[],["21","22"],"/home/daksh4469/Desktop/sortingviz/src/App.js",["23"],"import logo from './logo.svg';\nimport './App.css';\nimport './Main';\nimport Main from './Main';\n\nfunction App() {\n return (\n <div className=\"App\">\n <Main />\n </div>\n );\n}\n\nexport default App;\n","/home/daksh4469/Desktop/sortingviz/src/Main.js",["24","25"],"import React, { useEffect, useState } from 'react';\nimport './Main.css';\nimport Box from '@material-ui/core/Box';\nimport { Button } from '@material-ui/core';\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n width: \"70vw\",\n },\n }));\n\nfunction Main(props){\n const classes = useStyles();\n const [array,setArray] = useState([]);\n const [start,setStart] = useState(false);\n const [arraysize,setArraysize] = useState(75);\n const [msg,setMsg] = useState(\"\");\n const [mode,setMode] = useState(false);\n\n const sleep = (milliseconds) => {\n return new Promise(resolve => setTimeout(resolve, milliseconds))\n }\n\n function generateNewArray(){\n if(start){\n return;\n }\n setMsg(\"\");\n let newarray = [];\n for(let i = 0;i<arraysize;i++){\n newarray.push(Math.floor(Math.random()*(991)+10));\n }\n setArray(newarray);\n console.log(array);\n for(let i = 0;i<array.length;i++){\n document.getElementsByClassName('bars')[i].style.backgroundColor = \"aquamarine\";\n }\n }\n\n const arraysort = async()=>{\n if(start){\n return;\n }\n setMsg(\"\");\n let temp;\n setStart(true);\n let i1 = 0,i2 = 0;\n for(let i = 0;i<arraysize-1;i++){\n for(let j = 0;j<arraysize-1-i;j++){\n document.getElementsByClassName('bars')[j].style.backgroundColor = \"royalblue\";\n document.getElementsByClassName('bars')[j+1].style.backgroundColor = \"royalblue\";\n await sleep(1000/arraysize);\n if(array[j]>array[j+1]){\n temp = array[j];\n array[j] = array[j+1];\n document.getElementsByClassName('bars')[j].style.backgroundColor = \"red\";\n document.getElementsByClassName('bars')[j].style.height = `${array[j+1]/2}px`;\n // document.getElementsByClassName('bars')[j].style.backgroundColor = \"aquamarine\";\n array[j+1] = temp;\n document.getElementsByClassName('bars')[j+1].style.backgroundColor = \"red\";\n document.getElementsByClassName('bars')[j+1].style.height = `${temp/2}px`;\n i2 = j+1;\n i1 = j;\n // document.getElementsByClassName('bars')[j+1].style.backgroundColor = \"aquamarine\";\n }\n else{\n document.getElementsByClassName('bars')[j].style.backgroundColor = \"aquamarine\";\n document.getElementsByClassName('bars')[j+1].style.backgroundColor = \"aquamarine\";\n }\n await sleep(2000/arraysize);\n if(document.getElementsByClassName('bars')[i1].style.backgroundColor!==\"blue\"){\n document.getElementsByClassName('bars')[i1].style.backgroundColor = \"aquamarine\";\n }\n if(document.getElementsByClassName('bars')[i2].style.backgroundColor!==\"blue\"){\n document.getElementsByClassName('bars')[i2].style.backgroundColor = \"aquamarine\";\n }\n // document.getElementsByClassName('bars')[i2].style.backgroundColor = \"royalblue\";\n }\n for(let k = arraysize-1;k>=arraysize-i-1;k--){\n document.getElementsByClassName('bars')[k].style.backgroundColor = \"blue\"; \n }\n // document.getElementsByClassName('bars')[99].style.backgroundColor = \"blue\";\n await sleep(75);\n }\n document.getElementsByClassName('bars')[0].style.backgroundColor = \"blue\";\n setStart(false);\n setMsg(\"Array is Sorted.\");\n }\n\n useEffect(()=>{\n generateNewArray();\n },[arraysize]);\n\n function changeArraysize(){\n if(start){\n return;\n }\n let as = prompt(\"Please enter the array size between 10 and 150\");\n console.log(\"as: \"+as);\n if(as==null || as.length==0 || as<10 || as>150){\n changeArraysize();\n }\n setArraysize(as);\n generateNewArray();\n for(let i = 0;i<array.length;i++){\n document.getElementsByClassName('bars')[i].style.backgroundColor = \"aquamarine\";\n }\n }\n\n function darkmode(){\n if(!mode){\n setMode(true);\n document.getElementsByClassName('array-container')[0].style.backgroundColor = \"black\";\n document.getElementsByClassName('window')[0].style.backgroundColor = \"black\";\n document.getElementsByClassName('heading')[0].style.color = \"white\";\n document.getElementsByClassName('dark')[0].style.color = \"white\";\n }\n else{\n setMode(false);\n document.getElementsByClassName('array-container')[0].style.backgroundColor = \"white\";\n document.getElementsByClassName('window')[0].style.backgroundColor = \"white\";\n document.getElementsByClassName('heading')[0].style.color = \"black\";\n document.getElementsByClassName('dark')[0].style.color = \"black\";\n }\n }\n\n return (\n <div className=\"window\">\n <h1 className=\"heading\">SortingViz</h1>\n <div className=\"buttons\">\n <Box mt={2}>\n <Button className={classes.button} variant=\"contained\" onClick={generateNewArray} style={start ? {opacity: \"0.5\"} : {opacity: \"1\"}}>Generate New Array</Button>\n <Button variant=\"contained\" color=\"secondary\" onClick={changeArraysize} style={start ? {opacity: \"0.5\"} : {opacity: \"1\"}}>Change Array Size</Button>\n <Button color=\"primary\" variant=\"contained\" onClick={arraysort} style={start ? {opacity: \"0.5\"} : {opacity: \"1\"}}>Sort</Button>\n <Button onClick={darkmode} className=\"dark\" color=\"primary\">{mode ? \"Light Mode\" : \"Dark Mode\"}</Button>\n </Box>\n </div>\n <p>{msg}</p>\n <div className=\"array-container\">\n {\n array.map((num)=>(\n <div className=\"bars\" style={{height: `${num/2}px`, width: `${30/array.length}vw`}}>\n {/* {num} */}\n </div>\n ))\n }\n </div>\n </div>\n )\n}\n\nexport default Main;",{"ruleId":"26","replacedBy":"27"},{"ruleId":"28","replacedBy":"29"},{"ruleId":"30","severity":1,"message":"31","line":1,"column":8,"nodeType":"32","messageId":"33","endLine":1,"endColumn":12},{"ruleId":"34","severity":1,"message":"35","line":93,"column":7,"nodeType":"36","endLine":93,"endColumn":18,"suggestions":"37"},{"ruleId":"38","severity":1,"message":"39","line":101,"column":33,"nodeType":"40","messageId":"41","endLine":101,"endColumn":35},"no-native-reassign",["42"],"no-negated-in-lhs",["43"],"no-unused-vars","'logo' is defined but never used.","Identifier","unusedVar","react-hooks/exhaustive-deps","React Hook useEffect has a missing dependency: 'generateNewArray'. Either include it or remove the dependency array.","ArrayExpression",["44"],"eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","no-global-assign","no-unsafe-negation",{"desc":"45","fix":"46"},"Update the dependencies array to be: [arraysize, generateNewArray]",{"range":"47","text":"48"},[3816,3827],"[arraysize, generateNewArray]"]