mirror of
https://github.com/element-hq/element-desktop
synced 2025-03-25 18:23:36 +01:00
Switch from Eslint + Typescript-eslint + Prettier to Biome + Oxlint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
7c858d358b
commit
91c3b60370
@ -1,88 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: ["matrix-org", "n"],
|
||||
extends: ["plugin:matrix-org/javascript"],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2021,
|
||||
project: ["tsconfig.json"],
|
||||
},
|
||||
env: {
|
||||
es6: true,
|
||||
node: true,
|
||||
// we also have some browser code (ie. the preload script)
|
||||
browser: true,
|
||||
},
|
||||
// NOTE: These rules are frozen and new rules should not be added here.
|
||||
// New changes belong in https://github.com/matrix-org/eslint-plugin-matrix-org/
|
||||
rules: {
|
||||
"quotes": "off",
|
||||
"indent": "off",
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"no-async-promise-executor": "off",
|
||||
|
||||
"n/file-extension-in-import": ["error", "always"],
|
||||
"unicorn/prefer-node-protocol": ["error"],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ["src/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["hak/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
parserOptions: {
|
||||
project: ["hak/tsconfig.json"],
|
||||
},
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["scripts/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
parserOptions: {
|
||||
project: ["scripts/tsconfig.json"],
|
||||
},
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["playwright/**/*.ts"],
|
||||
extends: ["plugin:matrix-org/typescript"],
|
||||
parserOptions: {
|
||||
project: ["playwright/tsconfig.json"],
|
||||
},
|
||||
rules: {
|
||||
// Things we do that break the ideal style
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"quotes": "off",
|
||||
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// We're okay with assertion errors when we ask for them
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
@ -1,21 +0,0 @@
|
||||
/build/
|
||||
/dockerbuild/
|
||||
/lib/
|
||||
/node_modules/
|
||||
/packages.elememt.io/
|
||||
/webapp
|
||||
/src/i18n/strings
|
||||
/CHANGELOG.md
|
||||
/package-lock.json
|
||||
/yarn.lock
|
||||
/playwright/html-report
|
||||
/playwright/test-results
|
||||
|
||||
**/.idea
|
||||
.vscode
|
||||
.vscode/
|
||||
.tmp
|
||||
.env
|
||||
/coverage
|
||||
/.npmrc
|
||||
/*.log
|
@ -1 +0,0 @@
|
||||
module.exports = require("eslint-plugin-matrix-org/.prettierrc.js");
|
204
biome.jsonc
Normal file
204
biome.jsonc
Normal file
@ -0,0 +1,204 @@
|
||||
{
|
||||
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"useEditorconfig": true,
|
||||
"formatWithErrors": false,
|
||||
"indentStyle": "space",
|
||||
"indentWidth": 4,
|
||||
"lineEnding": "lf",
|
||||
"lineWidth": 120,
|
||||
"attributePosition": "auto",
|
||||
"bracketSpacing": true,
|
||||
"ignore": [
|
||||
"../element-web",
|
||||
"./build/",
|
||||
"./docker/",
|
||||
"./dist/**",
|
||||
"./.hak/**",
|
||||
"./dockerbuild/",
|
||||
"./lib/",
|
||||
"./node_modules/",
|
||||
"./packages.elememt.io/",
|
||||
"./webapp",
|
||||
"./src/i18n/strings",
|
||||
"./CHANGELOG.md",
|
||||
"./package-lock.json",
|
||||
"./yarn.lock",
|
||||
"./playwright/html-report",
|
||||
"./playwright/test-results",
|
||||
"**/.idea",
|
||||
"**/.vscode",
|
||||
"**/.vscode/",
|
||||
"**/.tmp",
|
||||
"**/.env",
|
||||
"./coverage",
|
||||
"./.npmrc",
|
||||
"./*.log"
|
||||
]
|
||||
},
|
||||
"organizeImports": { "enabled": false },
|
||||
"linter": {
|
||||
"enabled": false,
|
||||
"rules": {
|
||||
"recommended": false,
|
||||
"complexity": {
|
||||
"noExtraBooleanCast": "error",
|
||||
"noMultipleSpacesInRegularExpressionLiterals": "error",
|
||||
"noUselessCatch": "off",
|
||||
"noWith": "error"
|
||||
},
|
||||
"correctness": {
|
||||
"noConstAssign": "error",
|
||||
"noConstantCondition": "error",
|
||||
"noEmptyCharacterClassInRegex": "error",
|
||||
"noEmptyPattern": "error",
|
||||
"noGlobalObjectCalls": "error",
|
||||
"noInnerDeclarations": "error",
|
||||
"noInvalidConstructorSuper": "error",
|
||||
"noNewSymbol": "error",
|
||||
"noNonoctalDecimalEscape": "error",
|
||||
"noPrecisionLoss": "error",
|
||||
"noSelfAssign": "error",
|
||||
"noSetterReturn": "error",
|
||||
"noSwitchDeclarations": "error",
|
||||
"noUndeclaredVariables": "error",
|
||||
"noUnreachable": "error",
|
||||
"noUnreachableSuper": "error",
|
||||
"noUnsafeFinally": "error",
|
||||
"noUnsafeOptionalChaining": "error",
|
||||
"noUnusedLabels": "error",
|
||||
"noUnusedVariables": "error",
|
||||
"useArrayLiterals": "error",
|
||||
"useIsNan": "error",
|
||||
"useValidForDirection": "error",
|
||||
"useYield": "error"
|
||||
},
|
||||
"style": {
|
||||
"noArguments": "error",
|
||||
"noVar": "error",
|
||||
"useBlockStatements": "error",
|
||||
"useConsistentBuiltinInstantiation": "error",
|
||||
"useConst": "error",
|
||||
"useNodejsImportProtocol": "error",
|
||||
"useSingleVarDeclarator": "error",
|
||||
"useThrowOnlyError": "error"
|
||||
},
|
||||
"suspicious": {
|
||||
"noAssignInExpressions": "error",
|
||||
"noAsyncPromiseExecutor": "off",
|
||||
"noCatchAssign": "error",
|
||||
"noClassAssign": "error",
|
||||
"noCompareNegZero": "error",
|
||||
"noConsole": "off",
|
||||
"noControlCharactersInRegex": "error",
|
||||
"noDebugger": "error",
|
||||
"noDuplicateCase": "error",
|
||||
"noDuplicateClassMembers": "error",
|
||||
"noDuplicateObjectKeys": "error",
|
||||
"noDuplicateParameters": "error",
|
||||
"noEmptyBlockStatements": "error",
|
||||
"noFallthroughSwitchClause": "error",
|
||||
"noFunctionAssign": "error",
|
||||
"noGlobalAssign": "error",
|
||||
"noImportAssign": "error",
|
||||
"noMisleadingCharacterClass": "error",
|
||||
"noPrototypeBuiltins": "off",
|
||||
"noRedeclare": "error",
|
||||
"noShadowRestrictedNames": "error",
|
||||
"noSparseArray": "error",
|
||||
"noUnsafeNegation": "error",
|
||||
"useGetterReturn": "error",
|
||||
"useIsArray": "error",
|
||||
"useValidTypeof": "error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"jsxQuoteStyle": "double",
|
||||
"quoteProperties": "asNeeded",
|
||||
"trailingCommas": "all",
|
||||
"semicolons": "always",
|
||||
"arrowParentheses": "always",
|
||||
"bracketSameLine": false,
|
||||
"quoteStyle": "double",
|
||||
"attributePosition": "auto",
|
||||
"bracketSpacing": true
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"include": ["src/**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": { "noNonNullAssertion": "off" },
|
||||
"suspicious": { "noExplicitAny": "off" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["hak/**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": { "noNonNullAssertion": "off" },
|
||||
"suspicious": { "noExplicitAny": "off" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["scripts/**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": { "noNonNullAssertion": "off" },
|
||||
"suspicious": { "noExplicitAny": "off" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["playwright/**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": { "noNonNullAssertion": "off" },
|
||||
"suspicious": { "noExplicitAny": "off" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["src/**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": { "noNonNullAssertion": "off" },
|
||||
"suspicious": { "noExplicitAny": "off" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["hak/**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": { "noNonNullAssertion": "off" },
|
||||
"suspicious": { "noExplicitAny": "off" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["scripts/**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": { "noNonNullAssertion": "off" },
|
||||
"suspicious": { "noExplicitAny": "off" }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["playwright/**/*.ts"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": { "noNonNullAssertion": "off" },
|
||||
"suspicious": { "noExplicitAny": "off" }
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -13,7 +13,7 @@ import type HakEnv from "../../scripts/hak/hakEnv.js";
|
||||
import type { Tool } from "../../scripts/hak/hakEnv.js";
|
||||
import type { DependencyInfo } from "../../scripts/hak/dep.js";
|
||||
|
||||
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||
export default async function (hakEnv: HakEnv, _moduleInfo: DependencyInfo): Promise<void> {
|
||||
const tools: Tool[] = [
|
||||
["rustc", "--version"],
|
||||
["python", "--version"], // node-gyp uses python for reasons beyond comprehension
|
||||
@ -33,7 +33,7 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
|
||||
const rustc = childProcess.execFile(
|
||||
"rustc",
|
||||
["--target", hakEnv.getTargetId(), "--emit=obj", "-o", "tmp", "-"],
|
||||
(err, out) => {
|
||||
(err) => {
|
||||
if (err) {
|
||||
reject(
|
||||
"rustc can't build for target " +
|
||||
|
19
package.json
19
package.json
@ -20,15 +20,15 @@
|
||||
"scripts": {
|
||||
"i18n": "matrix-gen-i18n && yarn i18n:sort && yarn i18n:lint",
|
||||
"i18n:sort": "jq --sort-keys '.' src/i18n/strings/en_EN.json > src/i18n/strings/en_EN.json.tmp && mv src/i18n/strings/en_EN.json.tmp src/i18n/strings/en_EN.json",
|
||||
"i18n:lint": "prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null",
|
||||
"i18n:lint": "biome format --log-level=none --write src/i18n/strings/",
|
||||
"i18n:diff": "cp src/i18n/strings/en_EN.json src/i18n/strings/en_EN_orig.json && yarn i18n && matrix-compare-i18n-files src/i18n/strings/en_EN_orig.json src/i18n/strings/en_EN.json",
|
||||
"mkdirs": "mkdirp packages deploys",
|
||||
"fetch": "yarn run mkdirs && tsx scripts/fetch-package.ts",
|
||||
"asar-webapp": "asar p webapp webapp.asar",
|
||||
"start": "yarn run build:ts && yarn run build:res && electron .",
|
||||
"lint": "yarn lint:types && yarn lint:js && yarn lint:workflows",
|
||||
"lint:js": "eslint --max-warnings 0 src hak playwright scripts && prettier --check .",
|
||||
"lint:js-fix": "eslint --fix --max-warnings 0 src hak playwright scripts && prettier --log-level=warn --write .",
|
||||
"lint:js": "biome lint",
|
||||
"lint:js-fix": "biome lint --write",
|
||||
"lint:types": "yarn lint:types:src && yarn lint:types:test && yarn lint:types:scripts && yarn lint:types:hak",
|
||||
"lint:types:src": "tsc --noEmit",
|
||||
"lint:types:test": "tsc --noEmit -p playwright/tsconfig.json",
|
||||
@ -74,16 +74,14 @@
|
||||
"@babel/core": "^7.18.10",
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
"@electron/asar": "3.3.1",
|
||||
"@playwright/test": "1.51.0",
|
||||
"@stylistic/eslint-plugin": "^3.0.0",
|
||||
"@types/auto-launch": "^5.0.1",
|
||||
"@types/counterpart": "^0.18.1",
|
||||
"@types/minimist": "^1.2.1",
|
||||
"@types/node": "18.19.79",
|
||||
"@types/pacote": "^11.1.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"app-builder-lib": "26.0.11",
|
||||
"chokidar": "^4.0.0",
|
||||
"detect-libc": "^2.0.0",
|
||||
@ -91,22 +89,15 @@
|
||||
"electron-builder": "26.0.11",
|
||||
"electron-builder-squirrel-windows": "26.0.11",
|
||||
"electron-devtools-installer": "^4.0.0",
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"eslint-config-prettier": "^10.0.0",
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
"eslint-plugin-matrix-org": "^2.0.1",
|
||||
"eslint-plugin-n": "^17.12.0",
|
||||
"eslint-plugin-unicorn": "^56.0.0",
|
||||
"glob": "^11.0.0",
|
||||
"husky": "^9.1.6",
|
||||
"knip": "^5.0.0",
|
||||
"lint-staged": "^15.2.10",
|
||||
"matrix-web-i18n": "^3.2.1",
|
||||
"mkdirp": "^3.0.0",
|
||||
"oxlint": "^0.16.0",
|
||||
"pacote": "^21.0.0",
|
||||
"plist": "^3.1.0",
|
||||
"prettier": "^3.0.0",
|
||||
"rimraf": "^6.0.0",
|
||||
"tar": "^7.0.0",
|
||||
"tsx": "^4.19.2",
|
||||
|
@ -63,7 +63,7 @@ test.describe("App launch", () => {
|
||||
|
||||
// XXX: this test works fine locally but in CI the app start races with the test plumbing up the stdout/stderr pipes
|
||||
// which means the logs are missed, disabling for now.
|
||||
test.skip("should respect option", async ({ page, stdout }) => {
|
||||
test.skip("should respect option", async ({ page: _page, stdout }) => {
|
||||
expect(stdout.data.toString()).toContain("Auto update disabled via command line flag");
|
||||
});
|
||||
});
|
||||
|
@ -568,7 +568,7 @@ function beforeQuit(): void {
|
||||
app.on("before-quit", beforeQuit);
|
||||
autoUpdater.on("before-quit-for-update", beforeQuit);
|
||||
|
||||
app.on("second-instance", (ev, commandLine, workingDirectory) => {
|
||||
app.on("second-instance", (_ev, commandLine) => {
|
||||
// If other instance launched with --hidden then skip showing window
|
||||
if (commandLine.includes("--hidden")) return;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user