Background
Per purity.spec.diff.md, the current purity rule exempts new Date(arg) (Date constructor with arguments) from impurity detection, treating it as deterministic.
React Compiler's ValidateNoImpureValuesInRender treats all new Date() calls as impure (non-deterministic).
Current behavior
// Currently allowed by the ESLint rule (but flagged by the SPEC)
const date = new Date('2024-01-01'); // ❌ should be flagged
Expected behavior
Remove the argument-length check for new Date so that new Date(arg) is treated as impure, just like new Date().
References
- Diff report:
plugins/eslint-plugin-react-x/src/rules/purity/purity.spec.diff.md (§5 Special Cases)
- SPEC:
ValidateNoImpureValuesInRender
Priority
P0 — very low implementation cost (remove a conditional branch), high alignment benefit.
Background
Per
purity.spec.diff.md, the currentpurityrule exemptsnew Date(arg)(Date constructor with arguments) from impurity detection, treating it as deterministic.React Compiler's
ValidateNoImpureValuesInRendertreats allnew Date()calls as impure (non-deterministic).Current behavior
Expected behavior
Remove the argument-length check for
new Dateso thatnew Date(arg)is treated as impure, just likenew Date().References
plugins/eslint-plugin-react-x/src/rules/purity/purity.spec.diff.md(§5 Special Cases)ValidateNoImpureValuesInRenderPriority
P0 — very low implementation cost (remove a conditional branch), high alignment benefit.