Skip to content

Commit 8dee069

Browse files
committed
lint cleanup
1 parent 4e661d9 commit 8dee069

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

.eslintrc.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ module.exports = {
1616
rules: {
1717
'indent': ['error', 2],
1818
'max-len': ['error', 180],
19-
'no-trailing-spaces': 'error',
19+
'no-trailing-spaces': 1,
2020
'prefer-const': 0,
2121
'@typescript-eslint/ban-ts-comment': 0,
22+
'max-len': 0
2223
}
2324
};

src/gridstack-engine.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ export class GridStackEngine {
814814
if (column < prevColumn) this.cacheLayout(this.nodes, prevColumn);
815815
this.batchUpdate(); // do this EARLY as it will call saveInitial() so we can detect where we started for _dirty and collision
816816
let newNodes: GridStackNode[] = [];
817-
817+
818818
// if we're going to 1 column and using DOM order (item passed in) rather than default sorting, then generate that layout
819819
let domOrder = false;
820820
if (column === 1 && nodes?.length) {
@@ -910,7 +910,7 @@ export class GridStackEngine {
910910
delete node._orig; // make sure the commit doesn't try to restore things back to original
911911
});
912912
}
913-
913+
914914
this.nodes.forEach(n => delete n._orig); // clear _orig before batch=false so it doesn't handle float=true restore
915915
this.batchUpdate(false, !doCompact);
916916
delete this._inColumnResize;

src/gridstack.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ export class GridStack {
823823
* re-layout grid items to reclaim any empty space. Options are:
824824
* 'list' keep the widget left->right order the same, even if that means leaving an empty slot if things don't fit
825825
* 'compact' might re-order items to fill any empty space
826-
*
826+
*
827827
* doSort - 'false' to let you do your own sorting ahead in case you need to control a different order. (default to sort)
828828
*/
829829
public compact(layout: CompactOptions = 'compact', doSort = true): GridStack {
@@ -1264,7 +1264,7 @@ export class GridStack {
12641264
this.engine.endUpdate();
12651265
}
12661266

1267-
/**
1267+
/**
12681268
* Updates widget height to match the content height to avoid v-scrollbar or dead space.
12691269
* Note: this assumes only 1 child under resizeToContentParent='.grid-stack-item-content' (sized to gridItem minus padding) that is at the entire content size wanted.
12701270
* useAttrSize set to true if GridStackNode.h should be used instead of actual container height when we don't need to wait for animation to finish to get actual DOM heights
@@ -1294,7 +1294,7 @@ export class GridStack {
12941294
} else {
12951295
// NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
12961296
const child = item.firstElementChild;
1297-
if (!child) { console.log(`Error: resizeToContent() '${GridStack.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`); return; }
1297+
if (!child) { console.log(`Error: resizeToContent() '${GridStack.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`); return; }
12981298
wantedH = child.getBoundingClientRect().height || itemH;
12991299
}
13001300
if (itemH === wantedH) return;
@@ -1320,7 +1320,7 @@ export class GridStack {
13201320
if (GridStack.resizeToContentCB) GridStack.resizeToContentCB(el, useAttr);
13211321
else this.resizeToContent(el, useAttr);
13221322
}
1323-
1323+
13241324
/**
13251325
* Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options (CSS string format of 1,2,4 values or single number).
13261326
* @param value margin value
@@ -1678,10 +1678,10 @@ export class GridStack {
16781678
private doContentResize(delay = true, useAttr = false, n: GridStackNode = undefined) {
16791679
// update any gridItem height with sizeToContent, but wait for DOM $animation_speed to settle if we changed column count
16801680
// TODO: is there a way to know what the final (post animation) size of the content will be so we can animate the column width and height together rather than sequentially ?
1681-
setTimeout(() => {
1682-
if (n) {
1681+
setTimeout(() => {
1682+
if (n) {
16831683
if (Utils.shouldSizeToContent(n)) this.resizeToContentCheck(n.el, useAttr);
1684-
} else if (this.engine.nodes.some(n => Utils.shouldSizeToContent(n))) {
1684+
} else if (this.engine.nodes.some(n => Utils.shouldSizeToContent(n))) {
16851685
const nodes = [...this.engine.nodes]; // in case order changes while resizing one
16861686
this.batchUpdate();
16871687
nodes.forEach(n => {
@@ -1703,7 +1703,7 @@ export class GridStack {
17031703

17041704
if (!forceRemove && trackSize && !this.resizeObserver) {
17051705
this._sizeThrottle = Utils.throttle(() => this.onResize(), this.opts.cellHeightThrottle);
1706-
this.resizeObserver = new ResizeObserver(entries => this._sizeThrottle());
1706+
this.resizeObserver = new ResizeObserver(() => this._sizeThrottle());
17071707
this.resizeObserver.observe(this.el);
17081708
this._skipInitialResize = true; // makeWidget will originally have called on startup
17091709
} else if ((forceRemove || !trackSize) && this.resizeObserver) {

src/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const dragInDefaultOptions: DDDragInOpt = {
5050
// scroll: false,
5151
};
5252

53-
/**
53+
/**
5454
* different layout options when changing # of columns, including a custom function that takes new/old column count, and array of new/old positions
5555
* Note: new list may be partially already filled if we have a cache of the layout at that size and new items were added later.
5656
* Options are:
@@ -321,7 +321,7 @@ export interface GridStackWidget extends GridStackPosition {
321321
id?: string;
322322
/** html to append inside as content */
323323
content?: string;
324-
/** local (vs grid) override - see GridStackOptions.
324+
/** local (vs grid) override - see GridStackOptions.
325325
* Note: This also allow you to set a maximum h value (but user changeable during normal resizing) to prevent unlimited content from taking too much space (get scrollbar) */
326326
sizeToContent?: boolean | number;
327327
/** local override of GridStack.resizeToContentParent that specify the class to use for the parent (actual) vs child (wanted) height */

0 commit comments

Comments
 (0)