Skip to content

Releases: sathvikc/eslint-plugin-strict-hooks

v0.2.0

09 Jun 03:08
99434bc

Choose a tag to compare

What's Changed

  • refactor(utils): extract and harden identifier- and comment-parsing logic into utils by @sathvikc in #1
  • chore(release): 0.2.0 by @sathvikc in #2

Full Changelog: https://github.com/sathvikc/eslint-plugin-strict-hooks/commits/v0.2.0

v0.1.0

30 May 22:34

Choose a tag to compare

eslint-plugin-strict-hooks

🚀 v0.1.0 – Initial Release

Adds a new ESLint rule to enforce meaningful comments when disabling react-hooks/exhaustive-deps.

✅ New Rule: require-exhaustive-deps-comment

This rule ensures developers explicitly mention which dependencies are intentionally omitted from the dependency array when disabling react-hooks/exhaustive-deps.

🔧 Valid Example

useEffect(() => {
  fetchData();
}, []); // eslint-disable-line react-hooks/exhaustive-deps -- fetchData: memoized

❌ Invalid Example

useEffect(() => {
  fetchData();
}, []); // eslint-disable-line react-hooks/exhaustive-deps

🎯 What it Detects

  • ✅ Dependencies used but not mentioned in the disable comment
  • ✅ Stale entries: variables mentioned in the comment that are no longer used
  • ✅ Empty -- comment when dependencies are omitted

🔧 Configurable Options

rules: {
  "strict-hooks/require-exhaustive-deps-comment": ["warn", {
    enabledHooks: ["useEffect", "useMemo", "useCallback"],
    requireCommentPerDependency: true,
    disabledHooks: []
  }]
}

🧠 Limitations

  • No autofix (yet)
  • Does not support destructured/memoized property tracking
  • Does not resolve shadowed identifiers

Full Changelog: https://github.com/sathvikc/eslint-plugin-strict-hooks/commits/v0.1.0