From fd02a00a0e0ead180db10f7e462f0a8fa2c7549d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Sadzi=C5=84ski?= Date: Tue, 27 Dec 2022 19:35:03 +0100 Subject: [PATCH] Fixing all eslint's reported error --- .eslintignore | 2 +- app/client/aclui/AccessRules.ts | 10 +++++----- app/client/components/DocumentUsage.ts | 2 +- app/client/components/GristDoc.ts | 2 +- app/client/components/Importer.ts | 2 +- app/client/lib/MultiUserManager.ts | 19 +++++++++++-------- app/client/lib/localization.ts | 4 ++-- app/client/ui/CustomSectionConfig.ts | 18 ++++++++++++++---- app/client/ui/ExampleInfo.ts | 2 +- app/client/ui/PageWidgetPicker.ts | 8 ++++---- app/client/ui/Pages.ts | 6 +++--- app/client/ui/UserManager.ts | 4 ++-- app/client/ui/errorPages.ts | 5 ++++- app/client/ui/inputs.ts | 2 +- app/client/widgets/ReferenceEditor.ts | 2 +- app/client/widgets/ReferenceListEditor.ts | 2 +- app/common/getCurrentTime.ts | 2 +- app/server/lib/Authorizer.ts | 2 +- app/server/lib/DocApi.ts | 4 ++-- app/server/lib/ExportCSV.ts | 2 +- app/server/lib/ExportXLSX.ts | 2 +- app/server/lib/HostedStorageManager.ts | 2 +- app/server/lib/Triggers.ts | 2 +- app/server/lib/requestUtils.ts | 4 +++- package.json | 4 ++-- test/.eslintrc.js | 5 +++++ test/client/lib/localization.ts | 4 ++-- test/server/lib/DocApi.ts | 6 +++++- tsconfig.eslint.json | 2 ++ 29 files changed, 80 insertions(+), 51 deletions(-) create mode 100644 test/.eslintrc.js diff --git a/.eslintignore b/.eslintignore index 2478c50c..17f0f96b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,8 +4,8 @@ !/test !/plugins !/buildtools +!/stubs !/.eslintrc.js # And exclude some things within those (generated files) -/_build /plugins/**/dist diff --git a/app/client/aclui/AccessRules.ts b/app/client/aclui/AccessRules.ts index 233bd2e0..7fcf8b5d 100644 --- a/app/client/aclui/AccessRules.ts +++ b/app/client/aclui/AccessRules.ts @@ -134,7 +134,7 @@ export class AccessRules extends Disposable { // there were only removals, then length will be reduced. getChangedStatus(tableRules.length < this._ruleCollection.getAllTableIds().length), getChangedStatus(userAttr.length < this._ruleCollection.getUserAttributeRules().size), - ...tableRules.map(t => use(t.ruleStatus)), + ...tableRules.map(tr => use(tr.ruleStatus)), ...userAttr.map(u => use(u.ruleStatus)), specialRules ? use(specialRules.ruleStatus) : RuleStatus.Unchanged, ); @@ -239,7 +239,7 @@ export class AccessRules extends Disposable { const newResources: MetaRowRecord<'_grist_ACLResources'>[] = flatten( [{tableId: '*', colIds: '*'}], this._specialRules.get()?.getResources() || [], - ...this._tableRules.get().map(t => t.getResources())) + ...this._tableRules.get().map(tr => tr.getResources())) .map(r => ({id: -1, ...r})); // Prepare userActions and a mapping of serializedResource to rowIds. @@ -350,7 +350,7 @@ export class AccessRules extends Disposable { // synchronously, which prevents the menu from closing on click. menuItemAsync(() => this._addTableRules(tableId), this.getTableTitle(tableId), - dom.cls('disabled', (use) => use(this._tableRules).some(t => t.tableId === tableId)), + dom.cls('disabled', (use) => use(this._tableRules).some(tr => tr.tableId === tableId)), ) ), ), @@ -442,7 +442,7 @@ export class AccessRules extends Disposable { */ public getRules(): RuleRec[] { return flatten( - ...this._tableRules.get().map(t => t.getRules()), + ...this._tableRules.get().map(tr => tr.getRules()), this._specialRules.get()?.getRules() || [], this._docDefaultRuleSet.get()?.getRules('*') || [] ); @@ -484,7 +484,7 @@ export class AccessRules extends Disposable { } private _addTableRules(tableId: string) { - if (this._tableRules.get().some(t => t.tableId === tableId)) { + if (this._tableRules.get().some(tr => tr.tableId === tableId)) { throw new Error(`Trying to add TableRules for existing table ${tableId}`); } const defRuleSet: RuleSet = {tableId, colIds: '*', body: []}; diff --git a/app/client/components/DocumentUsage.ts b/app/client/components/DocumentUsage.ts index 54cb1d9f..0be8a7ab 100644 --- a/app/client/components/DocumentUsage.ts +++ b/app/client/components/DocumentUsage.ts @@ -239,7 +239,7 @@ export function buildUpgradeMessage( ) { if (!canUpgrade) { return t("Contact the site owner to upgrade the plan to raise limits."); } - const upgradeLinkText = t("start your 30-day free trial of the Pro plan.") + const upgradeLinkText = t("start your 30-day free trial of the Pro plan."); // TODO i18next return [ variant === 'short' ? null : t("For higher limits, "), diff --git a/app/client/components/GristDoc.ts b/app/client/components/GristDoc.ts index 13a11ec6..1af3ab4b 100644 --- a/app/client/components/GristDoc.ts +++ b/app/client/components/GristDoc.ts @@ -986,7 +986,7 @@ export class GristDoc extends DisposableWithEvents { * Renames table. Method exposed primarily for tests. */ public async renameTable(tableId: string, newTableName: string) { - const tableRec = this.docModel.visibleTables.all().find(t => t.tableId.peek() === tableId); + const tableRec = this.docModel.visibleTables.all().find(tb => tb.tableId.peek() === tableId); if (!tableRec) { throw new UserError(`No table with id ${tableId}`); } diff --git a/app/client/components/Importer.ts b/app/client/components/Importer.ts index def7e146..82ab4ae3 100644 --- a/app/client/components/Importer.ts +++ b/app/client/components/Importer.ts @@ -380,7 +380,7 @@ export class Importer extends DisposableWithEvents { } private _getHiddenTableIds(): string[] { - return this._sourceInfoArray.get().map((t: SourceInfo) => t.hiddenTableId); + return this._sourceInfoArray.get().map((si: SourceInfo) => si.hiddenTableId); } private async _reImport(upload: UploadResult) { diff --git a/app/client/lib/MultiUserManager.ts b/app/client/lib/MultiUserManager.ts index b3979e49..b7cc349b 100644 --- a/app/client/lib/MultiUserManager.ts +++ b/app/client/lib/MultiUserManager.ts @@ -1,11 +1,12 @@ import {computed, Computed, dom, DomElementArg, IDisposableOwner, Observable, styled} from "grainjs"; -import {cssModalBody, cssModalButtons, cssModalTitle, IModalControl, modal, cssAnimatedModal} from 'app/client/ui2018/modals'; +import {cssAnimatedModal, cssModalBody, cssModalButtons, cssModalTitle, + IModalControl, modal} from 'app/client/ui2018/modals'; import {bigBasicButton, bigPrimaryButton} from 'app/client/ui2018/buttons'; import {mediaXSmall, testId, theme, vars} from 'app/client/ui2018/cssVars'; -import {UserManagerModel, IOrgMemberSelectOption} from 'app/client/models/UserManagerModel'; +import {IOrgMemberSelectOption, UserManagerModel} from 'app/client/models/UserManagerModel'; import {icon} from 'app/client/ui2018/icons'; import {textarea} from "app/client/ui/inputs"; -import {BasicRole, VIEWER, NonGuestRole, isBasicRole} from "app/common/roles"; +import {BasicRole, isBasicRole, NonGuestRole, VIEWER} from "app/common/roles"; import {menu, menuItem} from 'app/client/ui2018/menus'; function parseEmailList(emailListRaw: string): Array { @@ -28,9 +29,11 @@ export function buildMultiUserManagerModal( const emailListObs = Observable.create(owner, ""); const rolesObs = Observable.create(owner, VIEWER); const isValidObs = Observable.create(owner, true); - - const enableAdd: Computed = computed((use) => Boolean(use(emailListObs) && use(rolesObs) && use(isValidObs))); - + + const enableAdd: Computed = computed( + (use) => Boolean(use(emailListObs) && use(rolesObs) && use(isValidObs)) + ); + const save = (ctl: IModalControl) => { const emailList = parseEmailList(emailListObs.get()); const role = rolesObs.get(); @@ -40,7 +43,7 @@ export function buildMultiUserManagerModal( emailList.forEach(email => onAdd(email, role)); ctl.close(); } - } + }; return modal(ctl => [ { style: 'padding: 0;' }, @@ -63,7 +66,7 @@ export function buildMultiUserManagerModal( { style: 'margin: 32px 64px; display: flex;' }, bigPrimaryButton('Confirm', dom.boolAttr('disabled', (use) => !use(enableAdd)), - dom.on('click', () => {save(ctl)}), + dom.on('click', () => { save(ctl); }), testId('um-confirm') ), bigBasicButton( diff --git a/app/client/lib/localization.ts b/app/client/lib/localization.ts index ef28a049..9a8c39f3 100644 --- a/app/client/lib/localization.ts +++ b/app/client/lib/localization.ts @@ -101,7 +101,7 @@ function domT(key: string, args: any, tImpl: typeof i18next.t) { // If there are any DomElements in args, handle it with missingInterpolationHandler. const domElements = !args ? [] : Object.entries(args).filter(([_, value]) => isLikeDomContents(value)); if (!args || !domElements.length) { - return tImpl(key, args || undefined) as any; + return tImpl(key, args || undefined); } else { // Make a copy of the arguments, and remove any dom elements from it. It will instruct // i18next library to use `missingInterpolationHandler` handler. @@ -171,5 +171,5 @@ export function makeT(scope: string, instance?: typeof i18next) { reportError(error); } return domT(key, args, scopedResolver!); - } + }; } diff --git a/app/client/ui/CustomSectionConfig.ts b/app/client/ui/CustomSectionConfig.ts index f2792dd4..d5c894e4 100644 --- a/app/client/ui/CustomSectionConfig.ts +++ b/app/client/ui/CustomSectionConfig.ts @@ -73,7 +73,9 @@ class ColumnPicker extends Disposable { properValue, options, { - defaultLabel: this._column.typeDesc != "any" ? t("Pick a {{columnType}} column", {"columnType": this._column.typeDesc}) : t("Pick a column") + defaultLabel: this._column.typeDesc != "any" + ? t("Pick a {{columnType}} column", {"columnType": this._column.typeDesc}) + : t("Pick a column") } ), testId('mapping-for-' + this._column.name), @@ -117,7 +119,11 @@ class ColumnListPicker extends Disposable { col.label.peek(), )), wrongTypeCount > 0 ? menuText( - t("{{wrongTypeCount}} non-{{columnType}} columns are not shown", {wrongTypeCount, columnType: this._column.type.toLowerCase(), count: wrongTypeCount}), + t("{{wrongTypeCount}} non-{{columnType}} columns are not shown", { + wrongTypeCount, + columnType: this._column.type.toLowerCase(), + count: wrongTypeCount + }), testId('map-message-' + this._column.name) ) : null ]; @@ -371,8 +377,12 @@ export class CustomSectionConfig extends Disposable { } switch(level) { case AccessLevel.none: return cssConfirmLine(t("Widget does not require any permissions.")); - case AccessLevel.read_table: return cssConfirmLine(t("Widget needs to {{read}} the current table.", {read: dom("b", "read")})); // TODO i18next - case AccessLevel.full: return cssConfirmLine(t("Widget needs {{fullAccess}} to this document.", {fullAccess: dom("b", "full access")})); // TODO i18next + case AccessLevel.read_table: + return cssConfirmLine(t("Widget needs to {{read}} the current table.", {read: dom("b", "read")})); + case AccessLevel.full: + return cssConfirmLine(t("Widget needs {{fullAccess}} to this document.", { + fullAccess: dom("b", "full access") + })); default: throw new Error(`Unsupported ${level} access level`); } } diff --git a/app/client/ui/ExampleInfo.ts b/app/client/ui/ExampleInfo.ts index 23fb1199..c8f3e8f1 100644 --- a/app/client/ui/ExampleInfo.ts +++ b/app/client/ui/ExampleInfo.ts @@ -1,4 +1,4 @@ -import {makeT} from 'app/client/lib/localization' +import {makeT} from 'app/client/lib/localization'; const t = makeT('ExampleInfo'); diff --git a/app/client/ui/PageWidgetPicker.ts b/app/client/ui/PageWidgetPicker.ts index b0b9cfbc..d3d4351a 100644 --- a/app/client/ui/PageWidgetPicker.ts +++ b/app/client/ui/PageWidgetPicker.ts @@ -268,8 +268,8 @@ export class PageWidgetSelect extends Disposable { }) : null; - private _isNewTableDisabled = Computed.create(this, this._value.type, (use, t) => !isValidSelection( - 'New Table', t, this._options.isNewPage)); + private _isNewTableDisabled = Computed.create(this, this._value.type, (use, type) => !isValidSelection( + 'New Table', type, this._options.isNewPage)); constructor( private _value: IWidgetValueObs, @@ -399,8 +399,8 @@ export class PageWidgetSelect extends Disposable { this._value.summarize.set(true); } - private _selectType(t: IWidgetType) { - this._value.type.set(t); + private _selectType(type: IWidgetType) { + this._value.type.set(type); } private _selectTable(tid: TableId) { diff --git a/app/client/ui/Pages.ts b/app/client/ui/Pages.ts index 921fe72b..da0869db 100644 --- a/app/client/ui/Pages.ts +++ b/app/client/ui/Pages.ts @@ -100,11 +100,11 @@ function removeView(activeDoc: GristDoc, viewId: number, pageName: string) { const removePage = () => [['RemoveRecord', '_grist_Views', viewId]]; const removeAll = () => [ ...removePage(), - ...notVisibleTables.map(t => ['RemoveTable', t.tableId.peek()]) + ...notVisibleTables.map(tb => ['RemoveTable', tb.tableId.peek()]) ]; if (notVisibleTables.length) { - const tableNames = notVisibleTables.map(t => t.tableNameDef.peek()); + const tableNames = notVisibleTables.map(tb => tb.tableNameDef.peek()); buildPrompt(tableNames, async (option) => { // Errors are handled in the dialog. if (option === 'data') { @@ -174,7 +174,7 @@ function buildOption(value: Observable, id: RemoveOption, content: function buildWarning(tables: string[]) { return cssWarning( - dom.forEach(tables, (t) => cssTableName(t, testId('table'))) + dom.forEach(tables, (tb) => cssTableName(tb, testId('table'))) ); } diff --git a/app/client/ui/UserManager.ts b/app/client/ui/UserManager.ts index 57b1d2c6..82c75ca2 100644 --- a/app/client/ui/UserManager.ts +++ b/app/client/ui/UserManager.ts @@ -39,8 +39,8 @@ import {icon} from 'app/client/ui2018/icons'; import {cssLink} from 'app/client/ui2018/links'; import {loadingSpinner} from 'app/client/ui2018/loaders'; import {menu, menuItem, menuText} from 'app/client/ui2018/menus'; -import {confirmModal, cssModalBody, cssModalButtons, cssModalTitle, IModalControl, - modal, cssAnimatedModal} from 'app/client/ui2018/modals'; +import {confirmModal, cssAnimatedModal, cssModalBody, cssModalButtons, cssModalTitle, + IModalControl, modal} from 'app/client/ui2018/modals'; export interface IUserManagerOptions { permissionData: Promise; diff --git a/app/client/ui/errorPages.ts b/app/client/ui/errorPages.ts index eecf5ed4..8e9f492a 100644 --- a/app/client/ui/errorPages.ts +++ b/app/client/ui/errorPages.ts @@ -73,7 +73,10 @@ export function createNotFoundPage(appModel: AppModel, message?: string) { document.title = t("Page not found{{suffix}}", {suffix: getPageTitleSuffix(getGristConfig())}); return pagePanelsError(appModel, t("Page not found{{suffix}}", {suffix: ''}), [ - cssErrorText(message || t("The requested page could not be found.{{separator}}Please check the URL and try again.", {separator: dom('br')})), // TODO: i18next + cssErrorText(message || + t("The requested page could not be found.{{separator}}Please check the URL and try again.", { + separator: dom('br') + })), cssButtonWrap(bigPrimaryButtonLink(t("Go to main page"), testId('error-primary-btn'), urlState().setLinkUrl({}))), cssButtonWrap(bigBasicButtonLink(t("Contact support"), {href: 'https://getgrist.com/contact'})), diff --git a/app/client/ui/inputs.ts b/app/client/ui/inputs.ts index 6dfd0e0f..ec664a8a 100644 --- a/app/client/ui/inputs.ts +++ b/app/client/ui/inputs.ts @@ -1,5 +1,5 @@ import {theme, vars} from 'app/client/ui2018/cssVars'; -import {dom, IDomArgs, DomElementArg, IInputOptions, Observable, styled, subscribe} from 'grainjs'; +import {dom, DomElementArg, IDomArgs, IInputOptions, Observable, styled, subscribe} from 'grainjs'; export const cssInput = styled('input', ` font-size: ${vars.mediumFontSize}; diff --git a/app/client/widgets/ReferenceEditor.ts b/app/client/widgets/ReferenceEditor.ts index b591c877..a6d4f2e7 100644 --- a/app/client/widgets/ReferenceEditor.ts +++ b/app/client/widgets/ReferenceEditor.ts @@ -1,4 +1,4 @@ -import { ACResults, buildHighlightedDom, normalizeText, HighlightFunc } from 'app/client/lib/ACIndex'; +import { ACResults, buildHighlightedDom, HighlightFunc, normalizeText } from 'app/client/lib/ACIndex'; import { Autocomplete } from 'app/client/lib/autocomplete'; import { ICellItem } from 'app/client/models/ColumnACIndexes'; import { reportError } from 'app/client/models/errors'; diff --git a/app/client/widgets/ReferenceListEditor.ts b/app/client/widgets/ReferenceListEditor.ts index b21f68ed..2fcaad86 100644 --- a/app/client/widgets/ReferenceListEditor.ts +++ b/app/client/widgets/ReferenceListEditor.ts @@ -1,5 +1,5 @@ import { createGroup } from 'app/client/components/commands'; -import { ACItem, ACResults, normalizeText, HighlightFunc } from 'app/client/lib/ACIndex'; +import { ACItem, ACResults, HighlightFunc, normalizeText } from 'app/client/lib/ACIndex'; import { IAutocompleteOptions } from 'app/client/lib/autocomplete'; import { IToken, TokenField, tokenFieldStyles } from 'app/client/lib/TokenField'; import { reportError } from 'app/client/models/errors'; diff --git a/app/common/getCurrentTime.ts b/app/common/getCurrentTime.ts index b54c814f..8201c2d7 100644 --- a/app/common/getCurrentTime.ts +++ b/app/common/getCurrentTime.ts @@ -9,5 +9,5 @@ export default function getCurrentTime(): moment.Moment { if (typeof window === 'undefined' || !window) { return getDefault(); } const searchParams = new URLSearchParams(window.location.search); - return searchParams.has('currentTime') ? moment(searchParams.get('currentTime')!) : getDefault(); + return searchParams.has('currentTime') ? moment(searchParams.get('currentTime')) : getDefault(); } diff --git a/app/server/lib/Authorizer.ts b/app/server/lib/Authorizer.ts index 29d90506..cd3157c0 100644 --- a/app/server/lib/Authorizer.ts +++ b/app/server/lib/Authorizer.ts @@ -18,7 +18,7 @@ import {makeId} from 'app/server/lib/idUtils'; import log from 'app/server/lib/log'; import {IPermitStore, Permit} from 'app/server/lib/Permit'; import {AccessTokenInfo} from 'app/server/lib/AccessTokens'; -import {allowHost, isEnvironmentAllowedHost, getOriginUrl, optStringParam} from 'app/server/lib/requestUtils'; +import {allowHost, getOriginUrl, isEnvironmentAllowedHost, optStringParam} from 'app/server/lib/requestUtils'; import * as cookie from 'cookie'; import {NextFunction, Request, RequestHandler, Response} from 'express'; import {IncomingMessage} from 'http'; diff --git a/app/server/lib/DocApi.ts b/app/server/lib/DocApi.ts index 12cf1e0b..81549d7c 100644 --- a/app/server/lib/DocApi.ts +++ b/app/server/lib/DocApi.ts @@ -955,8 +955,8 @@ export class DocWorkerApi { const options: DownloadOptions = { ...params, filename: name + (params.tableId === name ? '' : '-' + params.tableId), - } - return options + }; + return options; } private _getActiveDoc(req: RequestWithLogin): Promise { diff --git a/app/server/lib/ExportCSV.ts b/app/server/lib/ExportCSV.ts index 57d7f6ba..428efffb 100644 --- a/app/server/lib/ExportCSV.ts +++ b/app/server/lib/ExportCSV.ts @@ -1,7 +1,7 @@ import {ApiError} from 'app/common/ApiError'; import {createFormatter} from 'app/common/ValueFormatter'; import {ActiveDoc} from 'app/server/lib/ActiveDoc'; -import {ExportData, exportSection, exportTable, Filter, DownloadOptions} from 'app/server/lib/Export'; +import {DownloadOptions, ExportData, exportSection, exportTable, Filter} from 'app/server/lib/Export'; import log from 'app/server/lib/log'; import * as bluebird from 'bluebird'; import contentDisposition from 'content-disposition'; diff --git a/app/server/lib/ExportXLSX.ts b/app/server/lib/ExportXLSX.ts index f913e9d0..948e5ab0 100644 --- a/app/server/lib/ExportXLSX.ts +++ b/app/server/lib/ExportXLSX.ts @@ -1,6 +1,6 @@ import {ActiveDoc} from 'app/server/lib/ActiveDoc'; import {createExcelFormatter} from 'app/server/lib/ExcelFormatter'; -import {ExportData, exportDoc, DownloadOptions, exportSection, exportTable, Filter} from 'app/server/lib/Export'; +import {DownloadOptions, ExportData, exportDoc, exportSection, exportTable, Filter} from 'app/server/lib/Export'; import {Alignment, Border, Fill, Workbook} from 'exceljs'; import * as express from 'express'; import log from 'app/server/lib/log'; diff --git a/app/server/lib/HostedStorageManager.ts b/app/server/lib/HostedStorageManager.ts index 30f64298..fe18cb1d 100644 --- a/app/server/lib/HostedStorageManager.ts +++ b/app/server/lib/HostedStorageManager.ts @@ -923,7 +923,7 @@ export async function backupSqliteDatabase(src: string, dest: string, } finally { if (testProgress) { testProgress({action: 'close', phase: 'before'}); } try { - if (db) { await fromCallback(cb => db!.close(cb)); } + if (db) { await fromCallback(cb => db.close(cb)); } } catch (err) { _log.debug(null, `problem stopping copy of ${src} (${label}): ${err}`); } diff --git a/app/server/lib/Triggers.ts b/app/server/lib/Triggers.ts index 6a1b46df..05f02f9f 100644 --- a/app/server/lib/Triggers.ts +++ b/app/server/lib/Triggers.ts @@ -376,7 +376,7 @@ export class DocTriggers { private async _pushToRedisQueue(events: WebHookEvent[]) { const strings = events.map(e => JSON.stringify(e)); - await this._redisClient!.rpushAsync(this._redisQueueKey, ...strings); + await this._redisClient?.rpushAsync(this._redisQueueKey, ...strings); } private async _getRedisQueue(redisClient: RedisClient) { diff --git a/app/server/lib/requestUtils.ts b/app/server/lib/requestUtils.ts index ab7243e3..2a8c2908 100644 --- a/app/server/lib/requestUtils.ts +++ b/app/server/lib/requestUtils.ts @@ -108,7 +108,9 @@ export function allowHost(req: Request, allowedHost: string|URL) { // For requests to a native subdomains, only the base domain needs to match. const allowedDomain = parseSubdomain(allowedUrl.hostname); const actualDomain = parseSubdomain(actualUrl.hostname); - return (!_.isEmpty(actualDomain) ? actualDomain.base === allowedDomain.base : allowedUrl.hostname === actualUrl.hostname); + return (!_.isEmpty(actualDomain) ? + actualDomain.base === allowedDomain.base : + allowedUrl.hostname === actualUrl.hostname); } } diff --git a/package.json b/package.json index 2512b38c..a1912df9 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,8 @@ "test:docker": "./test/test_under_docker.sh", "test:python": "sandbox_venv3/bin/python sandbox/grist/runtests.py ${GREP_TESTS:+discover -p \"test*${GREP_TESTS}*.py\"}", "cli": "NODE_PATH=_build:_build/stubs:_build/ext node _build/app/server/companion.js", - "lint": "eslint .", - "lint:fix": "eslint --fix .", + "lint": "eslint --cache --cache-strategy content .", + "lint:fix": "eslint --cache --cache-strategy content --fix .", "generate:translation": "NODE_PATH=_build:_build/stubs:_build/ext node buildtools/generate_translation_keys.js" }, "keywords": [ diff --git a/test/.eslintrc.js b/test/.eslintrc.js new file mode 100644 index 00000000..e2b4a216 --- /dev/null +++ b/test/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + rules: { + '@typescript-eslint/no-shadow': 'off', + }, +} diff --git a/test/client/lib/localization.ts b/test/client/lib/localization.ts index f66fc09f..adfbc34e 100644 --- a/test/client/lib/localization.ts +++ b/test/client/lib/localization.ts @@ -2,14 +2,14 @@ import {makeT, t} from 'app/client/lib/localization'; import {assert} from 'chai'; import i18next, {i18n} from 'i18next'; import {Disposable, dom, DomContents, observable} from "grainjs"; -import {popGlobals, pushGlobals, G} from 'grainjs/dist/cjs/lib/browserGlobals'; +import {G, popGlobals, pushGlobals} from 'grainjs/dist/cjs/lib/browserGlobals'; import {JSDOM} from 'jsdom'; describe('localization', function() { let instance: i18n; before(() => { instance = i18next.createInstance(); - instance.init({ + void instance.init({ lng: 'en', resources: { en: { diff --git a/test/server/lib/DocApi.ts b/test/server/lib/DocApi.ts index 8b20861a..f32388d0 100644 --- a/test/server/lib/DocApi.ts +++ b/test/server/lib/DocApi.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-shadow */ import {ActionSummary} from 'app/common/ActionSummary'; import {BulkColValues, UserAction} from 'app/common/DocActions'; import {arrayRepeat} from 'app/common/gutil'; @@ -2103,7 +2104,10 @@ function testDocApi() { }); it("GET /docs/{did}/download/xlsx returns 404 if tableId is invalid", async function() { - const resp = await axios.get(`${serverUrl}/api/docs/${docIds.TestDoc}/download/xlsx?tableId=MissingTableId`, chimpy); + const resp = await axios.get( + `${serverUrl}/api/docs/${docIds.TestDoc}/download/xlsx?tableId=MissingTableId`, + chimpy + ); assert.equal(resp.status, 404); assert.deepEqual(resp.data, { error: 'Table MissingTableId not found.' }); }); diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 46b3943b..936c96e7 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -3,6 +3,8 @@ "include": [ "app/**/*.js", "app/**/*.ts", + "stubs/**/*.ts", + "stubs/**/*.ts", "test/**/*.js", "test/**/*.ts", "plugins/**/*.js",