Skip to content

Commit

Permalink
Update eslint rule trailing-comma (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
jalal246 authored Sep 4, 2023
1 parent cd0456f commit 6ccc2cb
Show file tree
Hide file tree
Showing 95 changed files with 924 additions and 924 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DFlexParentContainer {
id: string,
DOM: HTMLElement,
originLength: number,
scroll: BoxRect
scroll: BoxRect,
) {
this.id = id;

Expand Down Expand Up @@ -97,7 +97,7 @@ class DFlexParentContainer {
// we reset and accumulate, it's inefficient. removeElmFromEdge() is a better.
register(
rect: AbstractBox,
unifiedContainerDimensions?: Dimensions
unifiedContainerDimensions?: Dimensions,
): PointNum {
if (this._siblingBoundaries) {
this._siblingBoundaries.assignBiggestBox(rect);
Expand All @@ -106,7 +106,7 @@ class DFlexParentContainer {
rect.top,
rect.right,
rect.bottom,
rect.left
rect.left,
);
}

Expand Down Expand Up @@ -144,7 +144,7 @@ class DFlexParentContainer {
if (__DEV__) {
if (this.grid[axis] < EMPTY_GRID_INDEX) {
throw new Error(
`reduceGrid: Cannot reduce grid on axis:${axis} to below ${EMPTY_GRID_INDEX}`
`reduceGrid: Cannot reduce grid on axis:${axis} to below ${EMPTY_GRID_INDEX}`,
);
}
}
Expand Down
38 changes: 19 additions & 19 deletions packages/dflex-core-instance/src/Container/DFlexScrollContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function hasOverFlow(
scrollRect: Dimensions,
scrollContainerRect: Dimensions,
axis: Axis,
checkHalf: boolean = false
checkHalf: boolean = false,
): boolean {
const dimension = getDimensionTypeByAxis(axis);
const threshold = checkHalf ? 0.5 : 1;
Expand Down Expand Up @@ -112,7 +112,7 @@ class DFlexScrollContainer {
firstELmDOM: HTMLElement,
SK: string,
branchLength: number,
scrollEventCallback: ScrollEventCallback
scrollEventCallback: ScrollEventCallback,
) {
// Callbacks.
this._SK = SK;
Expand Down Expand Up @@ -175,7 +175,7 @@ class DFlexScrollContainer {

private _initializeOrDestroyThreshold(
type: "inner" | "outer",
thresholdValue: ThresholdPercentages | null
thresholdValue: ThresholdPercentages | null,
): void {
const instance = this._thresholdInViewport[type];

Expand All @@ -195,13 +195,13 @@ class DFlexScrollContainer {
threshold.setMainThreshold(
instance.key,
this.visibleScrollRect,
type === "inner"
type === "inner",
);
}

private _updateDOMDataset(
isAttachListener: boolean,
hasScrollListener: boolean
hasScrollListener: boolean,
): void {
const datasetKey = this._listenerDatasetKey;
const datasetValue = hasScrollListener.toString();
Expand Down Expand Up @@ -246,7 +246,7 @@ class DFlexScrollContainer {
this.totalScrollRect,
this.visibleScrollRect,
axis,
checkHalf
checkHalf,
);

const hasOverflowX = checkOverflow("x");
Expand Down Expand Up @@ -278,7 +278,7 @@ class DFlexScrollContainer {
scrollTop,
scrollLeft,
scrollHeight,
scrollWidth
scrollWidth,
);

// Calculate the visible portion of the container
Expand All @@ -288,7 +288,7 @@ class DFlexScrollContainer {
scrollTop,
scrollLeft,
clientHeight,
clientWidth
clientWidth,
);
} else {
const { left, top } = this._containerDOM.getBoundingClientRect();
Expand All @@ -297,19 +297,19 @@ class DFlexScrollContainer {
top,
left,
clientHeight,
clientWidth
clientWidth,
);
}
}

private _updateScrollPosition(
scrollLeft: number,
scrollTop: number,
withDOM: boolean
withDOM: boolean,
): boolean {
const shouldUpdate = this.totalScrollRect.hasEqualPosition(
scrollLeft,
scrollTop
scrollTop,
);

if (!shouldUpdate) {
Expand All @@ -330,7 +330,7 @@ class DFlexScrollContainer {
this._updateScrollPosition(
x === -1 ? this.totalScrollRect.left : x,
y === -1 ? this.totalScrollRect.right : y,
true
true,
);

this._scrollEventCallback(this._SK);
Expand Down Expand Up @@ -369,7 +369,7 @@ class DFlexScrollContainer {
if (__DEV__) {
if (!this.hasOverflow[axis]) {
throw new Error(
`Cannot call hasScrollableArea when there is no overflow in the ${axis} direction.`
`Cannot call hasScrollableArea when there is no overflow in the ${axis} direction.`,
);
}
}
Expand Down Expand Up @@ -461,7 +461,7 @@ class DFlexScrollContainer {

getElmViewportPosition(
elmTopPos: number,
elmLeftPos: number
elmLeftPos: number,
): [number, number] {
const { top: totalScrollTop, left: totalScrollLeft } = this.totalScrollRect;

Expand All @@ -478,7 +478,7 @@ class DFlexScrollContainer {
if (absPos instanceof BoxRect) {
const [viewportTop, viewportLeft] = this.getElmViewportPosition(
absPos.top,
absPos.left
absPos.left,
);

const top = viewportTop;
Expand All @@ -496,20 +496,20 @@ class DFlexScrollContainer {
if (__DEV__) {
if (!instance) {
throw new Error(
"isElmOutViewport: _thresholdInViewport is not initialized. Please call setInnerThreshold() method before using isElmOutViewport()."
"isElmOutViewport: _thresholdInViewport is not initialized. Please call setInnerThreshold() method before using isElmOutViewport().",
);
}

if (!this.hasOverflow) {
throw new Error(
"isElmOutViewport: Scrollable element does not have overflow."
"isElmOutViewport: Scrollable element does not have overflow.",
);
}

if (this.hasOverflow.x && this.hasOverflow.y) {
// eslint-disable-next-line no-console
console.warn(
"isElmOutViewport: Scrollable element has overflow in both x and y directions.\nDFlex is not yet fully optimized to handle this scenario, and the results may be inaccurate."
"isElmOutViewport: Scrollable element has overflow in both x and y directions.\nDFlex is not yet fully optimized to handle this scenario, and the results may be inaccurate.",
);
}
}
Expand All @@ -519,7 +519,7 @@ class DFlexScrollContainer {
const isOutThreshold = threshold!.isOutThreshold(
key,
viewportPos,
this.hasOverflow.y ? "y" : "x"
this.hasOverflow.y ? "y" : "x",
);

const preservedBoxResult = threshold!.isOut[key];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const hasScrollbar = (
axis: Axis,
overflow: Overflow,
DOM: HTMLElement,
hasOverflow: PointBool
hasOverflow: PointBool,
) => {
if (OVERFLOW_REGEX.test(overflow)) {
const has = hasScrollableContent(DOM, axis);
Expand All @@ -42,7 +42,7 @@ const hasScrollbar = (
const resolveScrollProps = (
parentDOM: HTMLElement,
baseELmPosition: string,
res: ResolveScrollPropsInput
res: ResolveScrollPropsInput,
) => {
const overflowX = getElmOverflow(parentDOM, "overflow-x");
const overflowY = getElmOverflow(parentDOM, "overflow-y");
Expand All @@ -62,7 +62,7 @@ const resolveScrollProps = (
};

function getScrollContainerProperties(
baseDOMElm: HTMLElement
baseDOMElm: HTMLElement,
): GetScrollContainerRes {
const baseELmPosition = getElmPos(baseDOMElm);

Expand All @@ -79,7 +79,7 @@ function getScrollContainerProperties(
const scrollContainerDOM = getParentElm(
baseDOMElm,
(parentDOM: HTMLElement) =>
resolveScrollProps(parentDOM, baseELmPosition, res)
resolveScrollProps(parentDOM, baseELmPosition, res),
);

if (!scrollContainerDOM || baseELmPosition === "fixed") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DFlexBaseElement {
setAttribute(
DOM: HTMLElement,
key: AllowedAttributes,
value: string | number
value: string | number,
): void {
if (key === "INDEX") {
DOM.setAttribute(DFLEX_ATTRIBUTES[key], `${value}`);
Expand Down
Loading

0 comments on commit 6ccc2cb

Please sign in to comment.