-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 8.69 KB
/
.eslintcache
1
[{"/home/monish/code/word-search/src/index.js":"1","/home/monish/code/word-search/src/App.js":"2","/home/monish/code/word-search/src/components/Parent.js":"3","/home/monish/code/word-search/src/components/WordBank.js":"4","/home/monish/code/word-search/src/components/Output.js":"5","/home/monish/code/word-search/src/components/SelectGridSize.js":"6","/home/monish/code/word-search/src/algo.js":"7","/home/monish/code/word-search/src/components/WordGrid.js":"8"},{"size":220,"mtime":1611370227515,"results":"9","hashOfConfig":"10"},{"size":206,"mtime":1612016773372,"results":"11","hashOfConfig":"10"},{"size":2457,"mtime":1612016773372,"results":"12","hashOfConfig":"10"},{"size":679,"mtime":1612016773372,"results":"13","hashOfConfig":"10"},{"size":985,"mtime":1612016773372,"results":"14","hashOfConfig":"10"},{"size":734,"mtime":1612016773372,"results":"15","hashOfConfig":"10"},{"size":1487,"mtime":1612016773372,"results":"16","hashOfConfig":"10"},{"size":708,"mtime":1612016773372,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},"9cexsw",{"filePath":"21","messages":"22","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"23","messages":"24","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":"25","usedDeprecatedRules":"20"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"30","usedDeprecatedRules":"20"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},{"filePath":"33","messages":"34","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"35","usedDeprecatedRules":"20"},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"20"},"/home/monish/code/word-search/src/index.js",[],["38","39"],"/home/monish/code/word-search/src/App.js",[],"/home/monish/code/word-search/src/components/Parent.js",["40"],"import React, {Component} from 'react'\nimport SelectGridSize from './SelectGridSize';\nimport WordBank from './WordBank';\nimport WordGrid from './WordGrid';\nimport Output from './Output';\nimport algo from '../algo';\n\nexport class Parent extends Component {\n state = {\n step: 1,\n gridSize: 3,\n wordBank: 'cat dog cod',\n wordGrid: 'catdogead',\n wordCoordinates: [],\n };\n\n // Proceed to next step\n nextStep = () => {\n const {step} = this.state;\n this.setState({\n step: step + 1\n });\n };\n\n // Go back to prev step\n prevStep = () => {\n const {step} = this.state;\n this.setState({\n step: step - 1\n });\n };\n\n startSearch = () => {\n const {step} = this.state;\n this.setState({\n step: step + 1\n });\n\n let wordGridTemp = this.state.wordGrid.replace(/[\\r\\n]+/gm, '');\n let wordGridFinal = [];\n let wordBankFinal = this.state.wordBank.split(' ');\n let wordCoordinates = [];\n\n for (let i = 0; i < this.state.gridSize; i++) {\n wordGridFinal.push([wordGridTemp.substring(i * this.state.gridSize, i * this.state.gridSize + this.state.gridSize)]);\n }\n\n const wordSearchInit = new algo(wordGridFinal, wordBankFinal);\n\n for (let j = 0; j < wordBankFinal.length; j++) {\n wordCoordinates = wordSearchInit.patternSearch(wordBankFinal[j]);\n }\n this.setState({wordGrid: wordGridFinal});\n this.setState({wordCoordinates: wordCoordinates});\n };\n\n // Handle fields change\n handleTextChange = input => e => {\n this.setState({[input]: e.target.value});\n };\n\n // Handle selection change\n handleSelectChange = input => e => {\n this.setState({[input]: e.value});\n };\n\n render() {\n const {step, wordGrid, wordCoordinates, gridSize} = this.state;\n\n switch (step) {\n case 1:\n return (\n <SelectGridSize nextStep={this.nextStep} handleChange={this.handleSelectChange} />\n );\n case 2:\n return (\n <WordBank nextStep={this.nextStep} prevStep={this.prevStep} handleChange={this.handleTextChange} />\n );\n case 3:\n return (\n <WordGrid nextStep={this.startSearch} prevStep={this.prevStep} handleChange={this.handleTextChange} gridSize={this.gridSize} />\n );\n case 4:\n return (\n <Output prevStep={this.prevStep} wordGrid={wordGrid} wordCoordinates={wordCoordinates} />\n );\n\n default:\n (console.log('step error'));\n }\n }\n}\n\nexport default Parent;\n","/home/monish/code/word-search/src/components/WordBank.js",[],"/home/monish/code/word-search/src/components/Output.js",["41","42"],"import React, {Component} from 'react'\nimport '../style.css';\n\nexport default class Output extends Component {\n\n back = e => {\n e.preventDefault();\n this.props.prevStep();\n };\n\n checkCoords = (x, y, wordCoordinates) => {\n let id = \"inactive\";\n const coords = [x, y];\n for (var i = 0; i < Object.keys(wordCoordinates).length; i++) {\n if (wordCoordinates[i][0] == coords[0] && wordCoordinates[i][1] == coords[1]) {\n id = \"active\";\n }\n }\n return id;\n }\n\n render() {\n return (\n <>\n <div>\n {this.props.wordGrid.map((row, x) => (\n <div id=\"flexcon\">\n {row[0].split(\"\").map((col, y) => (\n <div>\n <span id={this.checkCoords(x, y, this.props.wordCoordinates)} >{col}</span>\n </div>\n ))}\n </div>\n ))}\n </div>\n <button className='btn' onClick={this.back}>\n back\n </button>\n\n </>\n );\n }\n}\n","/home/monish/code/word-search/src/components/SelectGridSize.js",[],"/home/monish/code/word-search/src/algo.js",["43","44","45"],"export default class WordSearch {\n constructor(grid, wordBank) {\n this.grid = grid;\n this.wordBank = wordBank;\n this.rows = grid.length\n this.cols = grid[0][0].length\n this.directions = [\n [-1, 0],\n [1, 0],\n [1, 1],\n [1, -1],\n [-1, -1],\n [-1, 1],\n [0, 1],\n [0, -1]\n ]\n this.wordCoordinates = [];\n }\n patternSearch(word) {\n for (let i = 0; i < this.rows; i++) {\n for (let j = 0; j < this.cols; j++) {\n this.search2D(i, j, word)\n }\n }\n return this.wordCoordinates;\n }\n\n search2D(row, col, word) {\n if (this.grid[row][0][col] != word[0]) {\n return false;\n }\n\n for (let i = 0; i < this.directions.length; i++) {\n let rd = row + this.directions[i][0];\n let cd = col + this.directions[i][1];\n let k;\n let temp = [[row, col],];\n for (k = 1; k < word.length; k++) {\n if (rd >= this.rows || rd < 0 || cd >= this.cols || cd < 0) {\n break; // out of bounds -> reset\n }\n if (this.grid[rd][0][cd] != word[k]) {\n break; // letter not matched in word -> reset\n }\n temp.push([rd, cd]); // add coordinate of letter\n rd += this.directions[i][0];\n cd += this.directions[i][1];\n }\n if (k == word.length) { // if all characters matched, value of k must equal length of word\n this.wordCoordinates = this.wordCoordinates.concat(temp);\n return true;\n }\n }\n return false;\n }\n\n}\n","/home/monish/code/word-search/src/components/WordGrid.js",[],{"ruleId":"46","replacedBy":"47"},{"ruleId":"48","replacedBy":"49"},{"ruleId":"50","severity":1,"message":"51","line":68,"column":45,"nodeType":"52","messageId":"53","endLine":68,"endColumn":53},{"ruleId":"54","severity":1,"message":"55","line":15,"column":33,"nodeType":"56","messageId":"57","endLine":15,"endColumn":35},{"ruleId":"54","severity":1,"message":"55","line":15,"column":71,"nodeType":"56","messageId":"57","endLine":15,"endColumn":73},{"ruleId":"54","severity":1,"message":"58","line":29,"column":32,"nodeType":"56","messageId":"57","endLine":29,"endColumn":34},{"ruleId":"54","severity":1,"message":"58","line":42,"column":34,"nodeType":"56","messageId":"57","endLine":42,"endColumn":36},{"ruleId":"54","severity":1,"message":"55","line":49,"column":13,"nodeType":"56","messageId":"57","endLine":49,"endColumn":15},"no-native-reassign",["59"],"no-negated-in-lhs",["60"],"no-unused-vars","'gridSize' is assigned a value but never used.","Identifier","unusedVar","eqeqeq","Expected '===' and instead saw '=='.","BinaryExpression","unexpected","Expected '!==' and instead saw '!='.","no-global-assign","no-unsafe-negation"]