diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index bd62bb2..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,209 +0,0 @@ -module.exports = { - root: true, - env: { - es2021: true, - node: true, - }, - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - ecmaFeatures: { - impliedStrict: true - } - }, - extends: ['eslint:recommended'], - rules: { - - // ERRORS - 'for-direction': 'error', - 'getter-return': 'error', - 'no-await-in-loop': 'error', - 'no-extra-parens': 'error', - 'no-prototype-builtins': 'error', - 'no-template-curly-in-string': 'error', - - // BEST PRACTICES - 'accessor-pairs': 'error', - 'array-callback-return': 'error', - 'class-methods-use-this': 'error', - 'complexity': ['error', 10], - 'consistent-return': 'error', - 'curly': 'error', - 'default-case': 'error', - 'dot-location': ['error', 'property'], - 'dot-notation': 'error', - 'eqeqeq': 'error', - 'guard-for-in': 'error', - 'no-alert': 'error', - 'no-caller': 'error', - 'no-div-regex': 'error', - 'no-else-return': 'error', - 'no-empty-function': 'error', - 'no-eq-null': 'error', - 'no-eval': 'error', - 'no-extend-native': 'error', - 'no-extra-bind': 'error', - 'no-extra-label': 'error', - 'no-floating-decimal': 'error', - 'no-implicit-coercion': 'error', - 'no-implicit-globals': 'error', - 'no-implied-eval': 'error', - 'no-iterator': 'error', - 'no-labels': 'error', - 'no-lone-blocks': 'error', - 'no-loop-func': 'error', - 'no-multi-spaces': 'error', - 'no-multi-str': 'error', - 'no-new': 'error', - 'no-new-func': 'error', - 'no-new-wrappers': 'error', - 'no-octal-escape': 'error', - 'no-param-reassign': 'error', - 'no-proto': 'error', - 'no-return-assign': 'error', - 'no-return-await': 'error', - 'no-script-url': 'error', - 'no-self-compare': 'error', - 'no-sequences': 'error', - 'no-throw-literal': 'error', - 'no-unmodified-loop-condition': 'error', - 'no-unused-expressions': 'error', - 'no-useless-call': 'error', - 'no-useless-concat': 'error', - 'no-useless-return': 'error', - 'no-void': 'error', - 'no-warning-comments': ['warn', { 'terms': ['fix', 'fixme', 'todo', 'to do', 'hack'], 'location': 'anywhere' }], - 'no-with': 'error', - 'prefer-promise-reject-errors': ['error', { 'allowEmptyReject': true }], - 'require-await': 'error', - 'vars-on-top': 'error', - 'wrap-iife': 'error', - 'yoda': 'error', - - // VARIABLES - 'no-shadow': 'error', - 'no-shadow-restricted-names': 'error', - 'no-undef-init': 'error', - 'no-undefined': 'error', - 'no-use-before-define': ['error', { 'functions': false }], - - // NODE - 'callback-return': 'error', - 'global-require': 'error', - 'handle-callback-err': 'error', - 'no-buffer-constructor': 'error', - 'no-mixed-requires': 'error', - 'no-new-require': 'error', - 'no-path-concat': 'error', - 'no-process-env': 'error', - 'no-process-exit': 'error', - - // STYLE - 'array-bracket-newline': ['error', { 'multiline': true }], - 'array-bracket-spacing': 'error', - 'block-spacing': 'error', - 'brace-style': ['error', 'stroustrup', { 'allowSingleLine': true }], - 'camelcase': 'error', - 'comma-spacing': 'error', - 'comma-style': 'error', - 'computed-property-spacing': 'error', - 'consistent-this': ['error', 'self'], - 'eol-last': 'error', - 'func-call-spacing': 'error', - 'func-name-matching': 'error', - 'func-names': ['error', 'never'], - 'func-style': ['error', 'declaration', { 'allowArrowFunctions': true }], - 'indent': ['error', 2, { 'SwitchCase': 1 }], - 'key-spacing': 'error', - 'keyword-spacing': 'error', - 'linebreak-style': 'error', - 'lines-around-comment': 'error', - 'max-depth': 'error', - 'max-lines': 'error', - 'max-nested-callbacks': ['error', 4], - 'max-params': ['error', 6], - 'max-statements': ['error', 99], - 'max-statements-per-line': ['error', { 'max': 2 }], - 'multiline-ternary': ['error', 'always-multiline'], - 'new-cap': 'error', - 'new-parens': 'error', - 'no-array-constructor': 'error', - 'no-bitwise': 'error', - 'no-continue': 'error', - 'no-lonely-if': 'error', - 'no-mixed-operators': 'error', - 'no-multi-assign': 'error', - 'no-multiple-empty-lines': ['error', { 'max': 1, 'maxEOF': 1, 'maxBOF': 0 }], - 'no-negated-condition': 'error', - 'no-nested-ternary': 'error', - 'no-new-object': 'error', - 'no-plusplus': ['error', { 'allowForLoopAfterthoughts': true }], - 'no-tabs': 'error', - 'no-trailing-spaces': 'error', - 'no-underscore-dangle': 'error', - 'no-unneeded-ternary': 'error', - 'no-whitespace-before-property': 'error', - 'object-curly-newline': ['error', { 'consistent': true }], - 'object-curly-spacing': ['error', 'always'], - 'object-property-newline': ['error', { 'allowMultiplePropertiesPerLine': true }], - 'one-var': ['error', { 'initialized': 'never', 'uninitialized': 'always' }], - 'operator-assignment': 'error', - 'operator-linebreak': ['error', 'after'], - 'padding-line-between-statements': [ - 'error', - { 'blankLine': 'always', 'prev': 'import', 'next': '*' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'never', 'prev': 'import', 'next': 'import' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': 'class', 'next': '*' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': '*', 'next': 'class' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': 'block', 'next': '*' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': '*', 'next': 'block' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': 'block-like', 'next': '*' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': '*', 'next': 'block-like' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': 'cjs-export', 'next': '*' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': '*', 'next': 'cjs-export' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': 'cjs-import', 'next': '*' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'never', 'prev': 'cjs-import', 'next': 'cjs-import' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': 'let', 'next': 'const' }, // eslint-disable-line no-multi-spaces - { 'blankLine': 'always', 'prev': 'const', 'next': 'let' }, // eslint-disable-line no-multi-spaces - ], - 'quotes': ['error', 'single', { 'allowTemplateLiterals': true }], - 'semi': 'error', - 'semi-spacing': 'error', - 'semi-style': 'error', - 'space-before-blocks': 'error', - 'space-before-function-paren': ['error', 'never'], - 'space-in-parens': 'error', - 'space-infix-ops': 'error', - 'space-unary-ops': 'error', - 'spaced-comment': ['error', 'always', { 'block': { 'balanced': true } }], - 'switch-colon-spacing': 'error', - 'template-tag-spacing': 'error', - 'unicode-bom': 'error', - 'wrap-regex': 'error', - - // ECMASCRIPT 6 - 'arrow-body-style': ['error', 'as-needed'], - 'arrow-parens': ['error', 'as-needed'], - 'arrow-spacing': 'error', - 'generator-star-spacing': 'error', - 'no-confusing-arrow': 'error', - 'no-duplicate-imports': 'error', - 'no-useless-computed-key': 'error', - 'no-useless-constructor': 'error', - 'no-useless-rename': 'error', - 'no-var': 'error', - 'object-shorthand': 'error', - 'prefer-arrow-callback': 'error', - 'prefer-const': 'error', - 'prefer-destructuring': 'error', - 'prefer-numeric-literals': 'error', - 'prefer-rest-params': 'error', - 'prefer-spread': 'error', - 'prefer-template': 'error', - 'rest-spread-spacing': 'error', - 'symbol-description': 'error', - 'template-curly-spacing': 'error', - 'yield-star-spacing': 'error', - - } -}; diff --git a/.github/workflows/yee.yml b/.github/workflows/yee.yml index 34a2234..ac72664 100644 --- a/.github/workflows/yee.yml +++ b/.github/workflows/yee.yml @@ -15,18 +15,17 @@ jobs: strategy: matrix: - node-version: [18.x, 20.x] + node-version: [18, 20, 22] # supported Node.js release schedule: https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' - cache-dependency-path: 'package.json' - - run: npm i + - run: npm ci - run: npm test diff --git a/.gitignore b/.gitignore index fab5d06..1669a13 100644 --- a/.gitignore +++ b/.gitignore @@ -104,4 +104,3 @@ dist .tern-port .DS_Store -package-lock.json diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 43c97e7..0000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false diff --git a/.vscode/settings.json b/.vscode/settings.json index 560a2ee..e36f697 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,6 @@ "**/package-lock.json": true }, "editor.codeActionsOnSave": { - "source.fixAll": true + "source.fixAll": "explicit" } } diff --git a/algorithms.js b/algorithms.js index bff7362..8281611 100644 --- a/algorithms.js +++ b/algorithms.js @@ -1,5 +1,3 @@ -/* eslint-disable guard-for-in */ - const Rando = require('./rando'); const shapes = [0, 1, 2, 3, 4, 5, 6]; @@ -7,23 +5,19 @@ const OLD_SHAPE_THRESHOLD = 21; // the number of turns a shape hasn't been seen const logStuff = false; function getOldestShape(shapeLastSeen) { - let oldestTurns = 0; let oldestShape; for (const s in shapeLastSeen) { - const turns = shapeLastSeen[s]; if (turns > oldestTurns) { oldestTurns = turns; oldestShape = s; } - } return oldestTurns >= OLD_SHAPE_THRESHOLD ? oldestShape : null; - } function log(t) { @@ -41,7 +35,6 @@ module.exports = { * - if the random shape is the same as the last shape, try to get a different shape */ *frustrationFree(seed) { - const rando = new Rando(seed); let lastShape; @@ -57,7 +50,6 @@ module.exports = { }; while (true) { - let shape; shape = rando.getRandomNumber(shapes.length); @@ -66,20 +58,16 @@ module.exports = { // if we have a shape that hasn't been seen in a while, try to get it if (oldestShape && oldestShape !== shape) { - log(`haven't seen shape ${oldestShape} in a while...`); // try up to three times to get the old shape for (let i = 0; i < 3; i++) { - shape = rando.getRandomNumber(shapes.length); if (shape === oldestShape) { break; } - } - } // if shape is same as the last one, try to get a different shape @@ -89,7 +77,6 @@ module.exports = { } for (const s in shapeLastSeen) { - if (parseInt(s) === shape) { shapeLastSeen[s] = 0; } @@ -103,9 +90,7 @@ module.exports = { log(`yielded shape ${shape}`); yield shape; - } - }, /** @@ -115,14 +100,12 @@ module.exports = { * - if the random shape is the same as the last shape, try up to 3x to get a different shape */ *easy(seed) { - const rando = new Rando(seed); let easyShapes = []; let lastShape; while (true) { - if (easyShapes.length === 0) { // create a collection of 3x the shapes list easyShapes = shapes.concat(shapes, shapes); @@ -133,21 +116,18 @@ module.exports = { // try up to three times to get a different shape than the previous shape for (let i = 0; i < 3; i++) { - shapeIndex = rando.getRandomNumber(easyShapes.length); shape = easyShapes[shapeIndex]; if (shape !== lastShape) { break; } - } easyShapes.splice(shapeIndex, 1); lastShape = shape; yield shape; - } }, @@ -158,14 +138,12 @@ module.exports = { * - if the random shape is the same as the last shape, try up to 3x to get a different shape */ *tooEasy(seed) { - const rando = new Rando(seed); let easyShapes = []; let lastShape; while (true) { - if (easyShapes.length === 0) { easyShapes = [...shapes]; shuffle(easyShapes, rando); @@ -175,32 +153,27 @@ module.exports = { // try up to three times to get a different shape than the previous shape for (let i = 0; i < 3; i++) { - shapeIndex = rando.getRandomNumber(easyShapes.length); shape = easyShapes[shapeIndex]; if (shape !== lastShape) { break; } - } easyShapes.splice(shapeIndex, 1); lastShape = shape; yield shape; - } }, *random(seed) { - const rando = new Rando(seed); while (true) { yield rando.getRandomNumber(shapes.length); } - - } + }, }; function shuffle(arr, rando) { diff --git a/board.js b/board.js index 8cfa9d7..d73a4c5 100644 --- a/board.js +++ b/board.js @@ -1,10 +1,8 @@ -/* eslint-disable max-lines */ const { shapes } = require('./shapes'); const Shape = require('./shape'); const directions = require('./directions'); module.exports = class Board { - currentShape; currentTimeout; occupiedPoints = []; @@ -17,7 +15,7 @@ module.exports = class Board { linesCleared = 0; gameOver = false; - constructor(top, right, bottom, left, screen, game, seed, isMainBoard) { // eslint-disable-line max-params + constructor(top, right, bottom, left, screen, game, seed, isMainBoard) { this.top = top; this.right = right; this.bottom = bottom; @@ -43,15 +41,12 @@ module.exports = class Board { this.startNewShape(); if (this.replay) { - const theMoves = [3, 0, 2, 2, 2, 0, 0, 0, 6, 0, 2, 0, 3, 3, 0, 6, 0, 1, 1, 0, 1, 0, 2, 3, 2, 2, 0, 6, 0, 0, 1, 3, 1, 0, 1, 1, 1, 1, 0, 6, 0, 1, 1, 0, 3, 3, 0, 3, 2, 2, 0, 2, 2, 0, 6, 0, 1, 0, 0, 3, 2, 0, 6, 0, 0, 1, 1, 0, 6, 0, 0, 3, 1, 0, 3, 3, 0, 3, 3, 0, 3, 0, 3, 1, 0, 6, 0, 0, 0, 3, 2, 0, 1, 6, 0, 0, 0, 0, 1, 0, 2, 0, 2, 3, 0, 1, 1, 0, 6, 0, 1, 0, 3, 1, 3, 3, 1, 0, 1, 1, 1, 6, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 6, 0, 1, 0, 3, 2, 0, 2, 0, 6, 0, 0, 1, 0, 0, 0, 2, 2, 0, 2, 2, 2, 0, 6, 0, 1, 0, 3, 1, 1, 0, 6, 0, 0, 1, 3, 0, 3, 3, 0, 1, 6, 0, 0, 0, 3, 0, 1, 0, 6, 0, 0, 0, 0, 3, 2, 0, 1, 1, 0, 1, 1, 1, 1, 0, 6, 0, 0, 0, 3, 3, 0, 2, 2, 2, 0, 1, 6, 0, 0, 3, 3, 0, 3, 0, 2, 2, 2, 0, 6, 0, 0, 3, 1, 1, 0, 3, 3, 0, 3, 3, 1, 0, 6, 0, 0, 0, 3, 1, 1, 1, 0, 1, 1, 1, 6, 0, 0, 3, 2, 0, 2, 2, 2, 2, 0, 6, 0, 0, 2, 2, 0, 6, 0, 0, 3, 1, 3, 0, 3, 1, 0, 6, 0, 0, 3, 0, 3, 2, 0, 2, 6, 0, 0, 2, 3, 2, 2, 0, 2, 2, 2, 0, 6, 0]; for (const direction of theMoves) { this.currentShape.move(direction); } - } - } topBorder = '┏━━━━━━━━━━━━━━━━━━━━┓'; @@ -60,7 +55,6 @@ module.exports = class Board { heldShapeBottomBorder = '┗━━━━━━━━━━┛'; drawBoard() { - this.screen.d(this.left, this.top, this.topBorder); for (let i = this.top + 1; i < this.bottom; i++) { @@ -72,11 +66,9 @@ module.exports = class Board { } this.drawBottomBorder(); - } drawNextBox() { - if (!this.isMainBoard) { return; } this.screen.d(this.nextBox.left, this.nextBox.top, this.heldShapeTopBorder); @@ -92,11 +84,9 @@ module.exports = class Board { } this.screen.d(this.nextBox.left, this.nextBox.bottom, this.heldShapeBottomBorder); - } drawHoldBox() { - if (!this.isMainBoard) { return; } this.screen.d(this.holdBox.left, this.holdBox.top, this.heldShapeTopBorder); @@ -112,7 +102,6 @@ module.exports = class Board { } this.screen.d(this.holdBox.left, this.holdBox.bottom, this.heldShapeBottomBorder); - } draw() { @@ -128,25 +117,21 @@ module.exports = class Board { } drawGameOver() { - const lines = `IT'S CURTAINS FOR YOU!`.split(' '); const firstLineY = Math.floor(this.bottom / 2) - 4; // clear out some space on the board for (let i = 0; i < 6; i++) { - for (let i2 = this.left + 1; i2 < this.right; i2++) { this.screen.d(i2, firstLineY - 1 + i, ' '); } - } // display text centered on the board for (let i = 0; i < lines.length; i++) { const l = lines[i]; - this.screen.d(Math.ceil((this.right + this.left) / 2) - Math.ceil((l.length / 2)), firstLineY + i, l, { color: 'brightRed' }); // eslint-disable-line no-extra-parens + this.screen.d(Math.ceil((this.right + this.left) / 2) - Math.ceil((l.length / 2)), firstLineY + i, l, { color: 'brightRed' }); } - } drawScore() { @@ -167,7 +152,6 @@ module.exports = class Board { } startNewShape() { - this.drawBottomBorder(); // reset bottom border indicator let newShapeType; @@ -186,7 +170,6 @@ module.exports = class Board { this.drawHeldShape(this.nextShapeType, false, false); this.screen.render(); - } moveShapeAutomatically() { @@ -204,7 +187,6 @@ module.exports = class Board { } clearLines(gameOver) { - // get the Y's of current points (only need to check these y lines are full) // iterate them in order of higest Y to lowest (start clearing lines from the bottom of the board) const ys = [...new Set(this.currentShape.currentPoints.map(p => p[1]))].sort().reverse(); @@ -215,7 +197,6 @@ module.exports = class Board { // loop through cleared lines, move the lines above down by one for (const originalY of ys) { - // if we cleared any lines, we need to adjust where we're looking for the next cleared line const y = originalY + linesCleared; @@ -232,7 +213,6 @@ module.exports = class Board { // move lines above cleared lines down, point by point for (const p of this.occupiedPoints.filter(op => op[1] < y)) { - const sp = this.screen.get({ x: p[0], y: p[1] }); erasePoints.push([p[0], p[1]]); // pass values of, not the ref to p, because we modify the position on the next line @@ -240,15 +220,11 @@ module.exports = class Board { p[1] += 1; // update the point location this.screen.put({ x: p[0], y: p[1], attr: sp.attr }, sp.char); // draw the point in its new location - } - } - } if (linesCleared > 0) { - for (const ep of erasePoints) { if (!this.isPointOccupied(ep)) { this.screen.d(...ep, ' '); // erase the point @@ -259,21 +235,18 @@ module.exports = class Board { this.screen.render(); - // eslint-disable-next-line no-param-reassign, no-unused-vars + // eslint-disable-next-line no-unused-vars gameOver = false; // give them another chance if they cleared lines... - } - } lockShape() { - let gameOver = false; this.occupiedPoints.push(...this.currentShape.currentPoints); // check if game over. if lowest y value (highest point of shape) is outside of top border, it's curtains! (probably) - if (Math.min(...this.currentShape.currentPoints.map(p => p[1])) <= this.top) { // eslint-disable-line max-depth + if (Math.min(...this.currentShape.currentPoints.map(p => p[1])) <= this.top) { gameOver = true; } @@ -287,13 +260,11 @@ module.exports = class Board { else { this.startNewShape(); } - } - factorial(n) { return !(n > 1) ? 1 : this.factorial(n - 1) * n; } // eslint-disable-line no-negated-condition + factorial(n) { return !(n > 1) ? 1 : this.factorial(n - 1) * n; } pause() { - const txtPaused = 'Game paused by you'; if (this.game.paused) { @@ -301,21 +272,17 @@ module.exports = class Board { this.screen.d(24, 21, txtPaused, { color: 'brightRed' }); } else { - this.resetAutoMoveTimer(); for (let i = 0; i < txtPaused.length; i++) { this.screen.d(24 + i, 21, ' '); } - } this.screen.render(); - } holdShape() { - if (this.currentShape.held || this.game.paused) { // current shape cannot be held more than once return; @@ -341,7 +308,6 @@ module.exports = class Board { // release the currently held shape if it exists, otherwise start a new shape if (copyHeldShape) { - this.drawBottomBorder(); // reset bottom border indicator this.currentShape = copyHeldShape; @@ -354,7 +320,6 @@ module.exports = class Board { this.screen.render(); this.resetAutoMoveTimer(); - } else { this.startNewShape(); @@ -362,11 +327,9 @@ module.exports = class Board { this.drawHeldShape(this.heldShape.shapeType, false, true); this.screen.render(); - } drawHeldShape(shapeType, clear, isHold) { - if (!this.isMainBoard) { return; } @@ -407,19 +370,15 @@ module.exports = class Board { p[1] += boxOffsetY + 3; this.drawShapePoint(p, i, clear, s.color); } - } drawShapePoint(p, i, clear, bgColor, color = 'black') { - // don't draw if point is outside of bounds if (p[1] > this.top) { - if (clear) { this.screen.d(...p, ' '); } else { - const content = i % 2 === 0 ? '[' : ']'; if (this.screen.colorEnabled) { @@ -428,11 +387,8 @@ module.exports = class Board { else { this.screen.put({ x: p[0], y: p[1], attr: { inverse: true } }, content); } - } - } - } stopAutoMoveTimer() { @@ -443,6 +399,4 @@ module.exports = class Board { this.stopAutoMoveTimer(); this.currentTimeout = setTimeout(this.moveShapeAutomatically.bind(this), this.game.interval); } - }; - diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..dfd0960 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,55 @@ +const js = require('@eslint/js'); +const stylisticJS = require('@stylistic/eslint-plugin-js'); + +module.exports = [ + js.configs.recommended, + { + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'commonjs', + parserOptions: { ecmaFeatures: { impliedStrict: true } }, + globals: { + clearTimeout: true, + console: true, + setTimeout: true, + structuredClone: true, + }, + }, + // files: ['*.mjs', 'src/**/*.mjs'], + plugins: { '@stylistic/js': stylisticJS }, + rules: { + 'arrow-spacing': 'error', + 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }], + eqeqeq: 'error', + 'no-unused-expressions': 'error', + 'no-var': 'error', + 'prefer-const': 'error', + 'prefer-template': 'error', + semi: ['error', 'always'], + '@stylistic/js/array-bracket-spacing': ['error', 'never'], + '@stylistic/js/block-spacing': 'error', + '@stylistic/js/comma-dangle': ['error', 'always-multiline'], + '@stylistic/js/comma-spacing': ['error', { before: false, after: true }], + '@stylistic/js/comma-style': ['error', 'last'], + '@stylistic/js/eol-last': 'error', + '@stylistic/js/function-call-spacing': 'error', + '@stylistic/js/key-spacing': 'error', + '@stylistic/js/keyword-spacing': 'error', + '@stylistic/js/indent': ['error', 2, { SwitchCase: 1 }], + '@stylistic/js/no-multi-spaces': ['error', { ignoreEOLComments: true }], + '@stylistic/js/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }], + '@stylistic/js/no-whitespace-before-property': 'error', + '@stylistic/js/object-curly-newline': ['error', { multiline: true }], + '@stylistic/js/object-curly-spacing': ['error', 'always'], + '@stylistic/js/object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }], + '@stylistic/js/padded-blocks': ['error', 'never'], + '@stylistic/js/quote-props': ['error', 'as-needed'], + '@stylistic/js/quotes': ['error', 'single', { allowTemplateLiterals: true }], + '@stylistic/js/space-before-blocks': 'error', + '@stylistic/js/space-before-function-paren': ['error', { anonymous: 'never', named: 'never', asyncArrow: 'always' }], + '@stylistic/js/space-in-parens': 'error', + '@stylistic/js/space-infix-ops': 'error', + '@stylistic/js/template-curly-spacing': 'error', + }, + }, +]; diff --git a/game.js b/game.js index eae2b6c..b432167 100644 --- a/game.js +++ b/game.js @@ -1,5 +1,4 @@ module.exports = class Game { - paused = false; boards = []; @@ -9,13 +8,10 @@ module.exports = class Game { } pause() { - this.paused = !this.paused; for (const b of this.boards) { b.pause(); } - } - }; diff --git a/netrisse.js b/netrisse.js index fb5a4d2..03dc8c7 100644 --- a/netrisse.js +++ b/netrisse.js @@ -1,5 +1,3 @@ -/* eslint-disable max-lines */ - const Board = require('./board'); const Screen = require('./screen'); const Game = require('./game'); @@ -32,7 +30,6 @@ if (players > 1) { } function quit() { - for (const b of game.boards) { b.stopAutoMoveTimer(); } @@ -50,8 +47,7 @@ function writeDebugInfo() { // eslint-disable-line no-unused-vars console.log(JSON.stringify(board.moves)); } -screen.term.on('key', name => { // eslint-disable-line complexity - +screen.term.on('key', name => { switch (name) { case 'j': case 'J': @@ -93,5 +89,4 @@ screen.term.on('key', name => { // eslint-disable-line complexity default: break; } - }); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..3f10c6c --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1242 @@ +{ + "name": "netrisse", + "version": "1.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "netrisse", + "version": "1.0.1", + "license": "GPL-3.0-or-later", + "dependencies": { + "mersenne-twister": "^1.1.0", + "terminal-kit": "^3.0.0" + }, + "bin": { + "netrisse": "netrisse.js" + }, + "devDependencies": { + "@stylistic/eslint-plugin-js": "^2.1.0", + "eslint": "^9.3.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@cronvel/get-pixels": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@cronvel/get-pixels/-/get-pixels-3.4.1.tgz", + "integrity": "sha512-gB5C5nDIacLUdsMuW8YsM9SzK3vaFANe4J11CVXpovpy7bZUGrcJKmc6m/0gWG789pKr6XSZY2aEetjFvSRw5g==", + "dependencies": { + "jpeg-js": "^0.4.4", + "ndarray": "^1.0.19", + "ndarray-pack": "^1.1.1", + "node-bitmap": "0.0.1", + "omggif": "^1.0.10", + "pngjs": "^6.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", + "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.3.0.tgz", + "integrity": "sha512-niBqk8iwv96+yuTwjM6bWg8ovzAPF9qkICsGtcoa5/dmqcEMfdwNAX7+/OHcJHc7wj7XqPxH98oAHytFYlw6Sw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "dev": true + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.0.tgz", + "integrity": "sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==", + "dev": true, + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@stylistic/eslint-plugin-js": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-2.1.0.tgz", + "integrity": "sha512-gdXUjGNSsnY6nPyqxu6lmDTtVrwCOjun4x8PUn0x04d5ucLI74N3MT1Q0UhdcOR9No3bo5PGDyBgXK+KmD787A==", + "dev": true, + "dependencies": { + "@types/eslint": "^8.56.10", + "acorn": "^8.11.3", + "eslint-visitor-keys": "^4.0.0", + "espree": "^10.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@types/eslint": { + "version": "8.56.10", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz", + "integrity": "sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==", + "dev": true, + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", + "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chroma-js": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chroma-js/-/chroma-js-2.4.2.tgz", + "integrity": "sha512-U9eDw6+wt7V8z5NncY2jJfZa+hUH8XEj8FQHgFJTrUFnJfXYf4Ml4adI2vXZOjqRDpFWtYVWypDfZwnJ+HIR4A==" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/cwise-compiler": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/cwise-compiler/-/cwise-compiler-1.1.3.tgz", + "integrity": "sha512-WXlK/m+Di8DMMcCjcWr4i+XzcQra9eCdXIJrgh4TUgh0pIS/yJduLxS9JgefsHJ/YVLdgPtXm9r62W92MvanEQ==", + "dependencies": { + "uniq": "^1.0.0" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.3.0.tgz", + "integrity": "sha512-5Iv4CsZW030lpUqHBapdPo3MJetAPtejVW8B84GIcIIv8+ohFaddXsrn1Gn8uD9ijDb+kcYKFUVmC8qG8B2ORQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "9.3.0", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.3.0", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.0.1", + "eslint-visitor-keys": "^4.0.0", + "espree": "^10.0.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.0.1.tgz", + "integrity": "sha512-pL8XjgP4ZOmmwfFE8mEhSxA7ZY4C+LWyqjQ3o4yWkkmD0qcMT9kkW3zWHOczhWcjTSgqycYAgwSlXvZltv65og==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz", + "integrity": "sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.0.1.tgz", + "integrity": "sha512-MWkrWZbJsL2UwnjxTX3gG8FneachS/Mwg7tdGXce011sJd5b0JG54vat5KHnfSBODZ3Wvzd2WnjxyzsRoVv+ww==", + "dev": true, + "dependencies": { + "acorn": "^8.11.3", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "dev": true + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/iota-array": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/iota-array/-/iota-array-1.0.0.tgz", + "integrity": "sha512-pZ2xT+LOHckCatGQ3DcG/a+QuEqvoxqkiL7tvE8nn3uuu+f6i1TtpB5/FtWFbxUuVr5PZCx8KskuGatbJDXOWA==" + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/jpeg-js": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", + "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/lazyness": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/lazyness/-/lazyness-1.2.0.tgz", + "integrity": "sha512-KenL6EFbwxBwRxG93t0gcUyi0Nw0Ub31FJKN1laA4UscdkL1K1AxUd0gYZdcLU3v+x+wcFi4uQKS5hL+fk500g==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/mersenne-twister": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mersenne-twister/-/mersenne-twister-1.1.0.tgz", + "integrity": "sha512-mUYWsMKNrm4lfygPkL3OfGzOPTR2DBlTkBNHM//F6hGp8cLThY897crAlk3/Jo17LEOOjQUrNAx6DvgO77QJkA==" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/ndarray": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/ndarray/-/ndarray-1.0.19.tgz", + "integrity": "sha512-B4JHA4vdyZU30ELBw3g7/p9bZupyew5a7tX1Y/gGeF2hafrPaQZhgrGQfsvgfYbgdFZjYwuEcnaobeM/WMW+HQ==", + "dependencies": { + "iota-array": "^1.0.0", + "is-buffer": "^1.0.2" + } + }, + "node_modules/ndarray-pack": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ndarray-pack/-/ndarray-pack-1.2.1.tgz", + "integrity": "sha512-51cECUJMT0rUZNQa09EoKsnFeDL4x2dHRT0VR5U2H5ZgEcm95ZDWcMA5JShroXjHOejmAD/fg8+H+OvUnVXz2g==", + "dependencies": { + "cwise-compiler": "^1.1.2", + "ndarray": "^1.0.13" + } + }, + "node_modules/nextgen-events": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/nextgen-events/-/nextgen-events-1.5.3.tgz", + "integrity": "sha512-P6qw6kenNXP+J9XlKJNi/MNHUQ+Lx5K8FEcSfX7/w8KJdZan5+BB5MKzuNgL2RTjHG1Svg8SehfseVEp8zAqwA==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/node-bitmap": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/node-bitmap/-/node-bitmap-0.0.1.tgz", + "integrity": "sha512-Jx5lPaaLdIaOsj2mVLWMWulXF6GQVdyLvNSxmiYCvZ8Ma2hfKX0POoR2kgKOqz+oFsRreq0yYZjQ2wjE9VNzCA==", + "engines": { + "node": ">=v0.6.5" + } + }, + "node_modules/omggif": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/omggif/-/omggif-1.0.10.tgz", + "integrity": "sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw==" + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pngjs": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==", + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" + }, + "node_modules/seventh": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/seventh/-/seventh-0.9.2.tgz", + "integrity": "sha512-C+dnbBXIEycnrN6/CpFt/Rt8ccMzAX3wbwJU61RTfC8lYPMzSkKkAVWnUEMTZDHdvtlrTupZeCUK4G+uP4TmRQ==", + "dependencies": { + "setimmediate": "^1.0.5" + }, + "engines": { + "node": ">=16.13.0" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-kit": { + "version": "0.18.2", + "resolved": "https://registry.npmjs.org/string-kit/-/string-kit-0.18.2.tgz", + "integrity": "sha512-LInRG+5UVQc8WeWPKi5MITq50hBmmncNuB8bgNRJjSi695cMPLEJf+eNmUYt+PQSkgrZRbzMMmQ5mKAl7PfIxw==", + "engines": { + "node": ">=14.15.0" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/terminal-kit": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/terminal-kit/-/terminal-kit-3.1.1.tgz", + "integrity": "sha512-R+R47zBQ14Ax2NZCLeuVl2GwonDwQN4iAsjQZICW8gMzaV+VIJMvL4qhUQtzDOhENADyNPQvY1Vz5G0bHHkLEA==", + "dependencies": { + "@cronvel/get-pixels": "^3.4.1", + "chroma-js": "^2.4.2", + "lazyness": "^1.2.0", + "ndarray": "^1.0.19", + "nextgen-events": "^1.5.3", + "seventh": "^0.9.2", + "string-kit": "^0.18.1", + "tree-kit": "^0.8.7" + }, + "engines": { + "node": ">=16.13.0" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/tree-kit": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/tree-kit/-/tree-kit-0.8.7.tgz", + "integrity": "sha512-BA/cp8KBvbBDkunxIuoBqzz3pYHL7J8QdzbKohK09urOpHFYqEe/xWGKkECEQG+LvfREd1GNqH3643GYFX8wSQ==", + "engines": { + "node": ">=16.13.0" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha512-Gw+zz50YNKPDKXs+9d+aKAjVwpjNwqzvNpLigIruT4HA9lMZNdMqs9x07kKHB/L9WRzqp4+DlTU5s4wG2esdoA==" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json index 08e74b6..60f0734 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,8 @@ "terminal-kit": "^3.0.0" }, "scripts": { + "lint": "eslint .", + "lint:fix": "eslint . --fix", "test": "eslint . && node ./test/algorithm-test.js" }, "repository": { @@ -24,7 +26,8 @@ }, "homepage": "https://github.com/ctcpip/netrisse#readme", "devDependencies": { - "eslint": "^8.23.1" + "@stylistic/eslint-plugin-js": "^2.1.0", + "eslint": "^9.3.0" }, "pkg": { "assets": "node_modules/terminal-kit/**/*" diff --git a/rando.js b/rando.js index ab9d46c..594ab9a 100644 --- a/rando.js +++ b/rando.js @@ -1,7 +1,6 @@ const MersenneTwister = require('mersenne-twister'); module.exports = class Rando { - constructor(seed) { this.rng = new MersenneTwister(); this.rng.init_seed(seed); @@ -15,6 +14,4 @@ module.exports = class Rando { random() { return this.rng.random(); } - }; - diff --git a/screen.js b/screen.js index 42b9ad5..ad50a11 100644 --- a/screen.js +++ b/screen.js @@ -2,9 +2,7 @@ const termkit = require('terminal-kit'); const packageJSON = require('./package.json'); module.exports = class Screen { - constructor(colorEnabled, interval, seed) { - this.colorEnabled = colorEnabled; this.term = termkit.terminal; this.term.windowTitle('Netrisse'); @@ -30,21 +28,18 @@ module.exports = class Screen { this.displayTime(); this.timeDisplayTimeout = setTimeout(this.displayTime.bind(this), 1000); - } /** * draw */ d(x, y, content, { color = 'white', bgColor = 'black' } = { color: 'white', bgColor: 'black' }) { - if (this.colorEnabled) { this.screen.put({ x, y, attr: { color, bgColor } }, content); } else { this.screen.put({ x, y }, content); } - } render() { @@ -60,20 +55,16 @@ module.exports = class Screen { } displayTime() { - const date = new Date(); const options = { hour: 'numeric', minute: 'numeric', - hour12: true + hour12: true, }; const time = new Intl.DateTimeFormat('en', options).format(date); this.d(24, 22, time); this.render(); - } - }; - diff --git a/shape.js b/shape.js index 9340fed..2287d7f 100644 --- a/shape.js +++ b/shape.js @@ -1,5 +1,3 @@ -/* eslint-disable max-lines */ - const { shapes } = require('./shapes'); const directions = require('./directions'); @@ -24,7 +22,6 @@ module.exports = class Shape { * start a new random shape */ static createNewShape(screen, board, shapeType) { - const s = new Shape(screen, board, shapeType); s.setInitialPosition(); @@ -33,11 +30,9 @@ module.exports = class Shape { s.screen.render(); return s; - } draw(clear) { - for (let i = 0; i < this.currentPoints.length; i++) { const p = this.currentPoints[i]; this.board.drawShapePoint(p, i, clear, this.color); @@ -48,11 +43,9 @@ module.exports = class Shape { for (const x of xPointsForIndicator) { this.board.setIndicator(x, clear); } - } drawGhost(clear) { - const { canMove, dropGhostShapePoints } = this.getDownDropGhostPositions(); if (canMove || clear) { @@ -61,15 +54,13 @@ module.exports = class Shape { this.board.drawShapePoint(p, i, clear, this.ghostColor, 'black'); } } - } setInitialPosition() { - [this.currentPoints] = structuredClone(this.points); // center of the board - const x = ((this.board.right + this.board.left + 1) / 2) + 1; // eslint-disable-line no-extra-parens + const x = ((this.board.right + this.board.left + 1) / 2) + 1; let y = this.board.top; @@ -88,11 +79,9 @@ module.exports = class Shape { p[0] += x; p[1] += y; } - } getDownDropGhostPositions() { - let offsetY = 0; let dropGhostOffsetY = 0; @@ -138,11 +127,9 @@ module.exports = class Shape { }); return { canMove: returnCanMove, newShapePoints, dropGhostShapePoints, offsetY, dropGhostOffsetY }; - } - move(direction) { // eslint-disable-line complexity - + move(direction) { if (this.board.gameOver || this.board.game.paused) { return; } @@ -187,11 +174,10 @@ module.exports = class Shape { } } - if ((direction === directions.AUTO && !canMove) || direction === directions.DROP) { // eslint-disable-line no-extra-parens + if ((direction === directions.AUTO && !canMove) || direction === directions.DROP) { // only lock when auto-moved or dropped lockShape = true; } - } break; @@ -227,10 +213,8 @@ module.exports = class Shape { case directions.ROTATE_LEFT: { - // o shape can't rotate if (this.points.length > 1) { - const newSelectedPoints = this.direction === 0 ? this.points.length - 1 : this.direction - 1; newShapePoints = structuredClone(this.points[newSelectedPoints]); @@ -250,7 +234,6 @@ module.exports = class Shape { if (canMove) { this.direction = newSelectedPoints; } - } break; @@ -261,7 +244,6 @@ module.exports = class Shape { } if (canMove) { - this.drawGhost(true); this.draw(true); this.currentPoints = newShapePoints; @@ -283,7 +265,6 @@ module.exports = class Shape { default: break; } - } if (lockShape) { @@ -291,8 +272,5 @@ module.exports = class Shape { } this.board.concurrentExecutions -= 1; - } - }; - diff --git a/shapes.js b/shapes.js index 148345e..6f042e4 100644 --- a/shapes.js +++ b/shapes.js @@ -1,5 +1,6 @@ const shapeI = -{ color: 'blue', +{ + color: 'blue', ghostColor: 17, points: [ [ // horizontal @@ -10,7 +11,7 @@ const shapeI = [1, 0], [2, 0], [3, 0], - [4, 0] + [4, 0], ], [ // vertical [-1, -2], @@ -20,12 +21,14 @@ const shapeI = [-1, 0], [0, 0], [-1, 1], - [0, 1] - ] - ] }; + [0, 1], + ], + ], +}; const shapeJ = -{ color: 'yellow', +{ + color: 'yellow', ghostColor: 58, points: [ [ // horizontal 1 @@ -36,7 +39,7 @@ const shapeJ = [1, 0], [2, 0], [1, 1], - [2, 1] + [2, 1], ], [ // vertical 1 [-1, -1], @@ -68,10 +71,12 @@ const shapeJ = [-1, 1], [0, 1], ], - ] }; + ], +}; const shapeL = - { color: 'cyan', + { + color: 'cyan', ghostColor: 23, points: [ [ // horizontal 1 @@ -82,7 +87,7 @@ const shapeL = [1, 0], [2, 0], [-3, 1], - [-2, 1] + [-2, 1], ], [ // vertical 1 [-3, -1], @@ -112,12 +117,14 @@ const shapeL = [-1, 1], [0, 1], [1, 1], - [2, 1] + [2, 1], ], - ] }; + ], + }; const shapeO = - { color: 'magenta', + { + color: 'magenta', ghostColor: 53, points: [ [ @@ -129,11 +136,13 @@ const shapeO = [-2, 1], [-1, 1], [0, 1], - ] - ] }; + ], + ], + }; const shapeS = - { color: 'green', + { + color: 'green', ghostColor: 22, points: [ [ // horizontal @@ -144,7 +153,7 @@ const shapeS = [1, 0], [2, 0], [-1, 1], - [0, 1] + [0, 1], ], [ // vertical [-1, 0], @@ -156,10 +165,12 @@ const shapeS = [1, 2], [2, 2], ], - ] }; + ], + }; const shapeT = - { color: 'white', + { + color: 'white', ghostColor: 237, points: [ [ // horizontal 1 @@ -170,7 +181,7 @@ const shapeT = [1, 0], [2, 0], [-1, 1], - [0, 1] + [0, 1], ], [ // vertical 1 [-1, -1], @@ -202,10 +213,12 @@ const shapeT = [-1, 1], [0, 1], ], - ] }; + ], + }; const shapeZ = - { color: 'red', + { + color: 'red', ghostColor: 52, points: [ [ // horizontal @@ -228,7 +241,8 @@ const shapeZ = [-1, 0], [0, 0], ], - ] }; + ], + }; const shapes = Object.freeze([ shapeI, diff --git a/test/algorithm-test.js b/test/algorithm-test.js index 7a9af32..936a3d3 100644 --- a/test/algorithm-test.js +++ b/test/algorithm-test.js @@ -1,5 +1,3 @@ -/* eslint-disable guard-for-in */ - const { easy, frustrationFree, random, tooEasy } = require('../algorithms'); const MersenneTwister = require('mersenne-twister'); @@ -21,7 +19,6 @@ function logDistribution(distribution) { // eslint-disable-line no-unused-vars } function getRandomStandardDeviation() { - const algo = random(seed); const distribution = { @@ -41,11 +38,9 @@ function getRandomStandardDeviation() { // logDistribution(distribution); return Math.floor(getStandardDeviation(Object.values(distribution))); - } function getEasyStandardDeviation() { - const algo = easy(seed); const distribution = { @@ -65,11 +60,9 @@ function getEasyStandardDeviation() { // logDistribution(distribution); return Math.floor(getStandardDeviation(Object.values(distribution))); - } function getTooEasyStandardDeviation() { - const algo = tooEasy(seed); const distribution = { @@ -89,11 +82,9 @@ function getTooEasyStandardDeviation() { // logDistribution(distribution); return Math.floor(getStandardDeviation(Object.values(distribution))); - } function getFFStandardDeviation() { - const algo = frustrationFree(seed); const distribution = { @@ -113,7 +104,6 @@ function getFFStandardDeviation() { // logDistribution(distribution); return Math.floor(getStandardDeviation(Object.values(distribution))); - } let acceptableDeviationLimit = 0;