diff --git a/adminSiteClient/GrapherConfigGridEditor.tsx b/adminSiteClient/GrapherConfigGridEditor.tsx index 58cf42812cb..4c7ae6f7cfa 100644 --- a/adminSiteClient/GrapherConfigGridEditor.tsx +++ b/adminSiteClient/GrapherConfigGridEditor.tsx @@ -1341,7 +1341,7 @@ export class GrapherConfigGridEditor extends React.Component PAGEING_SIZE && this.desiredPagingOffset >= PAGEING_SIZE ) - this.desiredPagingOffset = this.desiredPagingOffset - PAGEING_SIZE + this.desiredPagingOffset -= PAGEING_SIZE } @action.bound @@ -1350,7 +1350,7 @@ export class GrapherConfigGridEditor extends React.Component PAGEING_SIZE && this.desiredPagingOffset + PAGEING_SIZE < (this.numTotalRows ?? 0) ) { - this.desiredPagingOffset = this.desiredPagingOffset + PAGEING_SIZE + this.desiredPagingOffset += PAGEING_SIZE } } diff --git a/adminSiteServer/chartConfigHelpers.ts b/adminSiteServer/chartConfigHelpers.ts index 66146df8358..970357d2115 100644 --- a/adminSiteServer/chartConfigHelpers.ts +++ b/adminSiteServer/chartConfigHelpers.ts @@ -90,7 +90,7 @@ export const saveNewChartConfigInDbAndR2 = async ( patchConfig: GrapherInterface, fullConfig: GrapherInterface ) => { - chartConfigId = chartConfigId ?? (uuidv7() as Base64String) + chartConfigId ??= uuidv7() as Base64String await knex(ChartConfigsTableName).insert({ id: chartConfigId, diff --git a/adminSiteServer/testPageRouter.tsx b/adminSiteServer/testPageRouter.tsx index 3db12a31799..2ac528a2fcc 100644 --- a/adminSiteServer/testPageRouter.tsx +++ b/adminSiteServer/testPageRouter.tsx @@ -152,12 +152,12 @@ async function propsFromQueryParams( if (params.type) { if (params.type === GRAPHER_MAP_TYPE) { query = query.andWhereRaw(`cc.full->>"$.hasMapTab" = "true"`) - tab = tab || GRAPHER_TAB_OPTIONS.map + tab ||= GRAPHER_TAB_OPTIONS.map } else { query = query.andWhereRaw(`cc.chartType = :type`, { type: params.type, }) - tab = tab || GRAPHER_TAB_OPTIONS.chart + tab ||= GRAPHER_TAB_OPTIONS.chart } } diff --git a/db/migration/1661264304751-MigrateSelectedData.ts b/db/migration/1661264304751-MigrateSelectedData.ts index c7ae5880ac4..64abe5fc43c 100644 --- a/db/migration/1661264304751-MigrateSelectedData.ts +++ b/db/migration/1661264304751-MigrateSelectedData.ts @@ -67,8 +67,7 @@ export class MigrateSelectedData1661264304751 implements MigrationInterface { if (item.entityId && item.color) { // migrate entity color if (!legacyConfig.selectedEntityColors) { - newConfig.selectedEntityColors = - newConfig.selectedEntityColors ?? {} + newConfig.selectedEntityColors ??= {} const entityName = entityNameById[item.entityId] if (entityName) { newConfig.selectedEntityColors[entityName] ??= @@ -79,7 +78,7 @@ export class MigrateSelectedData1661264304751 implements MigrationInterface { // migrate dimension color const dimension = newConfig.dimensions?.[item.index] if (dimension?.variableId) { - dimension.display = dimension.display ?? {} + dimension.display ??= {} dimension.display.color ??= item.color } } diff --git a/db/model/Gdoc/htmlToEnriched.ts b/db/model/Gdoc/htmlToEnriched.ts index f9efd760691..0d3e555a6bf 100644 --- a/db/model/Gdoc/htmlToEnriched.ts +++ b/db/model/Gdoc/htmlToEnriched.ts @@ -438,7 +438,7 @@ export function adjustHeadingLevels( const correction = isEntry ? minHeadingLevel - 1 : Math.max(0, minHeadingLevel - 2) - block.level = block.level - correction + block.level -= correction } else if ("children" in block) { adjustHeadingLevels( block.children as OwidEnrichedGdocBlock[], diff --git a/packages/@ourworldindata/core-table/src/CoreTable.ts b/packages/@ourworldindata/core-table/src/CoreTable.ts index 9f4a51ffb6f..c05d2def268 100644 --- a/packages/@ourworldindata/core-table/src/CoreTable.ts +++ b/packages/@ourworldindata/core-table/src/CoreTable.ts @@ -1398,9 +1398,10 @@ export class CoreTable< sourceTable: CoreTable, by?: ColumnSlug[] ): COL_DEF_TYPE[] { - by = - by ?? - intersection(sourceTable.columnSlugs, destinationTable.columnSlugs) + by ??= intersection( + sourceTable.columnSlugs, + destinationTable.columnSlugs + ) const columnSlugsToAdd = difference( sourceTable.columnSlugs, destinationTable.columnSlugs diff --git a/packages/@ourworldindata/core-table/src/CoreTablePrinters.ts b/packages/@ourworldindata/core-table/src/CoreTablePrinters.ts index b351b0207c2..356254635a8 100644 --- a/packages/@ourworldindata/core-table/src/CoreTablePrinters.ts +++ b/packages/@ourworldindata/core-table/src/CoreTablePrinters.ts @@ -42,7 +42,7 @@ export const toAlignedTextTable = ( // Drop columns if they exceed the max line width let runningWidth = 0 const finalHeaderSlugs = headerSlugs.filter((slug, index) => { - runningWidth = runningWidth + colWidths[index] + runningWidth += colWidths[index] if (runningWidth <= maxCharactersPerLine) return true return false }) diff --git a/packages/@ourworldindata/explorer/src/Explorer.tsx b/packages/@ourworldindata/explorer/src/Explorer.tsx index fcc38ed659e..da070a9e21a 100644 --- a/packages/@ourworldindata/explorer/src/Explorer.tsx +++ b/packages/@ourworldindata/explorer/src/Explorer.tsx @@ -723,7 +723,7 @@ export class Explorer const mergedDef = { ...def, ...manuallyProvidedDef } // update display properties - mergedDef.display = mergedDef.display ?? {} + mergedDef.display ??= {} if (manuallyProvidedDef.name) mergedDef.display.name = manuallyProvidedDef.name if (manuallyProvidedDef.unit) diff --git a/packages/@ourworldindata/grapher/src/controls/VerticalScrollContainer.tsx b/packages/@ourworldindata/grapher/src/controls/VerticalScrollContainer.tsx index 96ce6f9b47a..4b3c05f3904 100644 --- a/packages/@ourworldindata/grapher/src/controls/VerticalScrollContainer.tsx +++ b/packages/@ourworldindata/grapher/src/controls/VerticalScrollContainer.tsx @@ -48,7 +48,7 @@ export const VerticalScrollContainer = React.forwardRef( ...rest } = props - scrollingShadows = scrollingShadows ?? true + scrollingShadows ??= true const scrollContainerRef = useCombinedRefs(ref) const [scrollTop, scrollBottom] = useScrollBounds( diff --git a/packages/@ourworldindata/grapher/src/stackedCharts/StackedAreaChart.tsx b/packages/@ourworldindata/grapher/src/stackedCharts/StackedAreaChart.tsx index 857a08a1b4a..e218c1950c9 100644 --- a/packages/@ourworldindata/grapher/src/stackedCharts/StackedAreaChart.tsx +++ b/packages/@ourworldindata/grapher/src/stackedCharts/StackedAreaChart.tsx @@ -170,7 +170,7 @@ class Areas extends React.Component { if (index > 0) { prevPoints = placedSeriesArr[index - 1].placedPoints } else { - prevPoints = prevPoints = [ + prevPoints = [ [ placedPoints[0][0], // placed x coord of first (= leftmost) point in chart verticalAxis.range[0], diff --git a/packages/@ourworldindata/types/src/domainTypes/Various.ts b/packages/@ourworldindata/types/src/domainTypes/Various.ts index b91faae7420..85e1e6cbacf 100644 --- a/packages/@ourworldindata/types/src/domainTypes/Various.ts +++ b/packages/@ourworldindata/types/src/domainTypes/Various.ts @@ -62,7 +62,7 @@ export class JsonError extends Error { status: number constructor(message: string, status?: number) { super(message) - this.status = status || 400 + this.status = status ?? 400 } } diff --git a/site/gdocs/components/HomepageIntro.tsx b/site/gdocs/components/HomepageIntro.tsx index 3cfd514458b..5eb4b8cdd8a 100644 --- a/site/gdocs/components/HomepageIntro.tsx +++ b/site/gdocs/components/HomepageIntro.tsx @@ -60,9 +60,9 @@ function FeaturedWorkTile({ } } - title = title || linkedDocument?.title - authors = authors || linkedDocument?.authors - description = description || linkedDocument?.excerpt + title ||= linkedDocument?.title + authors ||= linkedDocument?.authors + description ||= linkedDocument?.excerpt return (