Add @typescript-eslint/prefer-nullish-coalescing eslint rule

This commit is contained in:
Daniel Imms
2026-01-31 08:43:05 -08:00
parent 01450f044a
commit bad7e329df
32 changed files with 117 additions and 151 deletions
+3 -9
View File
@@ -122,9 +122,7 @@ export class Buffer implements IBuffer {
*/
public fillViewportRows(fillAttr?: IAttributeData): void {
if (this.lines.length === 0) {
if (fillAttr === undefined) {
fillAttr = DEFAULT_ATTR_DATA;
}
fillAttr ??= DEFAULT_ATTR_DATA;
let i = this._rows;
while (i--) {
this.lines.push(this.getBlankLine(fillAttr));
@@ -589,9 +587,7 @@ export class Buffer implements IBuffer {
* @param x The position to move the cursor to the previous tab stop.
*/
public prevStop(x?: number): number {
if (x === null || x === undefined) {
x = this.x;
}
x ??= this.x;
while (!this.tabs[--x] && x > 0);
return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;
}
@@ -601,9 +597,7 @@ export class Buffer implements IBuffer {
* @param x The position to move the cursor one tab stop forward.
*/
public nextStop(x?: number): number {
if (x === null || x === undefined) {
x = this.x;
}
x ??= this.x;
while (!this.tabs[++x] && x < this._cols);
return x >= this._cols ? this._cols - 1 : x < 0 ? 0 : x;
}
+1 -1
View File
@@ -66,7 +66,7 @@ export class BufferLine implements IBufferLine {
constructor(cols: number, fillCellData?: ICellData, public isWrapped: boolean = false) {
this._data = new Uint32Array(cols * CELL_SIZE);
const cell = fillCellData || CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
const cell = fillCellData ?? CellData.fromCharData([0, NULL_CELL_CHAR, NULL_CELL_WIDTH, NULL_CELL_CODE]);
for (let i = 0; i < cols; ++i) {
this.setCell(i, cell);
}