google / neuroglancer

WebGL-based viewer for volumetric data
Apache License 2.0
1.03k stars 286 forks source link

fix(ui/side_panel) biome linter broke drag end handler #527

Closed chrisj closed 5 months ago

chrisj commented 5 months ago
  ✖ Avoid the delete operator which can impact performance.

    282 │   endDrag() {
  > 283 │     delete this.element.dataset.neuroglancerSidePanelDrag;
        │     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    284 │     this.dragSource = undefined;
    285 │   }

  ℹ Unsafe fix: Use an undefined assignment instead.

    281 281 │   
    282 282 │     endDrag() {
    283     │ - ····delete·this.element.dataset.neuroglancerSidePanelDrag;
        283 │ + ····this.element.dataset.neuroglancerSidePanelDrag·=·undefined;
    284 284 │       this.dragSource = undefined;
    285 285 │     }

Using undefined causes the data attribute to remain as data-neuroglancer-side-panel-drag="undefined" which still triggers the [data-neuroglancer-side-panel-drag] css property which makes the neuroglancer-side-panel-drop-zone block pointer events.

I created an issue on biome https://github.com/biomejs/biome/issues/1765 We could disable noDelete for now or change the code to this.element.removeAttribute('data-neuroglancer-side-panel-drag');

Side note, I added a comment to my AnnotationLayerView PR that might have been unnoticed (in code comment thread) https://github.com/google/neuroglancer/pull/504#discussion_r1474836341

jbms commented 5 months ago

Thanks for catching this --- please just disable this lint in biome.json. Given the large number of lint fixes I failed to adequately check them all.

chrisj commented 5 months ago

Done