Skip to content

fix(devex): resolve JSON enum imports for editor autocomplete - #1394

Merged
itsalaidbacklife merged 1 commit into
cuttle-cards:mainfrom
nova-loop:devex/json-enum-intellisense
Oct 6, 2026
Merged

itsalaidbacklife merged 1 commit into
cuttle-cards:mainfrom
nova-loop:devex/json-enum-intellisense

Conversation

@nova-loop

Copy link
Copy Markdown
Contributor

Issue number

Relevant issue number

Please check the following

  • Do the tests still pass? (see Run the Tests)
  • Is the code formatted properly? (see Linting (Formatting))
  • For New Features:
    • Have tests been added to cover any new features or fixes?
    • Has the documentation been updated accordingly?

(No new tests/docs: this is editor-tooling config only, checkJs stays off so nothing changes in CI or the build.)

Please describe additional details for testing this change

Implements the two fixes proposed in #1393:

  1. jsconfig.json: add "resolveJsonModule": true.
  2. Append .json to the three extensionless enum imports (GameView.vue, GameCard.vue, ScrapPile.vue).

How I checked it: ran the TypeScript language service (tsc --noEmit, allowJs + checkJs, extending the repo's jsconfig.json) over a small throwaway probe file.

  • Before: import MoveType from '_/utils/MoveType.json' gives TS2732 ... Consider using '--resolveJsonModule'.
  • After: the import resolves to the literal object type, and MoveType.TOTALLY_FAKE_KEY is flagged (a // @ts-expect-error on that line is satisfied).
  • An extensionless '_/utils/MoveType' still fails with TS2307 even with the flag on, which confirms the three import edits are needed too.

Also ran npx eslint on the changed .vue files (clean), npm run test:unit:client (passes), and vite build (succeeds). I did not run the sails unit tests or Cypress e2e locally; nothing server-side changed.

Side note, left out to keep this scoped to the issue: a few backend require() calls also omit the extension (e.g. require('../../utils/GameStatus') in api/helpers/is-game-full.js, and MoveType/TargetType under api/helpers/game-states/ai/), so they miss out on the same typing. Happy to follow up on those if you'd like.

Prepared with AI assistance; I reviewed and verified the change as described above.

Enable resolveJsonModule in jsconfig.json and add the missing .json
extension to the three extensionless enum imports so MoveType,
Transitions, etc. get autocomplete and typo detection.

Resolves cuttle-cards#1393

@Haviles04 Haviles04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but I'll leave it up to @itsalaidbacklife

@itsalaidbacklife itsalaidbacklife added version-patch An update that warrants a bumping the project's patch version (e.g. 4.0.0 => 4.0.1) dev experience Improvements to the code base that make it easier/better/more enjoyable to contribute to Cuttle labels Oct 6, 2026
@itsalaidbacklife

Copy link
Copy Markdown
Contributor

Woohoo! This works beautifully
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev experience Improvements to the code base that make it easier/better/more enjoyable to contribute to Cuttle version-patch An update that warrants a bumping the project's patch version (e.g. 4.0.0 => 4.0.1)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DevEx]: JSON enums (MoveType, GamePhase, …) don't provide editor autocomplete

3 participants