Fix linting issues

This commit is contained in:
danielyxie 2018-09-27 23:40:40 -05:00
parent 065ce4d4df
commit f38aba0130
3 changed files with 15 additions and 10 deletions

@ -59,6 +59,7 @@ export class CodingContractType {
export const CodingContractTypes: IMap<CodingContractType> = {};
for (const md of codingContractTypesMetadata) {
// tslint:disable-next-line
CodingContractTypes[md.name] = new CodingContractType(md.name, md.desc, md.gen, md.solver, md.difficulty, md.numTries);
}
console.info(`${Object.keys(CodingContractTypes).length} Coding Contract Types loaded`);
@ -171,8 +172,10 @@ export class CodingContract {
"after which the contract will self-destruct.\n\n",
`${contractType.desc(this.data)}`].join(" "),
});
const answerInput: HTMLInputElement = createElement("input", {
onkeydown:(e)=>{
let answerInput: HTMLInputElement;
let solveBtn: HTMLElement;
answerInput = createElement("input", {
onkeydown: (e: any) => {
if (e.keyCode === 13 && answerInput.value !== "") {
e.preventDefault();
solveBtn.click();
@ -180,7 +183,7 @@ export class CodingContract {
},
placeholder: "Enter Solution here",
}) as HTMLInputElement;
const solveBtn: HTMLElement = createElement("a", {
solveBtn = createElement("a", {
class: "a-link-button",
clickListener: () => {
const answer: string = answerInput.value;

@ -31,16 +31,15 @@ function removeBracketsFromArrayString(str: string) {
}
function convert2DArrayToString(arr: any[][]) {
let res = "";
const components: string[] = [];
arr.forEach((e) => {
let s = e.toString();
arr.forEach((e: any) => {
let s: string = e.toString();
s = ["[", s, "]"].join("");
components.push(s);
});
res = components.join(",");
return res.replace(/\s/g, "");
return components.join(",")
.replace(/\s/g, "");
}
export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
@ -211,7 +210,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
if (++l > r) { break; }
}
const sanitizedPlayerAns: string = removeBracketsFromArrayString(ans).replace(/\s/g, "");
const sanitizedPlayerAns: string = removeBracketsFromArrayString(ans)
.replace(/\s/g, "");
const playerAns: any[] = sanitizedPlayerAns.split(",");
for (let i: number = 0; i < playerAns.length; ++i) {
playerAns[i] = parseInt(playerAns[i], 10);
@ -362,7 +362,8 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [
}
}
let sanitizedAns: string = removeBracketsFromArrayString(ans).replace(/\s/g, "");
const sanitizedAns: string = removeBracketsFromArrayString(ans)
.replace(/\s/g, "");
const ansArr: string[] = sanitizedAns.split(",");
if (ansArr.length !== ret.length) { return false; }
for (const ipInAns of ansArr) {

@ -277,6 +277,7 @@ module.exports = {
"active",
"after",
"before",
"disabled",
"focus",
"hover",
"link",