dotCMS / dotCMS/core

[22/44] Enable TS strict mode in block-editor

Open
#35,955 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Team : Maintenance Type : Refactoring
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Description

Part of the strict-mode rollout epic #35932. Enable TypeScript strict mode for the block-editor project.

  • Dependency layer: 6 (0 = leaf library, 10 = top-level app)
  • Internal dependents: 5 (dotcms-block-editor, dotcms-ui, edit-content, edit-ema-ui, portlets-edit-ema-portlet)
  • Rollout order: 22 / 44

Acceptance Criteria

  • The six strict flags are added to libs/block-editor/tsconfig.json — the project's own config, not tsconfig.spec.json and not tsconfig.base.json, which stays "strict": false:
    forceConsistentCasingInFileNames, strict, noImplicitOverride, noPropertyAccessFromIndexSignature, noImplicitReturns, noFallthroughCasesInSwitch.
  • tsc -p libs/block-editor/tsconfig.lib.json --noEmit reports 0 errors.
  • tsc -p libs/block-editor/tsconfig.spec.json --noEmit reports 0 errors — the flags live in tsconfig.json, which the spec config extends, so spec errors are in scope.
  • No new any. Anything unavoidable uses @ts-expect-error with a // TODO(#issue): note, never a blanket @ts-ignore.
  • nx run block-editor:lint introduces no new findings.
  • nx run block-editor:test does not regress — compared by failing-test name, not just count.
  • The five dependents gain no new errors.

[!IMPORTANT]
typescript-strict-plugin / npx tsc-strict / @ts-strict-ignore are not used. Those were dropped early in the epic; the approach in force is documented in core-web/CLAUDE.mdTypeScript Strict Mode. The original ACs above have been corrected accordingly.

Measurement caveats

Five ways to get a green signal that checked nothing — all of them hit during this epic:

  1. nx run <project>:test never type-checks. jest-preset-angular runs on ts-jest, which copies TypeScript's isolatedModules into its own transpile-only switch and skips building the language-service host diagnostics need. Passing tests are not evidence that specs compile.
  2. TS2688 (a types entry that is not installed) aborts tsc before semantic checking — one error, no type checking at all.
  3. TS6053 (a files entry pointing at a missing file) aborts the same way. A non-matching include glob is harmless; a missing files entry is fatal.
  4. tsc -p does not check templates. Only a build does.
  5. Check moduleResolution. node10 cannot resolve the @dotcms/* subpath exports, which inflated dot-plugins from 63 real errors to 733 phantom ones.

block-editor has no build target, so tsc -p on both configs is the acceptance test — there is no build to lean on.

Priority

Medium

Additional Context

One project in the bottom-up rollout tracked by epic #35932.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read core-web/CLAUDE.md's TypeScript Strict Mode guidance and inspect libs/block-editor/tsconfig.json, tsconfig.lib.json, and tsconfig.spec.json. Run tsc -p on both project configs, then check nx run block-editor:lint and nx run block-editor:test, while verifying the five dependent projects gain no errors. Done means all six flags are in the project config, both checks pass without new any, and dependents remain clean.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.