chore: add ESLint with react-hooks - #60
Merged
Merged
Conversation
`npm run lint` was `prettier --check .` — formatting only, no static analysis at all. That matters here specifically because ImageEditor.tsx runs hand-tuned effect dependency arrays and reads current values through latestPropsRef instead of listing them as deps. Those are correct by design, but nothing recorded that or would catch a future accidental omission. Flat config with typescript-eslint, eslint-plugin-react-hooks and eslint-config-prettier. Two findings, both real: - The updatable-options effect legitimately omits theme/locale/translations because updatableKey is already a digest of them. Now carries an explicit disable with the reason written down. - A rest-destructure in the tests tripped no-unused-vars; ignoreRestSiblings is the idiomatic setting for omit-by-destructuring. exhaustive-deps is set to error rather than warn, so omitting a dependency requires a written justification instead of passing silently.
|
@sidgaikwad is attempting to deploy a commit to the Unlayer Team on Vercel. A member of the Team first needs to authorize it. |
ivoIturrieta
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #38.
npm run lintwasprettier --check .— formatting only, no static analysis anywhere in the repo or CI.Why this one matters here
ImageEditor.tsxdeliberately runs hand-tuned effect dependency arrays, reading current values throughlatestPropsRefrather than listing them as deps. Correct by design — the whole serialized-chain architecture depends on not remounting when those change — but nothing recorded that at the call site, and nothing would catch a future accidental omission.What ESLint found
Enabling it surfaced exactly two things, both real, and nothing else:
1.
react-hooks/exhaustive-depson the updatable-options effect — the case the issue predicted. It legitimately omitstheme/locale/translationsbecauseupdatableKeyis already a stable digest of them; listing them too would re-run the effect on every unrelated identity change oftranslationswithout changing what gets applied. Now carries an expliciteslint-disable-next-linewith that reason written down.2.
@typescript-eslint/no-unused-varson a rest-destructure in the tests —const { container, image, ...passedThrough } = receivedis the idiomatic way to omit keys; the named bindings are the point. Fixed withignoreRestSiblings: true, a config setting rather than a code change.Set to error, not warn
exhaustive-depsdefaults to a warning. I set it to error so omitting a dependency requires a written justification rather than passing silently — which is the entire value of adding it to this codebase.Proof it's live — I removed
imagefrom a dep array that genuinely needs it:Notes
eslint.config.mjs, not.js— the package is"type": "commonjs".eslint-config-prettieris last, so ESLint and Prettier can't fight.lintis noweslint . && prettier --check ., so CI picks it up with no workflow change.src/,test/and configs;demo/can follow separately.no-consoleis configured to match the CONTRIBUTING rule (allowsinfo/warn/error).Lint, typecheck, tests (50, 100% coverage) and build all clean.