diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..3d86fcb --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,28 @@ +{ + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "rules": { + "indent": ["error", 4], + "linebreak-style": ["error", "unix"], + "quotes": ["error", "single", { "avoidEscape": true }], + "semi": ["error", "always"], + "no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }], + "no-console": "off", + "no-debugger": "warn" + }, + "ignorePatterns": [ + "node_modules/", + "coverage/", + "dist/", + "build/", + "*.min.js" + ] +} diff --git a/js/engine/MoveValidator.js b/js/engine/MoveValidator.js index 754124e..6dd348c 100644 --- a/js/engine/MoveValidator.js +++ b/js/engine/MoveValidator.js @@ -226,8 +226,8 @@ export class MoveValidator { // King can't pass through check for (let col = king.position.col + direction; - col !== targetCol + direction; - col += direction) { + col !== targetCol + direction; + col += direction) { const simulatedBoard = board.clone(); simulatedBoard.movePiece(king.position.row, king.position.col, row, col); diff --git a/js/engine/SpecialMoves.js b/js/engine/SpecialMoves.js index 7852317..a0b50b7 100644 --- a/js/engine/SpecialMoves.js +++ b/js/engine/SpecialMoves.js @@ -155,20 +155,20 @@ export class SpecialMoves { let newPiece; switch (pieceType) { - case 'queen': - newPiece = new Queen(color, { row, col }); - break; - case 'rook': - newPiece = new Rook(color, { row, col }); - break; - case 'bishop': - newPiece = new Bishop(color, { row, col }); - break; - case 'knight': - newPiece = new Knight(color, { row, col }); - break; - default: - newPiece = new Queen(color, { row, col }); + case 'queen': + newPiece = new Queen(color, { row, col }); + break; + case 'rook': + newPiece = new Rook(color, { row, col }); + break; + case 'bishop': + newPiece = new Bishop(color, { row, col }); + break; + case 'knight': + newPiece = new Knight(color, { row, col }); + break; + default: + newPiece = new Queen(color, { row, col }); } board.setPiece(row, col, newPiece);