powergrid/engine/.eslintrc.js
goldjohn6 6fb432a041
China: correct seven city names and the Changchun-Jilin cost (#59) (#117)
yvessl reported in September 2023 that the China map does not match the printed
board. Every item still held; nothing had been applied.

Names (enum values, so the strings players actually see):
  Qiqhaer  -> Qiqha'er     Qingoad  -> Qingdao
  Badtou   -> Baotou       Kuerle   -> Ku'erle
  Xian     -> Xi'an        Chiyang  -> Guiyang
  Yinchjan -> Yinchuan

Four of these were plain transcription errors (Qingoad/Badtou/Chiyang/Yinchjan);
the other three were missing apostrophes. Enum KEYS were renamed only where the
key itself was misspelled -- Qiqhaer/Kuerle/Xian keep their identifier-safe keys
and carry the apostrophe in the value.

Connection: Changchun-Jilin was cost 5, the board says 2.

Also: engine/.eslintrc.js `quotes` gains `avoidEscape: true`. Three of the new
names contain an apostrophe, and without that option the rule and Prettier
deadlock -- Prettier rewrites 'Xi\'an' to "Xi'an" to minimise escapes, and the
rule then errors on exactly what Prettier produced. avoidEscape is the standard
companion setting; engine-wide lint is unchanged at 0 errors / 30 warnings.

Tests: 72 specs (+3). China had no coverage at all before this. The two
regression specs are teeth-checked against the pre-change map (they fail with
"Qiqha'er is on the map" and "expected 5 to equal 2"); they assert on the map
module rather than through setup(), because setup() trims cities by player count
and would quietly stop covering whichever names fell out of play. The third spec
walks every connection endpoint against the city list, so a rename that missed a
reference fails loudly.

DEPLOY NOTE -- this is the replay-breaking class, not an inert one, though the
blast radius is small and recoverable. Live game state stores its own map, so a
China game already in progress keeps playing on the old names. What breaks is
the replay view: wrapper.replay() rebuilds from a fresh setup() and re-applies
logged moves, so a logged Build on "Qingoad" no longer matches a map that says
"Qingdao". Measured against a real 6P China game -- it throws
"Wrong argument for the command Build", i.e. it fails loudly rather than
diverging silently. The player-facing path (GET /gameplay/:id/log?end=N) is
read-only, so a player who hits it can refresh and carry on; the variant that
persists (POST /gameplay/:id/replay) is admin-only. At time of writing exactly
one live China game exists.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 09:26:23 -07:00

38 lines
1.6 KiB
JavaScript

module.exports = {
root: true,
env: {
node: true,
},
parserOptions: {
ecmaVersion: 2020,
},
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
semi: ['error', 'always'],
'@typescript-eslint/no-non-null-assertion': 'off',
// '@typescript-eslint/consistent-type-assertions': 'off',
// '@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-namespace': 'off',
'no-inner-declarations': 'off',
'no-return-assign': 'off',
// 'no-fallthrough': 'off',
'no-empty': 'off',
// avoidEscape lets a string that itself contains an apostrophe use double
// quotes ("Xi'an") instead of escaping ('Xi\'an'). Without it this rule and
// Prettier deadlock: Prettier rewrites the escaped form to double quotes to
// minimise escapes, and the rule then rejects what Prettier just produced.
quotes: ['error', 'single', { avoidEscape: true }],
},
};