Skip to content

[meta] Support dual-location diagnostics to align with React Compiler reporting style #1765

@Rel1cx

Description

@Rel1cx

Background

Across multiple diff reports (immutability, purity, static-components), React Compiler SPECs consistently provide dual-location diagnostics: reporting both the usage site (frozen/render context) and the source site (mutation / impure call / dynamic creation).

Current ESLint rules report only a single location.

Example comparison

// Compiler: reports both the useMemo call site and the Date.now() call site
// ESLint:   reports only the Date.now() call site
const now = Date.now();
return <div>{now}</div>;

Expected behavior

Explore feasibility of dual-location reporting within ESLint architecture (using context.report({ loc: [...], ... }), suggest, or data fields), and pilot it in purity and immutability rules.

Affected rules

  • purity
  • immutability

Note: static-components is excluded because it already supports dual-location reporting (see static-components.spec.diff.md §6).

References

  • purity.spec.diff.md (§3)
  • immutability.spec.diff.md (§5)
  • static-components.spec.diff.md (§6)

Priority

P3 — high implementation cost (architectural change), but significant UX improvement. Best suited for long-term planning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions