mirror of
https://github.com/atom/atom.git
synced 2026-01-26 07:19:06 -05:00
Fix linting errors
This commit is contained in:
@@ -11,10 +11,10 @@ class BlockDecorationsPresenter {
|
||||
this.emitter = new Emitter()
|
||||
this.firstUpdate = true
|
||||
this.lineTopIndex = lineTopIndex
|
||||
this.blocksByDecoration = new Map
|
||||
this.decorationsByBlock = new Map
|
||||
this.observedDecorations = new Set
|
||||
this.measuredDecorations = new Set
|
||||
this.blocksByDecoration = new Map()
|
||||
this.decorationsByBlock = new Map()
|
||||
this.observedDecorations = new Set()
|
||||
this.measuredDecorations = new Set()
|
||||
|
||||
this.observeModel()
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class BlockDecorationsPresenter {
|
||||
}
|
||||
|
||||
onDidUpdateState (callback) {
|
||||
return this.emitter.on("did-update-state", callback)
|
||||
return this.emitter.on('did-update-state', callback)
|
||||
}
|
||||
|
||||
setLineHeight (lineHeight) {
|
||||
@@ -46,7 +46,7 @@ class BlockDecorationsPresenter {
|
||||
|
||||
update () {
|
||||
if (this.firstUpdate) {
|
||||
for (let decoration of this.model.getDecorations({type: "block"})) {
|
||||
for (let decoration of this.model.getDecorations({type: 'block'})) {
|
||||
this.observeDecoration(decoration)
|
||||
}
|
||||
this.firstUpdate = false
|
||||
@@ -64,22 +64,22 @@ class BlockDecorationsPresenter {
|
||||
}
|
||||
|
||||
this.measuredDecorations.add(decoration)
|
||||
this.emitter.emit("did-update-state")
|
||||
this.emitter.emit('did-update-state')
|
||||
}
|
||||
|
||||
invalidateDimensionsForDecoration (decoration) {
|
||||
this.measuredDecorations.delete(decoration)
|
||||
this.emitter.emit("did-update-state")
|
||||
this.emitter.emit('did-update-state')
|
||||
}
|
||||
|
||||
decorationsForScreenRow (screenRow) {
|
||||
let blocks = this.lineTopIndex.allBlocks().filter((block) => block.row == screenRow)
|
||||
let blocks = this.lineTopIndex.allBlocks().filter((block) => block.row === screenRow)
|
||||
return blocks.map((block) => this.decorationsByBlock.get(block.id)).filter((decoration) => decoration)
|
||||
}
|
||||
|
||||
decorationsForScreenRowRange (startRow, endRow) {
|
||||
let blocks = this.lineTopIndex.allBlocks()
|
||||
let decorationsByScreenRow = new Map
|
||||
let decorationsByScreenRow = new Map()
|
||||
for (let block of blocks) {
|
||||
let decoration = this.decorationsByBlock.get(block.id)
|
||||
let hasntMeasuredDecoration = !this.measuredDecorations.has(decoration)
|
||||
@@ -95,7 +95,7 @@ class BlockDecorationsPresenter {
|
||||
}
|
||||
|
||||
observeDecoration (decoration) {
|
||||
if (!decoration.isType("block") || this.observedDecorations.has(decoration)) {
|
||||
if (!decoration.isType('block') || this.observedDecorations.has(decoration)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ class BlockDecorationsPresenter {
|
||||
let block = this.lineTopIndex.insertBlock(screenRow, 0)
|
||||
this.decorationsByBlock.set(block, decoration)
|
||||
this.blocksByDecoration.set(decoration, block)
|
||||
this.emitter.emit("did-update-state")
|
||||
this.emitter.emit('did-update-state')
|
||||
}
|
||||
|
||||
didMoveDecoration (decoration, {textChanged}) {
|
||||
@@ -135,7 +135,7 @@ class BlockDecorationsPresenter {
|
||||
let block = this.blocksByDecoration.get(decoration)
|
||||
let newScreenRow = decoration.getMarker().getHeadScreenPosition().row
|
||||
this.lineTopIndex.moveBlock(block, newScreenRow)
|
||||
this.emitter.emit("did-update-state")
|
||||
this.emitter.emit('did-update-state')
|
||||
}
|
||||
|
||||
didDestroyDecoration (decoration) {
|
||||
@@ -145,6 +145,6 @@ class BlockDecorationsPresenter {
|
||||
this.blocksByDecoration.delete(decoration)
|
||||
this.decorationsByBlock.delete(block)
|
||||
}
|
||||
this.emitter.emit("did-update-state")
|
||||
this.emitter.emit('did-update-state')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@ class LineTopIndex {
|
||||
}
|
||||
|
||||
resizeBlock (id, height) {
|
||||
let block = this.blocks.find((block) => block.id == id)
|
||||
let block = this.blocks.find((block) => block.id === id)
|
||||
if (block) {
|
||||
block.height = height
|
||||
}
|
||||
}
|
||||
|
||||
moveBlock (id, newRow) {
|
||||
let block = this.blocks.find((block) => block.id == id)
|
||||
let block = this.blocks.find((block) => block.id === id)
|
||||
if (block) {
|
||||
block.row = newRow
|
||||
this.blocks.sort((a, b) => a.row - b.row)
|
||||
@@ -40,8 +40,8 @@ class LineTopIndex {
|
||||
}
|
||||
|
||||
removeBlock (id) {
|
||||
let index = this.blocks.findIndex((block) => block.id == id)
|
||||
if (index != -1) {
|
||||
let index = this.blocks.findIndex((block) => block.id === id)
|
||||
if (index !== -1) {
|
||||
this.blocks.splice(index, 1)
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class LineTopIndex {
|
||||
}
|
||||
|
||||
blocksHeightForRow (row) {
|
||||
let blocksForRow = this.blocks.filter((block) => block.row == row)
|
||||
let blocksForRow = this.blocks.filter((block) => block.row === row)
|
||||
return blocksForRow.reduce((a, b) => a + b.height, 0)
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ class LineTopIndex {
|
||||
let remainingHeight = Math.max(0, top - lastTop)
|
||||
let remainingRows = Math.min(this.maxRow, lastRow + remainingHeight / this.defaultLineHeight)
|
||||
switch (roundingStrategy) {
|
||||
case "floor":
|
||||
case 'floor':
|
||||
return Math.floor(remainingRows)
|
||||
case "ceil":
|
||||
case 'ceil':
|
||||
return Math.ceil(remainingRows)
|
||||
default:
|
||||
throw new Error(`Cannot use '${roundingStrategy}' as a rounding strategy!`)
|
||||
|
||||
Reference in New Issue
Block a user