-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 7.64 KB
/
.eslintcache
1
[{"C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\index.js":"1","C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\reportWebVitals.js":"2","C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\main\\Calculator.jsx":"3","C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\components\\Button.jsx":"4","C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\components\\Display.jsx":"5"},{"size":551,"mtime":1609617839146,"results":"6","hashOfConfig":"7"},{"size":362,"mtime":499162500000,"results":"8","hashOfConfig":"7"},{"size":3969,"mtime":1609638407237,"results":"9","hashOfConfig":"7"},{"size":368,"mtime":1609621342504,"results":"10","hashOfConfig":"7"},{"size":157,"mtime":1609619283003,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"14"},"upqham",{"filePath":"15","messages":"16","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"14"},{"filePath":"17","messages":"18","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"19","usedDeprecatedRules":"14"},{"filePath":"20","messages":"21","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"22","usedDeprecatedRules":"14"},{"filePath":"23","messages":"24","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"25","usedDeprecatedRules":"26"},"C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\index.js",[],["27","28"],"C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\reportWebVitals.js",[],"C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\main\\Calculator.jsx",["29"],"import React, { Component } from 'react'\r\nimport './Calculator.css'\r\n\r\nimport Button from '../components/Button'\r\nimport Display from '../components/Display'\r\n\r\nconst initialState = {\r\n displayValue: '0',\r\n clearDisplay: false,\r\n operation: null,\r\n values: [0, 0],\r\n current: 0 //Controla qual indice do array está sendo manipulado \r\n}\r\n\r\nexport default class Calculator extends Component {\r\n\r\n state = {...initialState}\r\n\r\n constructor(props){\r\n super(props)\r\n this.clearMemory = this.clearMemory.bind(this)\r\n this.setOperation = this.setOperation.bind(this)\r\n this.addDigit = this.addDigit.bind(this)\r\n }\r\n\r\n clearMemory(){\r\n this.setState({ ...initialState })\r\n }\r\n\r\n setOperation(operation){ \r\n if(this.state.current === 0){\r\n this.setState({\r\n current: 1,\r\n operation,\r\n clearDisplay: true\r\n })\r\n }else{\r\n const equls = operation === '='\r\n let currentOperation = this.state.operation\r\n const values = { ...this.state.values }\r\n \r\n if(currentOperation === '÷'){\r\n currentOperation = '/'\r\n }\r\n \r\n if(currentOperation === 'x'){\r\n currentOperation = '*'\r\n }\r\n\r\n try{\r\n values[0] = eval(`${values[0]} ${currentOperation} ${values[1]}`)\r\n }catch{\r\n values[0] = this.state.values[0]\r\n }\r\n\r\n values[1] = 0\r\n\r\n this.setState({\r\n displayValue: values[0],\r\n operation: equls ? null : operation,\r\n current: equls ? 0 : 1,\r\n clearDisplay: !equls,\r\n values\r\n })\r\n }\r\n }\r\n\r\n addDigit(n){\r\n if( n === '.' && this.state.displayValue.includes('.'))\r\n return\r\n\r\n const clearDisplay = this.state.displayValue === '0' || this.state.clearDisplay\r\n const currentValue = clearDisplay ? '' : this.state.displayValue\r\n const displayValue = currentValue + n\r\n this.setState({\r\n displayValue,\r\n clearDisplay: false\r\n })\r\n\r\n if(n !== '.'){\r\n const i = this.state.current\r\n const newValue = parseFloat(displayValue)\r\n const values = {...this.state.values}\r\n values[i] = newValue\r\n this.setState({ values })\r\n console.log(values)\r\n \r\n }\r\n }\r\n\r\n render(){\r\n return(\r\n <div className='calculator'>\r\n <Display value={this.state.displayValue}/>\r\n <Button label='AC' duble='duble' click={this.clearMemory}/>\r\n <Button label='%' click={this.setOperation}/>\r\n <Button label='÷' operation='operation' click={this.setOperation}/>\r\n <Button label='7' click={this.addDigit}/>\r\n <Button label='8' click={this.addDigit}/>\r\n <Button label='9' click={this.addDigit}/>\r\n <Button label='x' operation='operation' click={this.setOperation}/>\r\n <Button label='4' click={this.addDigit}/>\r\n <Button label='5' click={this.addDigit}/>\r\n <Button label='6' click={this.addDigit}/>\r\n <Button label='-' operation='operation' click={this.setOperation}/>\r\n <Button label='1' click={this.addDigit}/>\r\n <Button label='2' click={this.addDigit}/>\r\n <Button label='3' click={this.addDigit}/>\r\n <Button label='+' operation='operation' click={this.setOperation}/>\r\n <Button label='0' duble='duble' click={this.addDigit}/>\r\n <Button label='.' click={this.addDigit}/>\r\n <Button label='=' operation='operation' click={this.setOperation}/>\r\n \r\n </div>\r\n )\r\n }\r\n}","C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\components\\Button.jsx",["30"],"import React from 'react'\r\nimport './Button.css'\r\n\r\nexport default props =>{\r\n let classes = 'button '\r\n classes += props.operation ? 'operation' : ''\r\n classes += props.duble ? 'duble': ''\r\n \r\n return(\r\n <button className={classes} onClick={el => props.click && props.click(props.label)} >\r\n {props.label}\r\n </button>\r\n )\r\n}","C:\\Users\\uqsds\\Documents\\Ulisses\\AULAS\\Udemy_React\\curso-react\\calculadora\\src\\components\\Display.jsx",["31"],"import React from 'react'\r\nimport './Display.css'\r\n\r\nexport default props => {\r\n\r\n return(\r\n <div className=\"display\">{props.value}</div>\r\n )\r\n}",["32","33"],{"ruleId":"34","replacedBy":"35"},{"ruleId":"36","replacedBy":"37"},{"ruleId":"38","severity":1,"message":"39","line":51,"column":29,"nodeType":"40","messageId":"41","endLine":51,"endColumn":33},{"ruleId":"42","severity":1,"message":"43","line":4,"column":1,"nodeType":"44","endLine":14,"endColumn":2},{"ruleId":"42","severity":1,"message":"43","line":4,"column":1,"nodeType":"44","endLine":9,"endColumn":2},{"ruleId":"34","replacedBy":"45"},{"ruleId":"36","replacedBy":"46"},"no-native-reassign",["47"],"no-negated-in-lhs",["48"],"no-eval","eval can be harmful.","CallExpression","unexpected","import/no-anonymous-default-export","Assign arrow function to a variable before exporting as module default","ExportDefaultDeclaration",["47"],["48"],"no-global-assign","no-unsafe-negation"]