mirror of
https://github.com/mathuo/dockview
synced 2025-05-03 01:58:26 +00:00
Merge pull request #78 from mathuo/77-fix-sonar-code-smells-from-new-rule
chore: fix sonar code smells
This commit is contained in:
commit
f852f2f97c
@ -43,7 +43,7 @@ export abstract class DragHandler extends CompositeDisposable {
|
||||
event.dataTransfer.effectAllowed = 'move';
|
||||
}
|
||||
}),
|
||||
addDisposableListener(this.el, 'dragend', (ev) => {
|
||||
addDisposableListener(this.el, 'dragend', () => {
|
||||
for (const iframe of this.iframes) {
|
||||
iframe.style.pointerEvents = 'auto';
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ export class Droptarget extends CompositeDisposable {
|
||||
this.addDisposables(
|
||||
this._onDrop,
|
||||
new DragAndDropObserver(this.element, {
|
||||
onDragEnter: (e) => undefined,
|
||||
onDragEnter: () => undefined,
|
||||
onDragOver: (e) => {
|
||||
if (isBooleanValue(this.options.canDisplayOverlay)) {
|
||||
if (!this.options.canDisplayOverlay) {
|
||||
@ -115,10 +115,10 @@ export class Droptarget extends CompositeDisposable {
|
||||
|
||||
this.setState(quadrant);
|
||||
},
|
||||
onDragLeave: (e) => {
|
||||
onDragLeave: () => {
|
||||
this.removeDropTarget();
|
||||
},
|
||||
onDragEnd: (e) => {
|
||||
onDragEnd: () => {
|
||||
this.removeDropTarget();
|
||||
},
|
||||
onDrop: (e) => {
|
||||
|
@ -154,7 +154,7 @@ export class DefaultTab extends CompositeDisposable implements ITabRenderer {
|
||||
this.render();
|
||||
}
|
||||
|
||||
public layout(width: number, height: number) {
|
||||
public layout(_width: number, _height: number) {
|
||||
// noop
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,8 @@ import { PanelUpdateEvent } from '../../../panel/types';
|
||||
|
||||
export class Watermark
|
||||
extends CompositeDisposable
|
||||
implements IWatermarkRenderer {
|
||||
implements IWatermarkRenderer
|
||||
{
|
||||
private _element: HTMLElement;
|
||||
private group: GroupviewPanel | undefined;
|
||||
private params: GroupPanelPartInitParameters | undefined;
|
||||
@ -56,7 +57,7 @@ export class Watermark
|
||||
);
|
||||
}
|
||||
|
||||
update(event: PanelUpdateEvent) {
|
||||
update(_event: PanelUpdateEvent) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ export class Watermark
|
||||
return {};
|
||||
}
|
||||
|
||||
layout(width: number, height: number) {
|
||||
layout(_width: number, _height: number) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@ -76,7 +77,7 @@ export class Watermark
|
||||
this.params = params;
|
||||
|
||||
this.addDisposables(
|
||||
this.params.containerApi.onDidLayoutChange((event) => {
|
||||
this.params.containerApi.onDidLayoutChange(() => {
|
||||
this.render();
|
||||
})
|
||||
);
|
||||
@ -84,7 +85,7 @@ export class Watermark
|
||||
this.render();
|
||||
}
|
||||
|
||||
updateParentGroup(group: GroupviewPanel, visible: boolean): void {
|
||||
updateParentGroup(group: GroupviewPanel, _visible: boolean): void {
|
||||
this.group = group;
|
||||
this.render();
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ export class BranchNode extends CompositeDisposable implements IView {
|
||||
|
||||
this._childrenDisposable = Event.any(
|
||||
...this.children.map((c) => c.onDidChange)
|
||||
)((e) => {
|
||||
)(() => {
|
||||
/**
|
||||
* indicate a change has occured to allows any re-rendering but don't bubble
|
||||
* event because that was specific to this branch
|
||||
|
@ -644,7 +644,7 @@ export class Gridview implements IDisposable {
|
||||
const isSiblingVisible = parent.isChildVisible(0);
|
||||
parent.removeChild(0, sizing);
|
||||
|
||||
const sizes = grandParent.children.map((size, i) =>
|
||||
const sizes = grandParent.children.map((_size, i) =>
|
||||
grandParent.getChildSize(i)
|
||||
);
|
||||
grandParent.removeChild(parentIndex, sizing);
|
||||
|
@ -169,7 +169,7 @@ export class GridviewComponent
|
||||
}
|
||||
|
||||
setActive(panel: GridviewPanel): void {
|
||||
this._groups.forEach((value, key) => {
|
||||
this._groups.forEach((value, _key) => {
|
||||
value.value.setActive(panel === value.value);
|
||||
});
|
||||
}
|
||||
|
@ -342,11 +342,11 @@ export class Groupview extends CompositeDisposable implements IGroupview {
|
||||
return this.panels.includes(panel);
|
||||
}
|
||||
|
||||
init(params: PanelInitParameters) {
|
||||
init(_params: PanelInitParameters) {
|
||||
//noop
|
||||
}
|
||||
|
||||
update(params: PanelUpdateEvent) {
|
||||
update(_params: PanelUpdateEvent) {
|
||||
//noop
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ export class ContentContainer
|
||||
this.disposable.value = disposable;
|
||||
}
|
||||
|
||||
public layout(width: number, height: number): void {
|
||||
public layout(_width: number, _height: number): void {
|
||||
// noop
|
||||
}
|
||||
|
||||
|
@ -42,10 +42,10 @@ export class HostedContainer implements IDisposable {
|
||||
* When dragging somebody
|
||||
*/
|
||||
|
||||
window.addEventListener('dragstart', (ev) => {
|
||||
window.addEventListener('dragstart', () => {
|
||||
this.element.style.pointerEvents = 'none';
|
||||
});
|
||||
window.addEventListener('dragend', (ev) => {
|
||||
window.addEventListener('dragend', () => {
|
||||
this.element.style.pointerEvents = '';
|
||||
});
|
||||
window.addEventListener('mousemove', (ev) => {
|
||||
@ -73,7 +73,8 @@ export class HostedContainer implements IDisposable {
|
||||
return;
|
||||
}
|
||||
const frameRect = element.getBoundingClientRect();
|
||||
const containerRect = this.element.parentElement.getBoundingClientRect();
|
||||
const containerRect =
|
||||
this.element.parentElement.getBoundingClientRect();
|
||||
this.element.style.position = 'absolute';
|
||||
this.element.style.top = `${frameRect.top - containerRect.top}px`;
|
||||
this.element.style.left = `${frameRect.left - containerRect.left}px`;
|
||||
|
@ -47,7 +47,7 @@ export class DefaultHeader
|
||||
});
|
||||
}
|
||||
|
||||
update(params: PanelUpdateEvent) {
|
||||
update(_params: PanelUpdateEvent) {
|
||||
//
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ export abstract class DraggablePaneviewPanel extends PaneviewPanel {
|
||||
|
||||
this.target = new Droptarget(this.element, {
|
||||
validOverlays: 'vertical',
|
||||
canDisplayOverlay: (event: DragEvent) => {
|
||||
canDisplayOverlay: () => {
|
||||
const data = getPaneData();
|
||||
|
||||
if (!data) {
|
||||
|
@ -73,7 +73,7 @@ export class Paneview extends CompositeDisposable implements IDisposable {
|
||||
|
||||
// if we've added views from the descriptor we need to
|
||||
// add the panes to our Pane array and setup animation
|
||||
this.getPanes().forEach((pane, index) => {
|
||||
this.getPanes().forEach((pane) => {
|
||||
const disposable = new CompositeDisposable(
|
||||
pane.onDidChangeExpansionState(() => {
|
||||
this.setupAnimation();
|
||||
|
@ -79,7 +79,7 @@ export const DockviewReact = React.forwardRef(
|
||||
const factory: GroupPanelFrameworkComponentFactory = {
|
||||
content: {
|
||||
createComponent: (
|
||||
id: string,
|
||||
_id: string,
|
||||
componentId: string,
|
||||
component: React.FunctionComponent<IDockviewPanelProps>
|
||||
): IContentRenderer => {
|
||||
@ -94,7 +94,7 @@ export const DockviewReact = React.forwardRef(
|
||||
},
|
||||
tab: {
|
||||
createComponent: (
|
||||
id: string,
|
||||
_id: string,
|
||||
componentId: string,
|
||||
component: React.FunctionComponent<IDockviewPanelHeaderProps>
|
||||
): ITabRenderer => {
|
||||
@ -109,7 +109,7 @@ export const DockviewReact = React.forwardRef(
|
||||
},
|
||||
watermark: {
|
||||
createComponent: (
|
||||
id: string,
|
||||
_id: string,
|
||||
componentId: string,
|
||||
component: React.FunctionComponent<{}>
|
||||
) => {
|
||||
|
@ -32,8 +32,6 @@ export class ReactPanelContentPart implements IContentRenderer {
|
||||
private actionsPart?: ReactPart<any>;
|
||||
private _group: GroupviewPanel | undefined;
|
||||
|
||||
// private hostedContainer: HostedContainer;
|
||||
|
||||
private readonly _onDidFocus = new Emitter<void>();
|
||||
readonly onDidFocus: Event<void> = this._onDidFocus.event;
|
||||
|
||||
@ -56,13 +54,6 @@ export class ReactPanelContentPart implements IContentRenderer {
|
||||
this._element = document.createElement('div');
|
||||
this._element.className = 'dockview-react-part';
|
||||
|
||||
// this.hostedContainer = new HostedContainer({
|
||||
// id,
|
||||
// });
|
||||
|
||||
// this.hostedContainer.onDidFocus(() => this._onDidFocus.fire());
|
||||
// this.hostedContainer.onDidBlur(() => this._onDidBlur.fire());
|
||||
|
||||
this._actionsElement = document.createElement('div');
|
||||
this._actionsElement.className = 'dockview-react-part';
|
||||
}
|
||||
@ -104,17 +95,13 @@ export class ReactPanelContentPart implements IContentRenderer {
|
||||
|
||||
public updateParentGroup(
|
||||
group: GroupviewPanel,
|
||||
isPanelVisible: boolean
|
||||
_isPanelVisible: boolean
|
||||
): void {
|
||||
this._group = group;
|
||||
}
|
||||
|
||||
public layout(width: number, height: number): void {
|
||||
public layout(_width: number, _height: number): void {
|
||||
// noop
|
||||
// this.hostedContainer.layout(
|
||||
// this.element
|
||||
// // { width, height }
|
||||
// );
|
||||
}
|
||||
|
||||
public close(): Promise<boolean> {
|
||||
@ -125,7 +112,6 @@ export class ReactPanelContentPart implements IContentRenderer {
|
||||
this._onDidFocus.dispose();
|
||||
this._onDidBlur.dispose();
|
||||
this.part?.dispose();
|
||||
// this.hostedContainer?.dispose();
|
||||
this.actionsPart?.dispose();
|
||||
}
|
||||
}
|
||||
|
@ -73,11 +73,11 @@ export class ReactWatermarkPart implements IWatermarkRenderer {
|
||||
};
|
||||
}
|
||||
|
||||
layout(width: number, height: number) {
|
||||
layout(_width: number, _height: number) {
|
||||
// noop - retrieval from api
|
||||
}
|
||||
|
||||
updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean): void {
|
||||
updateParentGroup(group: GroupviewPanel, _isPanelVisible: boolean): void {
|
||||
// noop - retrieval from api
|
||||
this._groupRef.value = group;
|
||||
}
|
||||
|
@ -90,12 +90,12 @@ export class ReactContentRenderer implements IContentRenderer {
|
||||
|
||||
public updateParentGroup(
|
||||
group: GroupviewPanel,
|
||||
isPanelVisible: boolean
|
||||
_isPanelVisible: boolean
|
||||
): void {
|
||||
this._group = group;
|
||||
}
|
||||
|
||||
public layout(width: number, height: number): void {
|
||||
public layout(_width: number, _height: number): void {
|
||||
this._hostedContainer.layout(this.element);
|
||||
}
|
||||
|
||||
|
@ -43,13 +43,13 @@ export class WebviewContentRenderer implements IContentRenderer {
|
||||
}
|
||||
|
||||
public updateParentGroup(
|
||||
group: GroupviewPanel,
|
||||
isPanelVisible: boolean
|
||||
_group: GroupviewPanel,
|
||||
_isPanelVisible: boolean
|
||||
): void {
|
||||
//
|
||||
}
|
||||
|
||||
public layout(width: number, height: number): void {
|
||||
public layout(_width: number, _height: number): void {
|
||||
this._hostedContainer.layout(this._element);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ export const PaneviewReact = React.forwardRef(
|
||||
React.useEffect(() => {
|
||||
const createComponent = (
|
||||
id: string,
|
||||
componentId: string,
|
||||
_componentId: string,
|
||||
component: any
|
||||
) =>
|
||||
new PanePanelSection(id, component, {
|
||||
|
Loading…
Reference in New Issue
Block a user