-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 16.1 KB
/
.eslintcache
1
[{"C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\index.js":"1","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\reportWebVitals.js":"2","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\App.js":"3","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\CasesByCountry.js":"4","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\HeaderCards.js":"5","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\FormControl.js":"6","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\MapLeaflet.js":"7","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\LineGraph.js":"8"},{"size":500,"mtime":499162500000,"results":"9","hashOfConfig":"10"},{"size":362,"mtime":499162500000,"results":"11","hashOfConfig":"10"},{"size":5973,"mtime":1614886387413,"results":"12","hashOfConfig":"10"},{"size":3426,"mtime":1614886051559,"results":"13","hashOfConfig":"10"},{"size":2090,"mtime":1614861347381,"results":"14","hashOfConfig":"10"},{"size":703,"mtime":1612615643216,"results":"15","hashOfConfig":"10"},{"size":1489,"mtime":1614883399429,"results":"16","hashOfConfig":"10"},{"size":1240,"mtime":1614861158687,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},"1jfv14j",{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},{"filePath":"23","messages":"24","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"25","usedDeprecatedRules":"20"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"28","usedDeprecatedRules":"20"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},{"filePath":"33","messages":"34","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"35","usedDeprecatedRules":"36"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},"C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\index.js",[],["39","40"],"C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\reportWebVitals.js",[],"C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\App.js",["41","42"],"import './App.css';\nimport { useState, useEffect } from 'react';\nimport \"leaflet/dist/leaflet.css\";\nimport Table from 'react-bootstrap/Table';\nimport Container from 'react-bootstrap/Container';\nimport Row from 'react-bootstrap/Row';\nimport Col from 'react-bootstrap/Col';\nimport axios from 'axios';\nimport CasesByCountry from './components/CasesByCountry';\nimport HeaderCards from './components/HeaderCards';\nimport FormControl from './components/FormControl';\nimport LineGraph from './components/LineGraph';\nimport 'bootstrap/dist/css/bootstrap.min.css';\nimport './styles/style.css';\nimport MapLeaflet from './components/MapLeaflet';\n\n\nconst App =() => {\n const [countries,setCountries] = useState([]);\n const [cardData,setCardData] = useState([]);\n const [mapCenter, setMapCenter] = useState({ lat: 37.80746, lng: -80.4796});\n const [mapZoom, setMapZoom] = useState(5);\n const [historicalDeaths, setHistoricalDeaths] = useState([]);\n const [historicalCases, setHistoricalCases] = useState([]);\n const [historicalRecv, setHistoricalRecv] = useState([]);\n const [historicalDates, setHistoricalDates] = useState([]);\n const [] = useState([]);\n /*const [getCardInfos, setGetCardInfos] = useState(\"https://disease.sh/v3/covid-19/all?yesterday=true&twoDaysAgo=true&allowNull=true\");\n const [selectedCountry, setSelectedCountry] = useState(\"WorldWide\");*/\n const onChangeCountry = async (e) => {\n const countryCode = e.target.value;\n const urlCards = (countryCode === \"WorldWide\" ? `https://disease.sh/v3/covid-19/all?yesterday=true&twoDaysAgo=true&allowNull=true` :\n `https://disease.sh/v3/covid-19/countries/${countryCode}?yesterday=false&twoDaysAgo=false&strict=false&allowNull=false`)\n const resultOption = await axios(urlCards);\n setCardData(resultOption.data);\n setMapCenter(countryCode === \"WorldWide\" ? [37.80746, -80.4796] : [resultOption.data.countryInfo.lat, resultOption.data.countryInfo.long]);\n setMapZoom(4);\n const urlLineData = (countryCode === \"WorldWide\" ? `https://disease.sh/v3/covid-19/historical/all?lastdays=210` :\n `https://disease.sh/v3/covid-19/historical/${countryCode}?lastdays=210`);\n const resultLine = await axios(urlLineData);\n const lineArrayDeaths = [];\n const lineArrayCases = [];\n const lineArrayRecv = [];\n setHistoricalDeaths(countryCode === \"WorldWide\" ? \n () => {\n for (let i = 0; i < 210; i = i + 10) {\n lineArrayDeaths.push(Object.values(resultLine.data.deaths)[i]);\n }\n return lineArrayDeaths;} :\n () => {\n for (let i = 0; i < 210; i = i + 10) {\n lineArrayDeaths.push(Object.values(resultLine.data.timeline.deaths)[i]);\n }\n return lineArrayDeaths;}\n );\n setHistoricalCases(countryCode === \"WorldWide\" ? () => {\n for (let i = 0; i < 210; i = i + 10) {\n lineArrayCases.push(Object.values(resultLine.data.cases)[i]);\n }\n return lineArrayCases;\n } : () => {\n for (let i = 0; i < 210; i = i + 10) {\n lineArrayCases.push(Object.values(resultLine.data.timeline.cases)[i]);\n }\n return lineArrayCases;\n }\n );\n setHistoricalRecv(countryCode === \"WorldWide\" ?\n () => {\n for (let i = 0; i < 210; i = i + 10) {\n lineArrayRecv.push(Object.values(resultLine.data.recovered)[i]);\n }\n return lineArrayRecv;\n } :\n () => {\n for (let i = 0; i < 210; i = i + 10) {\n lineArrayRecv.push(Object.values(resultLine.data.timeline.recovered)[i]);\n }\n return lineArrayRecv;\n });\n }\n\n useEffect(async () => {\n const result = await axios(`https://disease.sh/v3/covid-19/countries?yesterday=true&twoDaysAgo=true&sort=active&allowNull=true`);\n setCountries(result.data);\n const resultOption = await axios(`https://disease.sh/v3/covid-19/all?yesterday=true&twoDaysAgo=true&allowNull=true`);\n setCardData(resultOption.data);\n const resultDefault = await axios(`https://disease.sh/v3/covid-19/historical/all?lastdays=210`);\n const lineArrayDeaths = [];\n const lineArrayCases = [];\n const lineArrayRecv = [];\n const lineArrayDates = Object.getOwnPropertyNames(resultDefault.data.deaths);\n setHistoricalDates(lineArrayDates);\n setHistoricalDeaths(() => {\n for (let i = 0; i < 210; i = i + 10) {\n lineArrayDeaths.push(Object.values(resultDefault.data.deaths)[i]);\n } return lineArrayDeaths;\n });\n setHistoricalCases(() => {\n for (let i = 0; i < 210; i = i + 10) {\n lineArrayCases.push(Object.values(resultDefault.data.cases)[i]);\n } return lineArrayCases;\n });\n setHistoricalRecv(() => {\n for (let i = 0; i < 220; i = i + 10) {\n lineArrayRecv.push(Object.values(resultDefault.data.recovered)[i]);\n }\n return lineArrayRecv;\n });\n }, []);\n return (\n <>\n <Container fluid={true}>\n <Row className=\"my-4\">\n <Col xs={12} md={6}>\n <Row>\n <Col xs={12} sm={8}>\n <h1 className=\"text-center\">COVID-19 TRACKER</h1>\n </Col>\n <Col xs={12} sm={4}>\n <FormControl countries={countries} onChangeCountry={onChangeCountry}/>\n </Col>\n <Col xs={12}>\n <HeaderCards cardData={cardData}/>\n </Col>\n </Row>\n <MapLeaflet mapCenter = {mapCenter} mapZoom={mapZoom} cardData= {cardData}/>\n </Col>\n <Col xs={12} md={6}>\n <div className=\"tableDiv mb-3\">\n <Table className=\"tableComponent\">\n <CasesByCountry countries={countries}/>\n </Table>\n </div>\n <LineGraph historicalDeaths ={historicalDeaths} historicalCases ={historicalCases} historicalDates = {historicalDates} historicalRecv ={historicalRecv}/>\n </Col>\n </Row>\n </Container>\n </>\n );\n}\nexport default App;\n","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\CasesByCountry.js",["43","44","45"],"import numeral from \"numeral\";\r\nimport { useState } from 'react';\r\nconst CasesByCountry = ({ countries }) => {\r\n const [sortedByTitle, setSortedByTitle] = useState();\r\n class FilteredDatas {\r\n constructor( caseTest, deathPop, deathRecv, todayCases, activeCases, countryName) {\r\n this.caseTest = caseTest;\r\n this.deathPop = deathPop;\r\n this.deathRecv = deathRecv;\r\n this.todayCases = todayCases;\r\n this.activeCases = activeCases;\r\n this.countryName = countryName;\r\n }\r\n }\r\n const dataArray = [];\r\n countries.map((countryData) => {\r\n let caseTest = parseFloat(countryData.cases / countryData.tests).toFixed(2);\r\n let deathPop = parseInt(countryData.population / countryData.deaths);\r\n let deathRecv = parseFloat(countryData.deaths / countryData.recovered).toFixed(2);\r\n let todayCases = countryData.todayCases;\r\n let activeCases = countryData.cases;\r\n if (caseTest == Infinity) {\r\n caseTest = 0;\r\n }\r\n if (deathRecv == Infinity) {\r\n deathRecv = 0;\r\n }\r\n const filteredData = new FilteredDatas(caseTest, deathPop, deathRecv, todayCases, activeCases, countryData.country);\r\n dataArray.push(filteredData);\r\n })\r\n return (\r\n <>\r\n <thead className=\"titleTable\">\r\n <tr>\r\n <th className=\"bg-dark text-light\">#</th>\r\n <th className=\"bg-dark text-light\" onClick={() => setSortedByTitle(\"countryName\")}>Country</th>\r\n <th className=\"bg-dark text-light\" onClick = {() => setSortedByTitle(\"activeCases\")}>Active Cases</th>\r\n <th className=\"bg-dark text-light\" onClick = {() => setSortedByTitle(\"todayCases\")}>Today Cases</th>\r\n <th className=\"bg-dark text-light\" onClick = {() => setSortedByTitle(\"caseTest\")}>Case/Test</th>\r\n <th className=\"bg-dark text-light\" onClick = {() => setSortedByTitle(\"deathPop\")}>Pop./Death</th>\r\n <th className=\"bg-dark text-light\" onClick = {() => setSortedByTitle(\"deathRecv\")}>Death/Recv.</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n {dataArray.sort((a, b) => b[sortedByTitle] >= a[sortedByTitle] ? 1 : b[sortedByTitle] < a[sortedByTitle] ? -1 : 0).map((countryData, key) => {\r\n \r\n return (\r\n <tr key={key}>\r\n <td className=\"text-right\">{key + 1}</td>\r\n <td className=\"pl-2\"><strong>{countryData.countryName}</strong></td>\r\n <td className=\"pl-2 text-right\">{numeral(countryData.activeCases).format('0,0')}</td>\r\n <td className=\"pl-2 text-right\">{numeral(countryData.todayCases).format('0,0')}</td>\r\n <td className=\"pl-2 text-right\">{countryData.caseTest}</td>\r\n <td className=\"pl-2 text-right\">{numeral(countryData.deathPop).format('0,0')}</td>\r\n <td className=\"pl-2 text-right\">{countryData.deathRecv}</td>\r\n </tr>\r\n );\r\n })\r\n }\r\n </tbody>\r\n </>\r\n )\r\n}\r\nexport default CasesByCountry;\r\n","C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\HeaderCards.js",[],"C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\FormControl.js",[],"C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\MapLeaflet.js",["46"],"import React from 'react';\r\nimport { MapContainer , TileLayer, useMap, Marker, Tooltip } from 'react-leaflet';\r\nimport \"leaflet/dist/leaflet.css\";\r\nimport L from 'leaflet';\r\n\r\nconst MapLeaflet = ({mapCenter, mapZoom, cardData}) => {\r\n function ChangeView({ center, zoom }) {\r\n const map = useMap();\r\n map.setView(center, zoom);\r\n return null;\r\n }\r\n return (\r\n <div className=\"map-All\">\r\n <MapContainer center={mapCenter} zoom={mapZoom} scrollWheelZoom={true}>\r\n <ChangeView center={mapCenter} zoom={mapZoom} />\r\n <TileLayer attribution='© <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors' url=\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\"/>\r\n <Marker position={mapCenter}>\r\n <Tooltip direction=\"top\">\r\n <h6><strong>Country: </strong>{cardData.country}</h6>\r\n <h6 className=\"text-dark\"><strong>Continent: </strong>{cardData.continent}</h6>\r\n <h6 className=\"text-dark\"><strong>Total Cases: </strong>{cardData.cases}</h6>\r\n <h6 className=\"text-dark\"><strong>Population: </strong>{cardData.population}</h6>\r\n <h6 className=\"text-dark\"><strong>Critical Cases: </strong>{cardData.critical}</h6>\r\n </Tooltip>\r\n </Marker>\r\n </MapContainer>\r\n </div>\r\n )\r\n}\r\n export default MapLeaflet;\r\n",["47","48"],"C:\\Users\\ASUS\\Desktop\\koding\\coursera\\reacties\\corona-app\\src\\components\\LineGraph.js",[],{"ruleId":"49","replacedBy":"50"},{"ruleId":"51","replacedBy":"52"},{"ruleId":"53","severity":1,"message":"54","line":27,"column":9,"nodeType":"55","messageId":"56","endLine":27,"endColumn":11},{"ruleId":"57","severity":1,"message":"58","line":83,"column":13,"nodeType":"59","endLine":110,"endColumn":4},{"ruleId":"60","severity":1,"message":"61","line":16,"column":33,"nodeType":"59","messageId":"62","endLine":16,"endColumn":35},{"ruleId":"63","severity":1,"message":"64","line":22,"column":22,"nodeType":"65","messageId":"56","endLine":22,"endColumn":24},{"ruleId":"63","severity":1,"message":"64","line":25,"column":23,"nodeType":"65","messageId":"56","endLine":25,"endColumn":25},{"ruleId":"66","severity":1,"message":"67","line":4,"column":8,"nodeType":"68","messageId":"69","endLine":4,"endColumn":9},{"ruleId":"49","replacedBy":"70"},{"ruleId":"51","replacedBy":"71"},"no-native-reassign",["72"],"no-negated-in-lhs",["73"],"no-empty-pattern","Unexpected empty array pattern.","ArrayPattern","unexpected","react-hooks/exhaustive-deps","Effect callbacks are synchronous to prevent race conditions. Put the async function inside:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching","ArrowFunctionExpression","array-callback-return","Array.prototype.map() expects a return value from arrow function.","expectedInside","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","no-unused-vars","'L' is defined but never used.","Identifier","unusedVar",["72"],["73"],"no-global-assign","no-unsafe-negation"]