[BUG]: Cannot resolve `Lib.*` and `Drawing.*` methods

Đang mở
#8,060 4 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
72/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
developer-experience

Hướng nghiên cứu

Review src/lib/index.js and src/components/drawing/index.js, then inspect src/plots/cartesian/transition_axes.js for the reported unresolved symbols. Reproduce the PyCharm warnings and check whether the same export pattern affects other modules. Done when the reported Lib., Drawing., setTranslate, and setScale references resolve without changing runtime behavior.

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

Mô tả

bug P3 plotly-internal size: 1

PyCharm reports methods imported from https://github.com/plotly/plotly.js/blob/main/src/lib/index.js as unresolved, for example:

var Lib = require('../../lib');

Lib.coerce(...)
Lib.coerceSelectionMarkerOpacity(...)

I get:

Unresolved function or method `coerce()`
Unresolved function or method `coerceSelectionMarkerOpacity()`

This makes development difficult because IDE navigation to the lib methods does not work.

The issue comes from this assignment:
https://github.com/plotly/plotly.js/blob/f618df5fe66945df1a165d04dfe19b91f724f927/src/lib/index.js#L13

The static analysis doesn't like it.

Changing it to:

- var lib = (module.exports = {});
+ module.exports = {};
+ var lib = module.exports;

allows PyCharm (or maybe other IDEs?) to correctly resolve the exported methods.

The same problem also occurs in:
https://github.com/plotly/plotly.js/blob/f618df5fe66945df1a165d04dfe19b91f724f927/src/components/drawing/index.js#L23

For:
https://github.com/plotly/plotly.js/blob/f618df5fe66945df1a165d04dfe19b91f724f927/src/plots/cartesian/transition_axes.js#L41-L42

I get:

Unresolved variable setTranslate 
Unresolved variable setScale

And there are more.

Ngôn ngữ chính
JavaScript
Star
18.3k
Fork
2k
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
30

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 plotly/plotly.js

Tất cả issue của plotly/plotly.js

Issue tương tự

Thêm issue về JavaScript

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.