(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:
Dmitry S
2021-04-26 17:54:09 -04:00
parent 91fdef58ac
commit 526b0ad33e
56 changed files with 147 additions and 125 deletions

View File

@@ -15,7 +15,7 @@ import { decodeUrl } from 'app/common/gristUrls';
import { FullUser, UserProfile } from 'app/common/LoginSessionAPI';
import { resetOrg } from 'app/common/resetOrg';
import { TestState } from 'app/common/TestState';
import { DocStateComparison, Organization as APIOrganization, UserAPIImpl, Workspace } from 'app/common/UserAPI';
import { Organization as APIOrganization, DocStateComparison, UserAPIImpl, Workspace } from 'app/common/UserAPI';
import { Organization } from 'app/gen-server/entity/Organization';
import { Product } from 'app/gen-server/entity/Product';
import { create } from 'app/server/lib/create';
@@ -163,7 +163,7 @@ export async function selectAll() {
* Returns a WebElementPromise for the .viewsection_content element for the section which contains
* the given RegExp content.
*/
export function getSection(sectionOrTitle: string|WebElement): WebElement {
export function getSection(sectionOrTitle: string|WebElement): WebElement|WebElementPromise {
if (typeof sectionOrTitle !== 'string') { return sectionOrTitle; }
return driver.find(`.test-viewsection-title[value="${sectionOrTitle}" i]`)
.findClosest('.viewsection_content');
@@ -1187,7 +1187,7 @@ export class Session {
// Wipe the current site. The current user ends up being its only owner and manager.
public async resetSite() {
return resetOrg(await this.createHomeApi(), this.settings.org);
return resetOrg(this.createHomeApi(), this.settings.org);
}
// Return a session configured for the current session's site but a different user.

View File

@@ -55,7 +55,7 @@ export class TestServerMerged implements IMochaServer {
public async restart(reset: boolean = false) {
if (this.isExternalServer()) { return; }
if (this._starts > 0) {
await this.resume();
this.resume();
await this.stop();
}
this._starts++;