Skip to content

refactor: Fix unresolved Lib.* and Drawing.* methods in PyCharm/ VS Code - #8061

Merged
camdecoster merged 4 commits into
plotly:mainfrom
Lexachoc:fix-lib-resolve
Sep 22, 2026
Merged

camdecoster merged 4 commits into
plotly:mainfrom
Lexachoc:fix-lib-resolve

Conversation

@Lexachoc

@Lexachoc Lexachoc commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Closes #8060

This may also affect other IDEs, but I only use PyCharm/ VS Code, so it would be helpful if others could confirm.

The same problem also occurs in:

var drawing = (module.exports = {});


Ther are more similar issues when running PyCharm's Unresolved reference inspection.

For example:

var annotationAttrs = require('../../components/annotations/attributes');

arrowsize: extendFlat({}, annotationAttrs.arrowsize, {

I get:

Unresolved variable arrowsize

In this case, annotations/attributes.js exports the attributes by:

module.exports = templatedArray('annotation', {

PyCharm doesn't like that.
Making the export more explicit would require a somewhat larger refactor, for example:

- module.exports = templatedArray('annotation', {
+ var attrs = {
      visible: {
          // ...
      },
      // ...
- });
+ };
+ 
+ templatedArray('annotation', attrs);
+ 
+ module.exports = attrs;

Therefore I didn't include fix for these cases in this PR.

@Lexachoc

Copy link
Copy Markdown
Contributor Author

I don't have permission to add the no-draftlog label. If draftlog is not needed, could someone add it for me?

Refactor module exports in drawing component
@Lexachoc Lexachoc changed the title Fix unresolved Lib.* methods in PyCharm Fix unresolved Lib.* and Drawing.* methods in PyCharm Sep 21, 2026
@Lexachoc Lexachoc changed the title Fix unresolved Lib.* and Drawing.* methods in PyCharm Fix unresolved Lib.* and Drawing.* methods in PyCharm/ VS Code Sep 21, 2026
@camdecoster camdecoster self-assigned this Sep 21, 2026
@camdecoster camdecoster added the no-draftlog The associated PR doesn't require a draftlog and the CI check will be skipped. label Sep 21, 2026

@camdecoster camdecoster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big DX improvement! Could you please update your changes to make static analysis compatible with TS 7? Also, could you update src/components/modebar/buttons.js with the same type of fix?

Comment thread src/components/drawing/index.js Outdated
Comment thread src/lib/index.js Outdated
Lexachoc and others added 2 commits September 22, 2026 14:39
Co-authored-by: Cameron DeCoster <cameron.decoster@gmail.com>
@camdecoster camdecoster changed the title Fix unresolved Lib.* and Drawing.* methods in PyCharm/ VS Code refactor: Fix unresolved Lib.* and Drawing.* methods in PyCharm/ VS Code Sep 22, 2026
@camdecoster
camdecoster merged commit eb07ebc into plotly:main Sep 22, 2026
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-draftlog The associated PR doesn't require a draftlog and the CI check will be skipped.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants