Skip to content

Commit bec02c9

Browse files
committed
Iterate
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 91c3b60 commit bec02c9

32 files changed

+142
-260
lines changed

.lintstagedrc

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"*": "prettier --write",
3-
"*.(ts|tsx)": ["eslint --fix"]
2+
"*": ["biome check --no-errors-on-unmatched --files-ignore-unknown=true"]
43
}

biome.jsonc

+23-91
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
{
22
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": []
11+
},
312
"formatter": {
413
"enabled": true,
514
"useEditorconfig": true,
@@ -9,43 +18,17 @@
918
"lineEnding": "lf",
1019
"lineWidth": 120,
1120
"attributePosition": "auto",
12-
"bracketSpacing": true,
13-
"ignore": [
14-
"../element-web",
15-
"./build/",
16-
"./docker/",
17-
"./dist/**",
18-
"./.hak/**",
19-
"./dockerbuild/",
20-
"./lib/",
21-
"./node_modules/",
22-
"./packages.elememt.io/",
23-
"./webapp",
24-
"./src/i18n/strings",
25-
"./CHANGELOG.md",
26-
"./package-lock.json",
27-
"./yarn.lock",
28-
"./playwright/html-report",
29-
"./playwright/test-results",
30-
"**/.idea",
31-
"**/.vscode",
32-
"**/.vscode/",
33-
"**/.tmp",
34-
"**/.env",
35-
"./coverage",
36-
"./.npmrc",
37-
"./*.log"
38-
]
21+
"bracketSpacing": true
3922
},
40-
"organizeImports": { "enabled": false },
23+
"organizeImports": { "enabled": true },
4124
"linter": {
42-
"enabled": false,
25+
"enabled": true,
4326
"rules": {
4427
"recommended": false,
4528
"complexity": {
4629
"noExtraBooleanCast": "error",
4730
"noMultipleSpacesInRegularExpressionLiterals": "error",
48-
"noUselessCatch": "off",
31+
"noUselessCatch": "error",
4932
"noWith": "error"
5033
},
5134
"correctness": {
@@ -77,16 +60,18 @@
7760
"style": {
7861
"noArguments": "error",
7962
"noVar": "error",
80-
"useBlockStatements": "error",
63+
"useBlockStatements": "off",
8164
"useConsistentBuiltinInstantiation": "error",
8265
"useConst": "error",
8366
"useNodejsImportProtocol": "error",
8467
"useSingleVarDeclarator": "error",
85-
"useThrowOnlyError": "error"
68+
"useThrowOnlyError": "error",
69+
"useImportType": "error",
70+
"useExportType": "error"
8671
},
8772
"suspicious": {
8873
"noAssignInExpressions": "error",
89-
"noAsyncPromiseExecutor": "off",
74+
"noAsyncPromiseExecutor": "error",
9075
"noCatchAssign": "error",
9176
"noClassAssign": "error",
9277
"noCompareNegZero": "error",
@@ -103,7 +88,7 @@
10388
"noGlobalAssign": "error",
10489
"noImportAssign": "error",
10590
"noMisleadingCharacterClass": "error",
106-
"noPrototypeBuiltins": "off",
91+
"noPrototypeBuiltins": "error",
10792
"noRedeclare": "error",
10893
"noShadowRestrictedNames": "error",
10994
"noSparseArray": "error",
@@ -129,25 +114,7 @@
129114
},
130115
"overrides": [
131116
{
132-
"include": ["src/**/*.ts"],
133-
"linter": {
134-
"rules": {
135-
"style": { "noNonNullAssertion": "off" },
136-
"suspicious": { "noExplicitAny": "off" }
137-
}
138-
}
139-
},
140-
{
141-
"include": ["hak/**/*.ts"],
142-
"linter": {
143-
"rules": {
144-
"style": { "noNonNullAssertion": "off" },
145-
"suspicious": { "noExplicitAny": "off" }
146-
}
147-
}
148-
},
149-
{
150-
"include": ["scripts/**/*.ts"],
117+
"include": ["src/**/*.ts", "hak/**/*.ts", "scripts/**/*.ts", "playwright/**/*.ts"],
151118
"linter": {
152119
"rules": {
153120
"style": { "noNonNullAssertion": "off" },
@@ -159,44 +126,9 @@
159126
"include": ["playwright/**/*.ts"],
160127
"linter": {
161128
"rules": {
162-
"style": { "noNonNullAssertion": "off" },
163-
"suspicious": { "noExplicitAny": "off" }
164-
}
165-
}
166-
},
167-
{
168-
"include": ["src/**/*.ts"],
169-
"linter": {
170-
"rules": {
171-
"style": { "noNonNullAssertion": "off" },
172-
"suspicious": { "noExplicitAny": "off" }
173-
}
174-
}
175-
},
176-
{
177-
"include": ["hak/**/*.ts"],
178-
"linter": {
179-
"rules": {
180-
"style": { "noNonNullAssertion": "off" },
181-
"suspicious": { "noExplicitAny": "off" }
182-
}
183-
}
184-
},
185-
{
186-
"include": ["scripts/**/*.ts"],
187-
"linter": {
188-
"rules": {
189-
"style": { "noNonNullAssertion": "off" },
190-
"suspicious": { "noExplicitAny": "off" }
191-
}
192-
}
193-
},
194-
{
195-
"include": ["playwright/**/*.ts"],
196-
"linter": {
197-
"rules": {
198-
"style": { "noNonNullAssertion": "off" },
199-
"suspicious": { "noExplicitAny": "off" }
129+
"correctness": {
130+
"noEmptyPattern": "off"
131+
}
200132
}
201133
}
202134
}

electron-builder.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import * as os from "node:os";
21
import * as fs from "node:fs";
2+
import { readFile, writeFile } from "node:fs/promises";
3+
import * as os from "node:os";
34
import * as path from "node:path";
4-
import * as plist from "plist";
5-
import { AfterPackContext, Arch, Configuration as BaseConfiguration, Platform } from "electron-builder";
65
import { computeData } from "app-builder-lib/out/asar/integrity";
7-
import { readFile, writeFile } from "node:fs/promises";
6+
import { type AfterPackContext, Arch, type Configuration as BaseConfiguration, Platform } from "electron-builder";
7+
import * as plist from "plist";
88

99
/**
1010
* This script has different outputs depending on your os platform.

hak/matrix-seshat/build.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
66
Please see LICENSE files in the repository root for full details.
77
*/
88

9-
import type HakEnv from "../../scripts/hak/hakEnv.js";
109
import type { DependencyInfo } from "../../scripts/hak/dep.js";
10+
import type HakEnv from "../../scripts/hak/hakEnv.js";
1111

1212
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
1313
const env = hakEnv.makeGypEnv();

hak/matrix-seshat/check.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Please see LICENSE files in the repository root for full details.
99
import childProcess from "node:child_process";
1010
import fsProm from "node:fs/promises";
1111

12+
import type { DependencyInfo } from "../../scripts/hak/dep.js";
1213
import type HakEnv from "../../scripts/hak/hakEnv.js";
1314
import type { Tool } from "../../scripts/hak/hakEnv.js";
14-
import type { DependencyInfo } from "../../scripts/hak/dep.js";
1515

1616
export default async function (hakEnv: HakEnv, _moduleInfo: DependencyInfo): Promise<void> {
1717
const tools: Tool[] = [

knip.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { KnipConfig } from "knip";
1+
import type { KnipConfig } from "knip";
22

33
export default {
44
entry: ["src/electron-main.ts", "src/preload.ts", "electron-builder.ts", ".eslintrc-*.js", "scripts/**", "hak/**"],

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"asar-webapp": "asar p webapp webapp.asar",
2828
"start": "yarn run build:ts && yarn run build:res && electron .",
2929
"lint": "yarn lint:types && yarn lint:js && yarn lint:workflows",
30-
"lint:js": "biome lint",
31-
"lint:js-fix": "biome lint --write",
30+
"lint:js": "biome check",
31+
"lint:js-fix": "biome check --write",
3232
"lint:types": "yarn lint:types:src && yarn lint:types:test && yarn lint:types:scripts && yarn lint:types:hak",
3333
"lint:types:src": "tsc --noEmit",
3434
"lint:types:test": "tsc --noEmit -p playwright/tsconfig.json",
@@ -95,7 +95,6 @@
9595
"lint-staged": "^15.2.10",
9696
"matrix-web-i18n": "^3.2.1",
9797
"mkdirp": "^3.0.0",
98-
"oxlint": "^0.16.0",
9998
"pacote": "^21.0.0",
10099
"plist": "^3.1.0",
101100
"rimraf": "^6.0.0",

playwright/e2e/launch/config-options.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
55
Please see LICENSE files in the repository root for full details.
66
*/
77

8-
import { resolve, dirname } from "node:path";
8+
import { dirname, resolve } from "node:path";
99
import { fileURLToPath } from "node:url";
1010

11-
import { test, expect } from "../../element-desktop-test.js";
11+
import { expect, test } from "../../element-desktop-test.js";
1212

1313
const __dirname = dirname(fileURLToPath(import.meta.url));
1414

playwright/e2e/launch/launch.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Please see LICENSE files in the repository root for full details.
88

99
import { platform } from "node:os";
1010

11-
import { test, expect } from "../../element-desktop-test.js";
11+
import { expect, test } from "../../element-desktop-test.js";
1212

1313
declare global {
1414
interface Window {

playwright/element-desktop-test.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
66
Please see LICENSE files in the repository root for full details.
77
*/
88

9-
import { _electron as electron, test as base, expect as baseExpect, type ElectronApplication } from "@playwright/test";
109
import fs from "node:fs/promises";
11-
import path, { dirname } from "node:path";
1210
import os from "node:os";
13-
import { fileURLToPath } from "node:url";
11+
import path, { dirname } from "node:path";
1412
import { PassThrough } from "node:stream";
13+
import { fileURLToPath } from "node:url";
14+
import { type ElectronApplication, test as base, expect as baseExpect, _electron as electron } from "@playwright/test";
1515

1616
/**
1717
* A PassThrough stream that captures all data written to it.
@@ -50,16 +50,13 @@ export const test = base.extend<Fixtures>({
5050
extraEnv: {},
5151
extraArgs: [],
5252

53-
// eslint-disable-next-line no-empty-pattern
5453
stdout: async ({}, use) => {
5554
await use(new CapturedPassThrough());
5655
},
57-
// eslint-disable-next-line no-empty-pattern
5856
stderr: async ({}, use) => {
5957
await use(new CapturedPassThrough());
6058
},
6159

62-
// eslint-disable-next-line no-empty-pattern
6360
tmpDir: async ({}, use) => {
6461
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "element-desktop-tests-"));
6562
console.log("Using temp profile directory: ", tmpDir);

scripts/copy-res.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
// copies resources into the lib directory.
44

5-
import parseArgs from "minimist";
6-
import * as chokidar from "chokidar";
7-
import * as path from "node:path";
85
import * as fs from "node:fs";
6+
import * as path from "node:path";
7+
import * as chokidar from "chokidar";
8+
import parseArgs from "minimist";
99

1010
const argv = parseArgs(process.argv.slice(2), {});
1111

scripts/fetch-package.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env -S npx tsx --resolveJsonModule
22

3-
import * as path from "node:path";
4-
import { createWriteStream, promises as fs } from "node:fs";
53
import * as childProcess from "node:child_process";
6-
import * as tar from "tar";
7-
import * as asar from "@electron/asar";
4+
import { promises as fs, createWriteStream } from "node:fs";
5+
import * as path from "node:path";
86
import { promises as stream } from "node:stream";
7+
import * as asar from "@electron/asar";
8+
import * as tar from "tar";
99

1010
import riotDesktopPackageJson from "../package.json";
1111
import { setPackageVersion } from "./set-version.js";
@@ -27,7 +27,9 @@ async function downloadToFile(url: string, filename: string): Promise<void> {
2727
console.error(e);
2828
try {
2929
await fs.unlink(filename);
30-
} catch {}
30+
} catch {
31+
// ignore
32+
}
3133
throw e;
3234
}
3335
}
@@ -151,7 +153,9 @@ async function main(): Promise<number | undefined> {
151153
await fs.opendir(expectedDeployDir);
152154
console.log(expectedDeployDir + "already exists");
153155
haveDeploy = true;
154-
} catch {}
156+
} catch {
157+
// ignore
158+
}
155159

156160
if (!haveDeploy) {
157161
const outPath = path.join(pkgDir, filename);
@@ -207,7 +211,9 @@ async function main(): Promise<number | undefined> {
207211
await fs.stat(ASAR_PATH);
208212
console.log(ASAR_PATH + " already present: removing");
209213
await fs.unlink(ASAR_PATH);
210-
} catch {}
214+
} catch {
215+
// ignore
216+
}
211217

212218
if (cfgDir.length) {
213219
const configJsonSource = path.join(cfgDir, "config.json");

scripts/hak/copy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
66
Please see LICENSE files in the repository root for full details.
77
*/
88

9-
import path from "node:path";
10-
import fsProm from "node:fs/promises";
119
import childProcess from "node:child_process";
10+
import fsProm from "node:fs/promises";
11+
import path from "node:path";
1212
import { glob } from "glob";
1313
import { mkdirp } from "mkdirp";
1414

15-
import type HakEnv from "./hakEnv.js";
1615
import type { DependencyInfo } from "./dep.js";
16+
import type HakEnv from "./hakEnv.js";
1717

1818
export default async function copy(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
1919
if (moduleInfo.cfg.copy) {

scripts/hak/fetch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Please see LICENSE files in the repository root for full details.
99
import fsProm from "node:fs/promises";
1010
import pacote from "pacote";
1111

12-
import type HakEnv from "./hakEnv.js";
1312
import type { DependencyInfo } from "./dep.js";
13+
import type HakEnv from "./hakEnv.js";
1414

1515
export default async function fetch(hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
1616
let haveModuleBuildDir;

scripts/hak/hakEnv.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
66
Please see LICENSE files in the repository root for full details.
77
*/
88

9-
import path from "node:path";
9+
import childProcess, { type SpawnOptions } from "node:child_process";
1010
import os from "node:os";
11+
import path from "node:path";
1112
import { getElectronVersionFromInstalled } from "app-builder-lib/out/electron/electronVersion.js";
12-
import childProcess, { type SpawnOptions } from "node:child_process";
1313

14-
import { type Arch, type Target, TARGETS, getHost, isHostId, type TargetId } from "./target.js";
14+
import { type Arch, TARGETS, type Target, type TargetId, getHost, isHostId } from "./target.js";
1515

1616
async function getRuntimeVersion(projectRoot: string): Promise<string> {
1717
const electronVersion = await getElectronVersionFromInstalled(projectRoot);

0 commit comments

Comments
 (0)