Skip to content

Commit 5f7d84d

Browse files
committed
executed npx eslint . --fix
1 parent d465cfe commit 5f7d84d

File tree

14 files changed

+119
-119
lines changed

14 files changed

+119
-119
lines changed

bin/brain-calc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
22

3-
import startCalcGame from '../src/games/calc.js'
3+
import startCalcGame from '../src/games/calc.js';
44

5-
startCalcGame()
5+
startCalcGame();

bin/brain-even.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
22

3-
import runBrainEven from '../src/games/even.js'
3+
import runBrainEven from '../src/games/even.js';
44

5-
runBrainEven()
5+
runBrainEven();

bin/brain-games.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
22

3-
import runBrainGames from '../src/cli.js'
3+
import runBrainGames from '../src/cli.js';
44

5-
runBrainGames()
5+
runBrainGames();

bin/brain-gcd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
22

3-
import playGcd from '../src/games/gcd.js'
3+
import playGcd from '../src/games/gcd.js';
44

5-
playGcd()
5+
playGcd();

bin/brain-prime.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env node
2-
import runPrimeGame from '../src/games/prime.js'
2+
import runPrimeGame from '../src/games/prime.js';
33

4-
runPrimeGame()
4+
runPrimeGame();

bin/brain-progression.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env node
2-
import runProgressionGame from '../src/games/progression.js'
2+
import runProgressionGame from '../src/games/progression.js';
33

4-
runProgressionGame()
4+
runProgressionGame();

src/cli.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import readlineSync from 'readline-sync'
1+
import readlineSync from 'readline-sync';
22

33
export default function runBrainGames() {
4-
console.log('Welcome to the Brain Games!')
5-
const name = readlineSync.question('May I have your name? ')
6-
console.log(`Hello, ${name}!`)
4+
console.log('Welcome to the Brain Games!');
5+
const name = readlineSync.question('May I have your name? ');
6+
console.log(`Hello, ${name}!`);
77
}

src/games/calc.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
import runEngine from '../index.js'
2-
import getRandomNumber from '../utils.js'
1+
import runEngine from '../index.js';
2+
import getRandomNumber from '../utils.js';
33

4-
const rule = 'What is the result of the expression?'
4+
const rule = 'What is the result of the expression?';
55

66
const getCalculation = () => {
7-
const a = getRandomNumber(1, 50)
8-
const b = getRandomNumber(1, 50)
9-
const operators = ['+', '-', '*']
10-
const op = operators[getRandomNumber(0, operators.length - 1)]
7+
const a = getRandomNumber(1, 50);
8+
const b = getRandomNumber(1, 50);
9+
const operators = ['+', '-', '*'];
10+
const op = operators[getRandomNumber(0, operators.length - 1)];
1111

12-
let correctAnswer
12+
let correctAnswer;
1313
switch (op) {
14-
case '+':
15-
correctAnswer = a + b
16-
break
17-
case '-':
18-
correctAnswer = a - b
19-
break
20-
case '*':
21-
correctAnswer = a * b
22-
break
14+
case '+':
15+
correctAnswer = a + b;
16+
break;
17+
case '-':
18+
correctAnswer = a - b;
19+
break;
20+
case '*':
21+
correctAnswer = a * b;
22+
break;
2323
}
2424

25-
return [`${a} ${op} ${b}`, String(correctAnswer)]
26-
}
25+
return [`${a} ${op} ${b}`, String(correctAnswer)];
26+
};
2727

28-
const startCalcGame = () => runEngine(rule, getCalculation)
28+
const startCalcGame = () => runEngine(rule, getCalculation);
2929

30-
export default startCalcGame
30+
export default startCalcGame;

src/games/even.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import runEngine from '../index.js'
2-
import getRandomNumber from '../utils.js'
1+
import runEngine from '../index.js';
2+
import getRandomNumber from '../utils.js';
33

4-
const rule = 'Answer "yes" if the number is even, otherwise answer "no".'
4+
const rule = 'Answer "yes" if the number is even, otherwise answer "no".';
55

66
const isEven = (num) => {
7-
return num % 2 === 0
8-
}
7+
return num % 2 === 0;
8+
};
99

1010
const getQuestionAndAnswer = () => {
11-
const question = getRandomNumber(1, 100)
12-
const correctAnswer = isEven(question) ? 'yes' : 'no'
13-
return [question, correctAnswer]
14-
}
11+
const question = getRandomNumber(1, 100);
12+
const correctAnswer = isEven(question) ? 'yes' : 'no';
13+
return [question, correctAnswer];
14+
};
1515

16-
const startEvenGame = () => runEngine(rule, getQuestionAndAnswer)
16+
const startEvenGame = () => runEngine(rule, getQuestionAndAnswer);
1717

18-
export default startEvenGame
18+
export default startEvenGame;

src/games/gcd.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
import runEngine from '../index.js'
2-
import getRandomNumber from '../utils.js'
1+
import runEngine from '../index.js';
2+
import getRandomNumber from '../utils.js';
33

4-
const rule = 'Find the greatest common divisor of given numbers.'
4+
const rule = 'Find the greatest common divisor of given numbers.';
55

66
const getGcd = (x, y) => {
7-
let a = x
8-
let b = y
7+
let a = x;
8+
let b = y;
99

10-
if (b === 0) return a
10+
if (b === 0) return a;
1111

1212
while (b !== 0) {
13-
const temp = b
14-
b = a % b
15-
a = temp
13+
const temp = b;
14+
b = a % b;
15+
a = temp;
1616
}
17-
return a
18-
}
17+
return a;
18+
};
1919

2020
const makeRound = () => {
21-
const x = getRandomNumber(1, 100)
22-
const y = getRandomNumber(1, 100)
21+
const x = getRandomNumber(1, 100);
22+
const y = getRandomNumber(1, 100);
2323

24-
const question = `${x} ${y}`
25-
const answer = String(getGcd(x, y))
26-
return [question, answer]
27-
}
24+
const question = `${x} ${y}`;
25+
const answer = String(getGcd(x, y));
26+
return [question, answer];
27+
};
2828

2929
export default function playGcd() {
3030
runEngine(rule, makeRound);

0 commit comments

Comments
 (0)