Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add oxlint linting

Aperta
#38 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript

Direzione di ricerca

Start with src/useEditable.ts at the lines the issue cites (about 284, 325 and 519) and with the check and format scripts in package.json, which the new lint step has to join. Add a .oxlintrc.json modelled on react-live's, and decide which findings to suppress or disable. Done means npm run check runs oxlint and passes, the two cheap fixes are in, and the hooks-order change has been checked by hand in a browser since there are no tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Add oxlint linting, following react-live's setup (.oxlintrc.json, check:lint in npm run check, oxlint --fix in npm run format).

Findings

Running react-live's .oxlintrc.json against src/useEditable.ts gives about 17 findings:

Real issues, cheap to fix

  • Hooks after an early return (src/useEditable.ts:284): if (typeof navigator !== 'object') return edit; runs before two useLayoutEffect calls. Harmless in practice (the condition is fixed per environment) but violates the rules of hooks. Move the guard into the effects, or drop it, since layout effects don't run on the server anyway.
  • Unused catch binding (:325): catch (_error) → catch {}.

Real smell, but fixing it changes behavior

  • [elementRef.current!, …] deps (:519): reads a ref during render, and the hook relies on that to reattach when the element changes. A proper fix needs a callback ref or an API change. Suggest suppressing inline with an explanatory comment.

React Compiler-style rules (immutability, refs, about 8 findings)

  • These conflict with the hook's design: a mutable state object from useState(() => …) that is never set, only mutated from effects and handlers. Suggest turning these rules off for this repo.

Noise / intentional

  • exhaustive-deps / memo-dependencies: the dependency arrays are deliberately partial.
  • no-shadow (state), no-underscore-dangle (_trackStateTimestamp).

Proposal

  • Add oxlint + .oxlintrc.json based on react-live's, with the compiler-style rules off
  • Fix the two cheap issues
  • Suppress :519 inline with a comment
  • Leave the noise as warnings
  • Wire check:lint into check and oxlint --fix into format

Since there are no tests yet, verify the hooks-order change by hand in a browser.

Lingua principale
TypeScript
Stelle
620
Fork
16
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di FormidableLabs/use-editable

Tutte le issue di FormidableLabs/use-editable

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.