Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add oxlint linting

Đang mở
#38 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
developer-experience

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
620
Fork
16
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của FormidableLabs/use-editable

Tất cả issue của FormidableLabs/use-editable

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.