Web: add ESLint and component test infrastructure (jsdom + testing-library); cover barcodeScanner and exportCsv

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

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/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ệ
eslint, react, typescript

Hướng nghiên cứu

Start by reading web/vitest.config.ts and package.json to see current test setup. Add ESLint config and lint script, then run it to fix hook-dependency warnings in FileListTable.tsx and LoadConfigModal.tsx. Next, configure jsdom and @testing-library/react, writing a modal and an App keyboard test as patterns. Finally, add tests for utils/barcodeScanner.ts and utils/exportCsv.ts, and document npm test in web/README.md; done when lint and all tests pass.

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

Mô tả

code-quality enhancement frontend

The web app has vitest but effectively no safety net:

  • No ESLint — no config and no lint script anywhere in web/. That's why hook-dependency bugs (dep-less effect at FileListTable.tsx:370-377; missing browse dep at LoadConfigModal.tsx:55) were never flagged. Add eslint + typescript-eslint + eslint-plugin-react-hooks with a lint script, and wire it into pre-commit alongside ruff.
  • No component tests — vitest.config.ts runs in the default node env; no jsdom, no @testing-library/react in devDependencies. All 23 components and the 1572-line App.tsx (scan races, global keyboard handler, barcode flow, drag state) are untested. Existing tests cover only pure modules (client, configDrop, fileProperties, searchSyntax, theme, barcodeDecoder).
  • Untested pure logic that's trivially testable: utils/barcodeScanner.ts (parseBarcodeInput — the whole barcode key=value language incl. alias normalization and boolean parsing) and utils/exportCsv.ts (RFC 4180 quoting).
  • Document npm test in web/README.md (it documents build/dev only).

Suggested order: ESLint + fix its findings → jsdom/testing-library with one modal + one App keyboard test as the pattern → the two pure-logic test files.

Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
4 giờ 46 phút
Pull request đã merge (30 ngày)
55

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 falbany/ProFiles

Tất cả issue của falbany/ProFiles

Issue tương tự

Thêm issue về Python

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.