Fix linting issues

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

@ -59,6 +59,7 @@ export class CodingContractType {
export const CodingContractTypes: IMap<CodingContractType> = {}; export const CodingContractTypes: IMap<CodingContractType> = {};
for (const md of codingContractTypesMetadata) { 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); 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`); 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", "after which the contract will self-destruct.\n\n",
`${contractType.desc(this.data)}`].join(" "), `${contractType.desc(this.data)}`].join(" "),
}); });
const answerInput: HTMLInputElement = createElement("input", { let answerInput: HTMLInputElement;
onkeydown:(e)=>{ let solveBtn: HTMLElement;
answerInput = createElement("input", {
onkeydown: (e: any) => {
if (e.keyCode === 13 && answerInput.value !== "") { if (e.keyCode === 13 && answerInput.value !== "") {
e.preventDefault(); e.preventDefault();
solveBtn.click(); solveBtn.click();
@ -180,7 +183,7 @@ export class CodingContract {
}, },
placeholder: "Enter Solution here", placeholder: "Enter Solution here",
}) as HTMLInputElement; }) as HTMLInputElement;
const solveBtn: HTMLElement = createElement("a", { solveBtn = createElement("a", {
class: "a-link-button", class: "a-link-button",
clickListener: () => { clickListener: () => {
const answer: string = answerInput.value; const answer: string = answerInput.value;

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

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