mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Configure more comprehensive eslint rules for Typescript
Summary: - Update rules to be more like we've had with tslint - Switch tsserver plugin to eslint (tsserver makes for a much faster way to lint in editors) - Apply suggested auto-fixes - Fix all lint errors and warnings in core/, app/, test/ Test Plan: Some behavior may change subtly (e.g. added missing awaits), relying on existing tests to catch problems. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D2785
This commit is contained in:
@@ -174,7 +174,7 @@ export class BillingModelImpl extends Disposable implements BillingModel {
|
||||
await this._billingAPI.updateAddress(newAddr || undefined, newSettings || undefined);
|
||||
}
|
||||
// If there is an org update, re-initialize the org in the client.
|
||||
if (newSettings) { await this._appModel.topAppModel.initialize(); }
|
||||
if (newSettings) { this._appModel.topAppModel.initialize(); }
|
||||
} else {
|
||||
throw new Error('BillingPage _submit error: no task in progress');
|
||||
}
|
||||
|
||||
@@ -27,13 +27,6 @@ const ROW_ID_SKIP = -1;
|
||||
* This should be the only part of the code that knows that.
|
||||
*/
|
||||
export class ExtraRows {
|
||||
readonly leftTableDelta?: TableDelta;
|
||||
readonly rightTableDelta?: TableDelta;
|
||||
readonly rightAddRows: Set<number>;
|
||||
readonly rightRemoveRows: Set<number>;
|
||||
readonly leftAddRows: Set<number>;
|
||||
readonly leftRemoveRows: Set<number>;
|
||||
|
||||
/**
|
||||
* Map back from a possibly synthetic row id to an original strictly-positive row id.
|
||||
*/
|
||||
@@ -44,7 +37,14 @@ export class ExtraRows {
|
||||
return { type: 'local-remove', id: -(rowId + 2) / 2 };
|
||||
}
|
||||
|
||||
public constructor(readonly tableId: string, readonly comparison?: DocStateComparisonDetails) {
|
||||
public readonly leftTableDelta?: TableDelta;
|
||||
public readonly rightTableDelta?: TableDelta;
|
||||
public readonly rightAddRows: Set<number>;
|
||||
public readonly rightRemoveRows: Set<number>;
|
||||
public readonly leftAddRows: Set<number>;
|
||||
public readonly leftRemoveRows: Set<number>;
|
||||
|
||||
public constructor(public readonly tableId: string, public readonly comparison?: DocStateComparisonDetails) {
|
||||
const remoteTableId = getRemoteTableId(tableId, comparison);
|
||||
this.leftTableDelta = this.comparison?.leftChanges?.tableDeltas[tableId];
|
||||
if (remoteTableId) {
|
||||
|
||||
@@ -100,7 +100,7 @@ export class DocData extends BaseDocData {
|
||||
this._nextDesc = options.description;
|
||||
this._lastActionNum = null;
|
||||
this._triggerBundleFinalize = triggerFinalize;
|
||||
await prepareResolve(options.prepare());
|
||||
prepareResolve(options.prepare());
|
||||
this._shouldIncludeInBundle = options.shouldIncludeInBundle;
|
||||
|
||||
await triggerFinalizePromise;
|
||||
@@ -162,7 +162,7 @@ export class DocData extends BaseDocData {
|
||||
public sendActions(actions: UserAction[], optDesc?: string): Promise<any[]> {
|
||||
// Some old code relies on this promise being a bluebird Promise.
|
||||
// TODO Remove bluebird and this cast.
|
||||
return bluebird.Promise.resolve(this._sendActionsImpl(actions, optDesc)) as any;
|
||||
return bluebird.Promise.resolve(this._sendActionsImpl(actions, optDesc)) as unknown as Promise<any[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -94,7 +94,8 @@ export class DocPageModelImpl extends Disposable implements DocPageModel {
|
||||
public readonly isReadonly = Computed.create(this, this.currentDoc, (use, doc) => doc ? doc.isReadonly : false);
|
||||
public readonly isPrefork = Computed.create(this, this.currentDoc, (use, doc) => doc ? doc.isPreFork : false);
|
||||
public readonly isFork = Computed.create(this, this.currentDoc, (use, doc) => doc ? doc.isFork : false);
|
||||
public readonly isRecoveryMode = Computed.create(this, this.currentDoc, (use, doc) => doc ? doc.isRecoveryMode : false);
|
||||
public readonly isRecoveryMode = Computed.create(this, this.currentDoc,
|
||||
(use, doc) => doc ? doc.isRecoveryMode : false);
|
||||
public readonly userOverride = Computed.create(this, this.currentDoc, (use, doc) => doc ? doc.userOverride : null);
|
||||
public readonly isBareFork = Computed.create(this, this.currentDoc, (use, doc) => doc ? doc.isBareFork : false);
|
||||
public readonly isSample = Computed.create(this, this.currentDoc, (use, doc) => doc ? doc.isSample : false);
|
||||
@@ -133,8 +134,9 @@ export class DocPageModelImpl extends Disposable implements DocPageModel {
|
||||
if (!urlId) {
|
||||
this._openerHolder.clear();
|
||||
} else {
|
||||
FlowRunner.create(this._openerHolder, (flow: AsyncFlow) => this._openDoc(flow, urlId, urlOpenMode,
|
||||
state.params?.compare, linkParameters))
|
||||
FlowRunner.create(this._openerHolder,
|
||||
(flow: AsyncFlow) => this._openDoc(flow, urlId, urlOpenMode, state.params?.compare, linkParameters)
|
||||
)
|
||||
.resultPromise.catch(err => this._onOpenError(err));
|
||||
}
|
||||
}
|
||||
@@ -305,8 +307,10 @@ function addMenu(importSources: ImportSource[], gristDoc: GristDoc, isReadonly:
|
||||
menuIcon("Widget"), "Add Widget to Page", testId('dp-add-widget-to-page'),
|
||||
dom.cls('disabled', isReadonly)
|
||||
),
|
||||
menuItem(() => gristDoc.addEmptyTable().catch(reportError), menuIcon("TypeTable"), "Add Empty Table", testId('dp-empty-table'),
|
||||
dom.cls('disabled', isReadonly)),
|
||||
menuItem(() => gristDoc.addEmptyTable().catch(reportError),
|
||||
menuIcon("TypeTable"), "Add Empty Table", testId('dp-empty-table'),
|
||||
dom.cls('disabled', isReadonly)
|
||||
),
|
||||
menuDivider(),
|
||||
...importSources.map((importSource, i) =>
|
||||
menuItem(importSource.action,
|
||||
|
||||
@@ -314,7 +314,7 @@ function convertQueryToRefs(docModel: DocModel, query: Query): QueryRefs {
|
||||
const tableRec: any = docModel.dataTables[query.tableId].tableMetaRow;
|
||||
|
||||
const colRefsByColId: {[colId: string]: number} = {};
|
||||
for (const col of (tableRec as any).columns.peek().peek()) {
|
||||
for (const col of tableRec.columns.peek().peek()) {
|
||||
colRefsByColId[col.colId.peek()] = col.getRowId();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ export class SearchModelImpl extends Disposable implements SearchModel {
|
||||
|
||||
// Listen to input value changes (debounced) to activate searching.
|
||||
const findFirst = debounce((_value: string) => this._findFirst(_value), 100);
|
||||
this.autoDispose(this.value.addListener(v => { findFirst(v); }));
|
||||
this.autoDispose(this.value.addListener(v => { void findFirst(v); }));
|
||||
}
|
||||
|
||||
public async findNext() {
|
||||
|
||||
@@ -7,7 +7,7 @@ import {DocData} from 'app/client/models/DocData';
|
||||
import {DocAction, ReplaceTableData, TableDataAction, UserAction} from 'app/common/DocActions';
|
||||
import {isRaisedException} from 'app/common/gristTypes';
|
||||
import {countIf} from 'app/common/gutil';
|
||||
import {ColTypeMap, TableData as BaseTableData} from 'app/common/TableData';
|
||||
import {TableData as BaseTableData, ColTypeMap} from 'app/common/TableData';
|
||||
import {BaseFormatter} from 'app/common/ValueFormatter';
|
||||
import {Emitter} from 'grainjs';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user