fix no-case-declarations

pull/8592/head
Niklas Fiekas 2021-04-07 16:23:33 +02:00
parent 6263140b99
commit 65c66b7093
5 changed files with 15 additions and 10 deletions

View File

@ -16,9 +16,11 @@
], ],
"rules": { "rules": {
"linebreak-style": ["error", "unix"], "linebreak-style": ["error", "unix"],
"no-duplicate-imports": ["error"], "no-duplicate-imports": "error",
"no-var": "off",
"eqeqeq": "off",
"prefer-const": "off", "prefer-const": "off",
"no-var": "off",
"@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
@ -32,7 +34,6 @@
"no-empty": "off", "no-empty": "off",
"@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-empty-function": "off",
"no-self-assign": "off", "no-self-assign": "off",
"no-case-declarations": "off",
"no-constant-condition": "off", "no-constant-condition": "off",
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"no-extra-boolean-cast": "off", "no-extra-boolean-cast": "off",

View File

@ -84,11 +84,12 @@ export default class GamebookPlayCtrl {
case 'bad': case 'bad':
this.retry(); this.retry();
break; break;
case 'end': case 'end': {
const s = this.root.study!, const s = this.root.study!,
c = s.nextChapter(); c = s.nextChapter();
if (c) s.setChapter(c.id); if (c) s.setChapter(c.id);
break; break;
}
default: default:
this.next(); this.next();
} }

View File

@ -49,12 +49,13 @@ export default function (root: AnalyseCtrl, goal: Goal, nbMoves: number): boolea
case 'evalIn': case 'evalIn':
if (nbMoves >= goal.moves!) return isWinning(node, goal.cp!, root.bottomColor()); if (nbMoves >= goal.moves!) return isWinning(node, goal.cp!, root.bottomColor());
break; break;
case 'mateIn': case 'mateIn': {
if (nbMoves > goal.moves!) return false; if (nbMoves > goal.moves!) return false;
const mateIn = myMateIn(node, root.bottomColor()); const mateIn = myMateIn(node, root.bottomColor());
if (mateIn === null) return null; if (mateIn === null) return null;
if (!mateIn || (mateIn as number) + nbMoves > goal.moves!) return false; if (!mateIn || (mateIn as number) + nbMoves > goal.moves!) return false;
break; break;
}
case 'promotion': case 'promotion':
if (!node.uci[4]) return null; if (!node.uci[4]) return null;
return isWinning(node, goal.cp!, root.bottomColor()); return isWinning(node, goal.cp!, root.bottomColor());

View File

@ -65,11 +65,10 @@ export function underboard(ctrl: StudyCtrl): MaybeVNodes {
else if (!ctrl.data.chapter.practice) return [descView(ctrl, true)]; else if (!ctrl.data.chapter.practice) return [descView(ctrl, true)];
switch (p.success()) { switch (p.success()) {
case true: case true:
const next = ctrl.nextChapter();
return [ return [
h( h(
'a.feedback.win', 'a.feedback.win',
next ctrl.nextChapter()
? { ? {
hook: bind('click', p.goToNext), hook: bind('click', p.goToNext),
} }

View File

@ -25,7 +25,7 @@ export default function (ctrl: RacerCtrl): VNode {
const selectScreen = (ctrl: RacerCtrl): MaybeVNodes => { const selectScreen = (ctrl: RacerCtrl): MaybeVNodes => {
const noarg = ctrl.trans.noarg; const noarg = ctrl.trans.noarg;
switch (ctrl.status()) { switch (ctrl.status()) {
case 'pre': case 'pre': {
const povMsg = h('p.racer__pre__message__pov', ctrl.trans(povMessage(ctrl.run))); const povMsg = h('p.racer__pre__message__pov', ctrl.trans(povMessage(ctrl.run)));
return ctrl.race.lobby return ctrl.race.lobby
? [ ? [
@ -50,7 +50,8 @@ const selectScreen = (ctrl: RacerCtrl): MaybeVNodes => {
]), ]),
comboZone(ctrl), comboZone(ctrl),
]; ];
case 'racing': }
case 'racing': {
const clock = renderClock(ctrl.run, ctrl.end, false); const clock = renderClock(ctrl.run, ctrl.end, false);
return ctrl.isPlayer() return ctrl.isPlayer()
? [playerScore(ctrl), h('div.puz-clock', [clock, renderSkip(ctrl)]), comboZone(ctrl)] ? [playerScore(ctrl), h('div.puz-clock', [clock, renderSkip(ctrl)]), comboZone(ctrl)]
@ -62,12 +63,14 @@ const selectScreen = (ctrl: RacerCtrl): MaybeVNodes => {
]), ]),
comboZone(ctrl), comboZone(ctrl),
]; ];
case 'post': }
case 'post': {
const nextRace = ctrl.race.lobby ? lobbyNext(ctrl) : friendNext(ctrl); const nextRace = ctrl.race.lobby ? lobbyNext(ctrl) : friendNext(ctrl);
const raceComplete = h('h2', noarg('raceComplete')); const raceComplete = h('h2', noarg('raceComplete'));
return ctrl.isPlayer() return ctrl.isPlayer()
? [playerScore(ctrl), h('div.racer__post', [raceComplete, yourRank(ctrl), nextRace]), comboZone(ctrl)] ? [playerScore(ctrl), h('div.racer__post', [raceComplete, yourRank(ctrl), nextRace]), comboZone(ctrl)]
: [spectating(noarg), h('div.racer__post', [raceComplete, nextRace]), comboZone(ctrl)]; : [spectating(noarg), h('div.racer__post', [raceComplete, nextRace]), comboZone(ctrl)];
}
} }
}; };