packages/codemods/v5-0-0/18-report-thresholds-usage.md
thresholds UsageComplexity: Moderate
Find thresholds parameter usage inside _moment.humanizeDuration or _dayjs.humanizeDuration blocks and advise on removal.
In Lowdefy v5, the thresholds parameter on humanizeDuration is accepted but ignored. Dayjs supports only global thresholds (identical to moment's defaults). Per-call custom thresholds have no effect.
Find all .yaml and .yml files in the project (excluding node_modules/ and hidden directories).
In each file, search for _moment.humanizeDuration or _dayjs.humanizeDuration blocks that contain a thresholds: key. The thresholds: key appears as an indented child of the humanizeDuration operator block.
For each match found:
humanizeDuration call, and line number of the thresholds key.If matches are found, present a REVIEW NEEDED report:
The following configs use
thresholdswithhumanizeDuration. In Lowdefy v5 (dayjs),thresholdsis accepted but ignored. Dayjs uses default thresholds (same as moment defaults).
For each match, show the file, line number, and the relevant YAML context. Then advise:
thresholds property can be removed since it has no effect. The output will use dayjs defaults.thresholds key is recommended for clarity, since it is now a no-op.If no matches are found, report: "No thresholds usage found. No review needed."
thresholds keys. Present findings and let the user decide.thresholds only within humanizeDuration operator blocks, not elsewhere in the config.