feat: use eslint with prettier to format code

This commit is contained in:
Valeriy
2019-02-19 01:59:12 +03:00
committed by mrugesh mohapatra
parent be36915605
commit fc8c71ad16
70 changed files with 254 additions and 236 deletions
+22 -22
View File
@@ -43,7 +43,7 @@ async function translateChallenge(file) {
translateText(instructions),
...tests.map(
test =>
new Promise(async(resolve, reject) => {
new Promise(async (resolve, reject) => {
const { testString, text } = test;
const translatedText = await translateText(text).catch(reject);
return resolve({
@@ -58,11 +58,11 @@ async function translateChallenge(file) {
const { files = {}, solutions = [], ...challengeMeta } = challenge;
const md = `---
${YAML.dump(
Object.assign(challengeMeta, {
localeTitle: title ? title.join(' ').trim() : ''
}),
{ lineWidth: 10000 }
)}---
Object.assign(challengeMeta, {
localeTitle: title ? title.join(' ').trim() : ''
}),
{ lineWidth: 10000 }
)}---
## Description
${description}
@@ -88,20 +88,20 @@ ${generateChallengeSeed(files)}
<section id='solution'>
${
solutions.length === 0
? `\`\`\`js
solutions.length === 0
? `\`\`\`js
// solution required
\`\`\``
: solutions
.map(
solution => `
: solutions
.map(
solution => `
\`\`\`js
${solution}
\`\`\`
`
)
.join('\n')
}
)
.join('\n')
}
</section>
`;
@@ -126,8 +126,8 @@ ${contents}
</div>
${
head.length
? `
head.length
? `
### Before Test
<div id='${ext}-setup'>
@@ -136,11 +136,11 @@ ${head}
\`\`\`
</div>`
: ''
}
: ''
}
${
tail.length
? `
tail.length
? `
### After Test
<div id='${ext}-teardown'>
@@ -149,8 +149,8 @@ console.info('after the test');
\`\`\`
</div>`
: ''
}
: ''
}
`;
});
}
+3 -3
View File
@@ -289,7 +289,7 @@ async function createTestRunnerForDOMChallenge(
await context.reload();
await context.setContent(build);
await context.evaluate(
async(sources, loadEnzyme) => {
async (sources, loadEnzyme) => {
const code = sources && 'index' in sources ? sources['index'] : '';
const getUserInput = fileName => sources[fileName];
await document.__initTestFrame({ code, getUserInput, loadEnzyme });
@@ -298,7 +298,7 @@ async function createTestRunnerForDOMChallenge(
loadEnzyme
);
return async({ text, testString }) => {
return async ({ text, testString }) => {
try {
const { pass, err } = await Promise.race([
new Promise((_, reject) => setTimeout(() => reject('timeout'), 5000)),
@@ -327,7 +327,7 @@ async function createTestRunnerForJSChallenge({ files }, solution) {
const code = sources && 'index' in sources ? sources['index'] : '';
const testWorker = createWorker('test-evaluator');
return async({ text, testString }) => {
return async ({ text, testString }) => {
try {
const { pass, err } = await testWorker.execute(
{ testString, build, code, sources },