Skip to content

Commit

Permalink
more lint fixes, mostly indentaion
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Nov 11, 2020
1 parent 1b1f8c6 commit fdf51dd
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 71 deletions.
2 changes: 1 addition & 1 deletion __tests__/src/misc/Resource.remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Resource::remove', () => {
if (viewName === 'resourceTimelineDay') {
return new ResourceTimelineViewWrapper(calendar).timelineGrid.getResourceIds()
}
return new ResourceTimeGridViewWrapper(calendar).timeGrid.getResourceIds()
return new ResourceTimeGridViewWrapper(calendar).timeGrid.getResourceIds()
}
})
})
7 changes: 4 additions & 3 deletions __tests__/src/misc/resource-receiving.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,14 @@ describe('event resources', () => {
})

it('reads correctly', (done) => {
XHRMock.get(/^my-feed\.json/, (req, res) => res
.status(200)
XHRMock.get(/^my-feed\.json/, (req, res) => (
res.status(200)
.header('content-type', 'application/json')
.body(JSON.stringify([
{ id: 1, title: 'room 1' },
{ id: 2, title: 'room 2' },
])))
]))
))

let calendar = initCalendar({
resources: 'my-feed.json',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/scrollgrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ function renderScrollGrid(isLiquid: boolean, forPrint: boolean) {
</tr>
</tbody>
</table>
),
),
},
],
},
Expand Down
55 changes: 29 additions & 26 deletions __tests__/src/timeline/timeline-event-rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,43 +520,46 @@ describe('timeline event rendering', () => { // TAKE A REALLY LONG TIME B/C SO M

function getInverseBackgroundEventEdges($eventEls, canvasEl) {
expect($eventEls.length).toBeLessThan(3)

if ($eventEls.length === 2) {
if (direction === 'ltr') {
return {
left: $eventEls.eq(0).offset().left + $eventEls.eq(0).outerWidth(),
right: $eventEls.eq(1).offset().left,
}
}
return {
left: $eventEls.eq(1).offset().left + $eventEls.eq(1).outerWidth(),
right: $eventEls.eq(0).offset().left,
}
}
let $canvasEl = $(canvasEl)
let canvasLeft = $canvasEl.offset().left
let canvasRight = canvasLeft + $canvasEl.outerWidth()

if ($eventEls.length === 1) {
let eventLeft = $eventEls.offset().left
let eventRight = eventLeft + $eventEls.outerWidth()
let leftGap = eventLeft - canvasLeft
let rightGap = canvasRight - eventRight

if (leftGap > rightGap) {
return {
left: canvasLeft,
right: eventLeft,
}
}
return {
left: eventRight,
right: canvasRight,
}
return {
left: $eventEls.eq(1).offset().left + $eventEls.eq(1).outerWidth(),
right: $eventEls.eq(0).offset().left,
}
}

let $canvasEl = $(canvasEl)
let canvasLeft = $canvasEl.offset().left
let canvasRight = canvasLeft + $canvasEl.outerWidth()

if ($eventEls.length === 1) {
let eventLeft = $eventEls.offset().left
let eventRight = eventLeft + $eventEls.outerWidth()
let leftGap = eventLeft - canvasLeft
let rightGap = canvasRight - eventRight

if (leftGap > rightGap) {
return {
left: canvasLeft,
right: canvasRight,
right: eventLeft,
}
}
return {
left: eventRight,
right: canvasRight,
}
}

return {
left: canvasLeft,
right: canvasRight,
}
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion resource-common/src/common/ResourceDayHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class ResourceDayHeader extends BaseComponent<ResourceDayHeaderProps> { /
extraDataAttrs={extraDataAttrs}
/>
)
}
}

buildTr(cells: VNode[], key: string) {
let { renderIntro } = this.props
Expand Down
12 changes: 6 additions & 6 deletions resource-daygrid/src/ResourceDayTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ export class ResourceDayTable extends DateComponent<ResourceDayTableProps> {
this.slicers = mapHash(splitProps, (split, resourceId) => this.slicers[resourceId] || new DayTableSlicer())

let slicedProps = mapHash(this.slicers, (slicer, resourceId) => slicer.sliceProps(
splitProps[resourceId],
dateProfile,
nextDayThreshold,
context,
resourceDayTableModel.dayTableModel,
))
splitProps[resourceId],
dateProfile,
nextDayThreshold,
context,
resourceDayTableModel.dayTableModel,
))

this.allowAcrossResources = resourceDayTableModel.dayTableModel.colCnt === 1 // hack for EventResizing

Expand Down
10 changes: 5 additions & 5 deletions resource-daygrid/src/ResourceDayTableJoiner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export class ResourceDayTableJoiner extends VResourceJoiner<TableSeg> {
let colRanges = resourceDayTableModel.computeColRanges(seg.firstCol, seg.lastCol, resourceI)

return colRanges.map((colRange) => ({
...seg,
...colRange,
isStart: seg.isStart && colRange.isStart,
isEnd: seg.isEnd && colRange.isEnd,
}))
...seg,
...colRange,
isStart: seg.isStart && colRange.isStart,
isEnd: seg.isEnd && colRange.isEnd,
}))
}
}
12 changes: 6 additions & 6 deletions resource-timegrid/src/ResourceDayTimeCols.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ export class ResourceDayTimeCols extends DateComponent<ResourceDayTimeColsProps>
this.slicers = mapHash(splitProps, (split, resourceId) => this.slicers[resourceId] || new DayTimeColsSlicer())

let slicedProps = mapHash(this.slicers, (slicer, resourceId) => slicer.sliceProps(
splitProps[resourceId],
dateProfile,
null,
context,
dayRanges,
))
splitProps[resourceId],
dateProfile,
null,
context,
dayRanges,
))

this.allowAcrossResources = dayRanges.length === 1

Expand Down
6 changes: 3 additions & 3 deletions resource-timeline/src/ResourceTimelineViewLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export class ResourceTimelineViewLayout extends BaseComponent<ResourceTimelineVi
},
{
key: 'divider',
outerContent: (
<td className={'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded')} />
),
outerContent: (
<td className={'fc-resource-timeline-divider ' + context.theme.getClass('tableCellShaded')} />
),
},
{
key: 'timeline',
Expand Down
26 changes: 13 additions & 13 deletions scrollgrid/src/ScrollGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ export class ScrollGrid extends BaseComponent<ScrollGridProps, ScrollGridState>
return (
<tr key={sectionConfig.key} className={getSectionClassNames(sectionConfig, this.props.liquid).join(' ')}>
{sectionConfig.chunks.map((chunkConfig, i) => this.renderChunk(
sectionConfig,
sectionIndex,
colGroupStats[i],
microColGroupNodes[i],
chunkConfig,
i,
(sectionRowMaxHeights[sectionIndex] || [])[i] || [],
))}
sectionConfig,
sectionIndex,
colGroupStats[i],
microColGroupNodes[i],
chunkConfig,
i,
(sectionRowMaxHeights[sectionIndex] || [])[i] || [],
))}
</tr>
)
}
Expand Down Expand Up @@ -209,13 +209,13 @@ export class ScrollGrid extends BaseComponent<ScrollGridProps, ScrollGridState>

let overflowX: ClippedOverflowValue =
forceXScrollbars ? (isLastSection ? 'scroll' : 'scroll-hidden') :
!allowXScrolling ? 'hidden' :
(isLastSection ? 'auto' : 'scroll-hidden')
!allowXScrolling ? 'hidden' :
(isLastSection ? 'auto' : 'scroll-hidden')

let overflowY: ClippedOverflowValue =
forceYScrollbars ? (isVScrollSide ? 'scroll' : 'scroll-hidden') :
!allowYScrolling ? 'hidden' :
(isVScrollSide ? 'auto' : 'scroll-hidden')
!allowYScrolling ? 'hidden' :
(isVScrollSide ? 'auto' : 'scroll-hidden')

// it *could* be possible to reduce DOM wrappers by only doing a ClippedScroller when allowXScrolling or allowYScrolling,
// but if these values were to change, the inner components would be unmounted/remounted because of the parent change.
Expand Down Expand Up @@ -488,7 +488,7 @@ export class ScrollGrid extends BaseComponent<ScrollGridProps, ScrollGridState>
(sectionI === lastSectionI && forceXScrollbars)
? scrollbarWidth.x // use global because scroller might not have scrollbars yet but will need them in future
: 0
),
),
)
}
}
Expand Down
9 changes: 5 additions & 4 deletions timeline/src/TimelineCoords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ export class TimelineCoords { // TODO: rename to "slat" coords?
(innerCoordCache.getWidth(slotIndex) * partial)
) - outerCoordCache.originClientRect.width
}
return (
outerCoordCache.lefts[slotIndex] +
(innerCoordCache.getWidth(slotIndex) * partial)
)

return (
outerCoordCache.lefts[slotIndex] +
(innerCoordCache.getWidth(slotIndex) * partial)
)
}

// returned value is between 0 and the number of snaps
Expand Down
4 changes: 2 additions & 2 deletions timeline/src/timeline-date-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export function buildTimelineDateProfile(
let input = allOptions.slotLabelFormat
let rawFormats =
Array.isArray(input) ? input :
(input != null) ? [input] :
computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions)
(input != null) ? [input] :
computeHeaderFormats(tDateProfile, dateProfile, dateEnv, allOptions)

tDateProfile.headerFormats = rawFormats.map((rawFormat) => createFormatter(rawFormat))

Expand Down

0 comments on commit fdf51dd

Please sign in to comment.