original parserOptions not getting passed to traversed files. Intentional?
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
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, react
- Lĩnh vực
- documentation, tooling
Hướng nghiên cứu
Bắt đầu tại src/importer/makeFsImporter.js, khoảng dòng 70, và theo dõi cách parserOptions được xử lý đối với các tệp được duyệt so với lệnh gọi parse ban đầu. Xác nhận hành vi bằng các kiểu Flow được import; hoàn tất khi các tùy chọn parser dự định được áp dụng nhất quán hoặc issue ghi lại lý do chúng phải được đặt lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm using react-docgen@next on a project that uses Flow, and I'm utilizing the new makeFsImporter importer to be able to parse imported types. Here's my setup:
value = docgen.parse(source, null, null, {
importer: docgen.importers.makeFsImporter(),
filename: path,
parserOptions: {
plugins: [
'jsx',
'flow',
'nullishCoalescingOperator',
'objectRestSpread',
'optionalCatchBinding',
'optionalChaining',
'classProperties',
'classPrivateProperties',
'classPrivateMethods',
],
},
});
I am passing parserOptions because the .babelrc that react-docgen finds is not the one I want it to use (it doesn't contain the flow plugin). I noticed that the parserOptions get applied correctly to the original file, but for other files that are traversed, parserOptions are ignored:
https://github.com/reactjs/react-docgen/blob/master/src/importer/makeFsImporter.js#L70
This causes a SyntaxError when traversed files with imported types are parsed because it reverts to the .babelrc that I was avoiding by specifying parserOptions.plugins.
Is the line in makeFsImporter that sets parserOptions: {} intentional? Or can it be removed so that parserOptions specified in the original parse call are applied to other files? I'm happy to open a PR if so.
EDIT: I found a similar question asked when this code was introduced: https://github.com/reactjs/react-docgen/pull/352/files/8c0a15fcae4053b1d2115bd7dbd24252cf70b228#r287538448.
- Ngôn ngữ chính
- TypeScript
- Star
- 3.8k
- Fork
- 316
- Merge trung bình
- 3 giờ 28 phút
- Pull request đã merge (30 ngày)
- 6
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của reactjs/react-docgen
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
reactjs/react-docgen#1102 ·
-
Typescript Status Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
reactjs/react-docgen#1005 · 4 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
reactjs/react-docgen#997 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
reactjs/react-docgen#994 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
reactjs/react-docgen#982 · 2 bình luận ·
Tất cả issue của reactjs/react-docgen
Issue tương tự
-
comp/desktop P3 type/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
NousResearch/hermes-agent#118866 ·
-
Browser Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
getsentry/sentry-javascript#24577 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
agilepathway/label-checker#640 ·
-
Plugin stuck at "loading" on DSH 0.1.6-alpha.2 — turnTail list slot registration missing options.id Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Add 2021 Cup data to website Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
chrisparsons83/flexspotff#153 ·