[06/44] Enable TS strict mode in dotcms-js
Nobody has claimed this yet.
- 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 dotcms-js project.
- Dependency layer: 1 (0 = leaf library, 10 = top-level app)
- Internal dependents: 20 project(s), including the
dotcms-uiadmin app - Rollout order: 6 / 44
Approach corrected. The original criteria referenced
typescript-strict-plugin,npx tsc-strict, and// @ts-strict-ignore. That approach was dropped — the bootstrap issue #35933 closed without the plugin ever landing (it is absent frompackage.json,pnpm-lock.yaml, andmain). The established pattern is per-projecttsconfig.jsonflags, set by the first merged rollout PR #36879 (dotcms-models). See epic #35932 for details.
Acceptance Criteria
- The six strict flags are added to
libs/dotcms-js/tsconfig.json(nottsconfig.base.json, which stays at"strict": false):
forceConsistentCasingInFileNames,strict,noImplicitOverride,noPropertyAccessFromIndexSignature,noImplicitReturns,noFallthroughCasesInSwitch. -
pnpm exec tsc -p libs/dotcms-js/tsconfig.lib.json --noEmitexits 0 (38 errors at the start, across 11 files). - No new
any,@ts-ignore, or@ts-expect-error. Prefer correcting types over silencing; any definite-assignment assertion (!) carries a TODO explaining why widening was not viable. - The six already-strict consumers still build:
data-access,global-store,portlets-dot-analytics,portlets-dot-analytics-data-access,portlets-dot-locales-portlet,utils-testing. -
pnpm exec nx affected -t build,lintdoes not regress any of the 20 dependents. -
pnpm exec nx format:checkpasses.
Out of scope
tsconfig.spec.json— it fails today withTS2688: Cannot find type definition file for 'jasmine', a pre-existing breakage unrelated to strict mode.- The
skip:lint/skip:testtags —nx run dotcms-js:lintcurrently fails with 42 problems (mostlyno-explicit-any); re-enabling lint is separate work. - Adding a
typechecktarget or CI gate. Note the consequence:dotcms-jshas nobuildtarget and is tag-excluded from lint and test, so nothing in CI verifies these flags. They document intent; they do not enforce it. The six already-strict consumers provide partial, incidental coverage only.
Priority
Medium
Additional Context
One project in the bottom-up rollout tracked by epic #35932. Full specification: specs/35939-dotcms-js-strict-mode/spec.md.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with libs/dotcms-js/tsconfig.json and the full specification in specs/35939-dotcms-js-strict-mode/spec.md. Run pnpm exec tsc -p libs/dotcms-js/tsconfig.lib.json --noEmit to inspect the 38 errors across 11 files, then verify the six strict consumers, affected builds, and format check. Done means all six flags are enabled without new suppressions and the listed checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100