-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 4 KB
/
.eslintcache
1
[{"D:\\Bala Yokesh\\Projects\\calculator\\src\\index.js":"1","D:\\Bala Yokesh\\Projects\\calculator\\src\\App.js":"2"},{"size":230,"mtime":1673186163806,"results":"3","hashOfConfig":"4"},{"size":2609,"mtime":1673199698658,"results":"5","hashOfConfig":"4"},{"filePath":"6","messages":"7","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"8"},"588bkm",{"filePath":"9","messages":"10","errorCount":0,"fatalErrorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"11"},"D:\\Bala Yokesh\\Projects\\calculator\\src\\index.js",[],["12","13"],"D:\\Bala Yokesh\\Projects\\calculator\\src\\App.js",["14"],"import React, { useState } from 'react';\r\nimport 'bootstrap/dist/css/bootstrap.css';\r\nimport './index.css';\r\n\r\nfunction App() {\r\n\tconst [result, setResult] = useState(\"\");\r\n\r\n\tconst calculate = () => {\r\n\t\ttry {\r\n\t\t\tlet res = (eval(result) || \"\") + \"\";\r\n\t\t\tsetResult(res);\r\n\t\t}\r\n\t\tcatch (e) {\r\n\t\t\talert(\"Invalid syntax\");\r\n\t\t\tsetResult(\"\");\r\n\t\t}\r\n\t}\r\n\r\n\tconst reset = () => {\r\n\t\tsetResult(\"\");\r\n\t}\r\n\r\n\tconst backspace = () => {\r\n\t\tsetResult(result.slice(0, -1))\r\n\t}\r\n\r\n\tconst handleClick = button => {\r\n\t\tif (button === \"C\") {\r\n\t\t\treset();\r\n\t\t}\r\n\t\telse if (button === \"=\") {\r\n\t\t\tcalculate();\r\n\t\t}\r\n\t\telse if (button === \"CE\") {\r\n\t\t\tbackspace();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tlet res = result + button;\r\n\t\t\tsetResult(res);\r\n\t\t}\r\n\t}\r\n\r\n\treturn (\r\n\t\t<div className=\"d-flex flex-column vh-100 align-items-center justify-content-center\" id=\"parent\">\r\n\r\n\t\t\t<div className='bg-dark p-1' id=\"calculator\">\r\n\t\t\t\t<input id=\"display\" className='text-right bg-light'\r\n\t\t\t\t\tvalue={result}\r\n\t\t\t\t/>\r\n\r\n\t\t\t\t<div id=\"keypad\" className=\"w-100\">\r\n\t\t\t\t\t<button name=\"(\" onClick={e => handleClick(e.target.name)}>(</button>\r\n\t\t\t\t\t<button name=\")\" onClick={e => handleClick(e.target.name)}>)</button>\r\n\t\t\t\t\t<button name=\".\" onClick={e => handleClick(e.target.name)}>.</button>\r\n\t\t\t\t\t<button name=\"CE\" onClick={e => handleClick(e.target.name)}>CE</button>\r\n\r\n\t\t\t\t\t<button name=\"9\" onClick={e => handleClick(e.target.name)}>9</button>\r\n\t\t\t\t\t<button name=\"8\" onClick={e => handleClick(e.target.name)}>8</button>\r\n\t\t\t\t\t<button name=\"7\" onClick={e => handleClick(e.target.name)}>7</button>\r\n\t\t\t\t\t<button name=\"*\" onClick={e => handleClick(e.target.name)}>x</button>\r\n\r\n\t\t\t\t\t<button name=\"6\" onClick={e => handleClick(e.target.name)}>6</button>\r\n\t\t\t\t\t<button name=\"5\" onClick={e => handleClick(e.target.name)}>5</button>\r\n\t\t\t\t\t<button name=\"4\" onClick={e => handleClick(e.target.name)}>4</button>\r\n\t\t\t\t\t<button name=\"-\" onClick={e => handleClick(e.target.name)}>-</button>\r\n\r\n\t\t\t\t\t<button name=\"3\" onClick={e => handleClick(e.target.name)}>3</button>\r\n\t\t\t\t\t<button name=\"2\" onClick={e => handleClick(e.target.name)}>2</button>\r\n\t\t\t\t\t<button name=\"1\" onClick={e => handleClick(e.target.name)}>1</button>\r\n\t\t\t\t\t<button name=\"+\" onClick={e => handleClick(e.target.name)}>+</button>\r\n\r\n\t\t\t\t\t<button name=\"C\" onClick={e => handleClick(e.target.name)}>C</button>\r\n\t\t\t\t\t<button name=\"0\" onClick={e => handleClick(e.target.name)}>0</button>\r\n\t\t\t\t\t<button name=\"/\" onClick={e => handleClick(e.target.name)}>%</button>\r\n\t\t\t\t\t<button name=\"=\" onClick={e => handleClick(e.target.name)}>=</button>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t);\r\n}\r\n\r\nexport default App;\r\n",{"ruleId":"15","replacedBy":"16"},{"ruleId":"17","replacedBy":"18"},{"ruleId":"19","severity":1,"message":"20","line":10,"column":15,"nodeType":"21","messageId":"22","endLine":10,"endColumn":19},"no-native-reassign",["23"],"no-negated-in-lhs",["24"],"no-eval","eval can be harmful.","CallExpression","unexpected","no-global-assign","no-unsafe-negation"]