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

Abierto
#8,060 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
javascript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
JavaScript
Estrellas
18.3k
Forks
2k
Merge medio
2 d 10 h
PR fusionados (30 d)
30

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de plotly/plotly.js

Todos los issues de plotly/plotly.js

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.