-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy path.eslintcache
1 lines (1 loc) · 6.54 KB
/
.eslintcache
1
[{"C:\\Users\\khush\\Desktop\\Pagination\\react-pagination-component\\src\\index.js":"1","C:\\Users\\khush\\Desktop\\Pagination\\react-pagination-component\\src\\reportWebVitals.js":"2","C:\\Users\\khush\\Desktop\\Pagination\\react-pagination-component\\src\\App.js":"3","C:\\Users\\khush\\Desktop\\Pagination\\react-pagination-component\\src\\components\\PaginationComponent.js":"4"},{"size":500,"mtime":499162500000,"results":"5","hashOfConfig":"6"},{"size":362,"mtime":499162500000,"results":"7","hashOfConfig":"6"},{"size":293,"mtime":1609666028785,"results":"8","hashOfConfig":"6"},{"size":3335,"mtime":1609668159518,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"12"},"yafc53",{"filePath":"13","messages":"14","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"12"},{"filePath":"15","messages":"16","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"17","usedDeprecatedRules":"12"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":"20"},"C:\\Users\\khush\\Desktop\\Pagination\\react-pagination-component\\src\\index.js",[],["21","22"],"C:\\Users\\khush\\Desktop\\Pagination\\react-pagination-component\\src\\reportWebVitals.js",[],"C:\\Users\\khush\\Desktop\\Pagination\\react-pagination-component\\src\\App.js",["23"],"import logo from \"./logo.svg\";\nimport \"./App.css\";\nimport PaginationComponent from \"./components/PaginationComponent\";\n\nfunction App() {\n return (\n <div className=\"App\">\n <div className=\"App-header\">\n <PaginationComponent />\n </div>\n </div>\n );\n}\n\nexport default App;\n","C:\\Users\\khush\\Desktop\\Pagination\\react-pagination-component\\src\\components\\PaginationComponent.js",["24","25","26","27","28"],"import React, { useEffect, useState } from \"react\";\r\nimport \"./style.css\";\r\nconst renderData = (data) => {\r\n return (\r\n <ul>\r\n {data.map((todo, index) => {\r\n return <li key={index}>{todo.title}</li>;\r\n })}\r\n </ul>\r\n );\r\n};\r\n\r\nfunction PaginationComponent() {\r\n const [data, setData] = useState([]);\r\n\r\n const [currentPage, setcurrentPage] = useState(1);\r\n const [itemsPerPage, setitemsPerPage] = useState(5);\r\n\r\n const [pageNumberLimit, setpageNumberLimit] = useState(5);\r\n const [maxPageNumberLimit, setmaxPageNumberLimit] = useState(5);\r\n const [minPageNumberLimit, setminPageNumberLimit] = useState(0);\r\n\r\n const handleClick = (event) => {\r\n setcurrentPage(Number(event.target.id));\r\n };\r\n\r\n const pages = [];\r\n for (let i = 1; i <= Math.ceil(data.length / itemsPerPage); i++) {\r\n pages.push(i);\r\n }\r\n\r\n const indexOfLastItem = currentPage * itemsPerPage;\r\n const indexOfFirstItem = indexOfLastItem - itemsPerPage;\r\n const currentItems = data.slice(indexOfFirstItem, indexOfLastItem);\r\n\r\n const renderPageNumbers = pages.map((number) => {\r\n if (number < maxPageNumberLimit + 1 && number > minPageNumberLimit) {\r\n return (\r\n <li\r\n key={number}\r\n id={number}\r\n onClick={handleClick}\r\n className={currentPage == number ? \"active\" : null}\r\n >\r\n {number}\r\n </li>\r\n );\r\n } else {\r\n return null;\r\n }\r\n });\r\n\r\n useEffect(() => {\r\n fetch(\"https://jsonplaceholder.typicode.com/todos\")\r\n .then((response) => response.json())\r\n .then((json) => setData(json));\r\n }, []);\r\n\r\n const handleNextbtn = () => {\r\n setcurrentPage(currentPage + 1);\r\n\r\n if (currentPage + 1 > maxPageNumberLimit) {\r\n setmaxPageNumberLimit(maxPageNumberLimit + pageNumberLimit);\r\n setminPageNumberLimit(minPageNumberLimit + pageNumberLimit);\r\n }\r\n };\r\n\r\n const handlePrevbtn = () => {\r\n setcurrentPage(currentPage - 1);\r\n\r\n if ((currentPage - 1) % pageNumberLimit == 0) {\r\n setmaxPageNumberLimit(maxPageNumberLimit - pageNumberLimit);\r\n setminPageNumberLimit(minPageNumberLimit - pageNumberLimit);\r\n }\r\n };\r\n\r\n let pageIncrementBtn = null;\r\n if (pages.length > maxPageNumberLimit) {\r\n pageIncrementBtn = <li onClick={handleNextbtn}> … </li>;\r\n }\r\n\r\n let pageDecrementBtn = null;\r\n if (minPageNumberLimit >= 1) {\r\n pageDecrementBtn = <li onClick={handlePrevbtn}> … </li>;\r\n }\r\n\r\n const handleLoadMore = () => {\r\n setitemsPerPage(itemsPerPage + 5);\r\n };\r\n\r\n return (\r\n <>\r\n <h1>Todo List</h1> <br />\r\n {renderData(currentItems)}\r\n <ul className=\"pageNumbers\">\r\n <li>\r\n <button\r\n onClick={handlePrevbtn}\r\n disabled={currentPage == pages[0] ? true : false}\r\n >\r\n Prev\r\n </button>\r\n </li>\r\n {pageDecrementBtn}\r\n {renderPageNumbers}\r\n {pageIncrementBtn}\r\n\r\n <li>\r\n <button\r\n onClick={handleNextbtn}\r\n disabled={currentPage == pages[pages.length - 1] ? true : false}\r\n >\r\n Next\r\n </button>\r\n </li>\r\n </ul>\r\n <button onClick={handleLoadMore} className=\"loadmore\">\r\n Load More\r\n </button>\r\n </>\r\n );\r\n}\r\n\r\nexport default PaginationComponent;\r\n",{"ruleId":"29","replacedBy":"30"},{"ruleId":"31","replacedBy":"32"},{"ruleId":"33","severity":1,"message":"34","line":1,"column":8,"nodeType":"35","messageId":"36","endLine":1,"endColumn":12},{"ruleId":"33","severity":1,"message":"37","line":19,"column":27,"nodeType":"35","messageId":"36","endLine":19,"endColumn":45},{"ruleId":"38","severity":1,"message":"39","line":43,"column":34,"nodeType":"40","messageId":"41","endLine":43,"endColumn":36},{"ruleId":"38","severity":1,"message":"39","line":71,"column":45,"nodeType":"40","messageId":"41","endLine":71,"endColumn":47},{"ruleId":"38","severity":1,"message":"39","line":99,"column":35,"nodeType":"40","messageId":"41","endLine":99,"endColumn":37},{"ruleId":"38","severity":1,"message":"39","line":111,"column":35,"nodeType":"40","messageId":"41","endLine":111,"endColumn":37},"no-native-reassign",["42"],"no-negated-in-lhs",["43"],"no-unused-vars","'logo' is defined but never used.","Identifier","unusedVar","'setpageNumberLimit' is assigned a value but never used.","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","no-global-assign","no-unsafe-negation"]