Switch from eslint to oxlint (#34166)

* Fix type imports

* Fix jsdoc

* Fixup types

* Fix stray awaits on non-thenables

* Fixup imports

* Fix splats

* Fix this-context on callbacks

* Memoise react contexts

* Prefer find/flatMap

* Make oxlint happier about our React keys

* Avoid unsafe default function params

* Fixup jsdoc

* Fixup contexts

* Switch from eslint to oxlint

* Some oxlint-related tweaks

* Iterate

* Partial revert to defer some changes and shrink diff

* Iterate

* Add eslint-plugin-element-call and enable the copyright rule

* Set strictStorePkgContentCheck

* Iterate

* Make sonar happy

* Fix new lints
This commit is contained in:
Michael Telatynski
2026-07-10 09:47:41 +00:00
committed by GitHub
parent 549dd1b7a8
commit 15c85ec50f
176 changed files with 1294 additions and 2876 deletions
-75
View File
@@ -1,75 +0,0 @@
module.exports = {
plugins: ["matrix-org", "eslint-plugin-react-compiler"],
extends: ["plugin:matrix-org/typescript", "plugin:matrix-org/react", "plugin:matrix-org/a11y"],
parserOptions: {
project: true,
},
env: {
browser: true,
node: true,
},
rules: {
"react/jsx-key": ["error"],
"no-restricted-properties": [
"error",
...buildRestrictedPropertiesOptions(
["window.innerHeight", "window.innerWidth", "window.visualViewport"],
"Use UIStore to access window dimensions instead.",
),
...buildRestrictedPropertiesOptions(
["*.mxcUrlToHttp", "*.getHttpUriForMxc"],
"Use Media helper instead to centralise access for customisation.",
),
...buildRestrictedPropertiesOptions(["window.setImmediate"], "Use setTimeout instead."),
],
"no-restricted-globals": [
"error",
{
name: "setImmediate",
message: "Use setTimeout instead.",
},
{
name: "Buffer",
message: "Buffer is not available in the web.",
},
],
"import/no-duplicates": ["error"],
"matrix-org/require-copyright-header": "error",
"react-compiler/react-compiler": "error",
},
overrides: [
{
files: ["playwright/**/*.ts", "*/e2e/**/*.{ts,tsx}", "*/src/**/*.test.{ts,tsx}"],
rules: {
// This is necessary for Playwright fixtures
"no-empty-pattern": "off",
// This is necessary for Playwright fixtures
"react-hooks/rules-of-hooks": "off",
// This just gets annoying in test code
"@typescript-eslint/explicit-function-return-type": "off",
},
},
],
settings: {
react: {
version: "19",
},
},
};
function buildRestrictedPropertiesOptions(properties, message) {
return properties.map((prop) => {
let [object, property] = prop.split(".");
if (object === "*") {
object = undefined;
}
return {
object,
property,
message,
};
});
}
-3
View File
@@ -1,3 +0,0 @@
{
"*": "oxfmt --no-error-on-unmatched-pattern"
}
+1 -2
View File
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { input } from "zod/mini";
import { type input } from "zod/mini";
import { test as base, expect } from "../../playwright/element-web-test.ts";
import { type ConfigSchema } from "../src/config.ts";
@@ -160,7 +160,6 @@ test.describe("Banner", () => {
await expect(sidebar).toMatchScreenshot(`${type}_menu_loading.png`);
navigationJsonResolver.resolve();
}
await page.pause();
const emailApp = page.getByText("E-Mail");
await expect(emailApp).toHaveAttribute("href", "https://example.com/email");
@@ -14,7 +14,7 @@ const HiddenIFrame = styled.iframe`
interface Props {
icsUrl: string;
onLoggedIn(success: boolean): void;
onLoggedIn(this: void, success: boolean): void;
}
const SilentLogin: FC<Props> = ({ onLoggedIn, icsUrl }) => {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src"]
+1 -9
View File
@@ -3,21 +3,13 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"lint:js": "eslint --max-warnings 0 playwright */src -c ./.eslintrc.cjs",
"lint:types": "nx lint:types --",
"test:playwright": "nx test:playwright --",
"test:playwright:open": "nx test:playwright -- --ui",
"test:playwright:screenshots": "nx test:playwright:screenshots --"
},
"devDependencies": {
"@element-hq/element-web-playwright-common": "workspace:*",
"eslint": "8",
"eslint-config-google": "^0.14.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-matrix-org": "^3.0.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
"eslint-plugin-unicorn": "^56.0.0"
"@element-hq/element-web-playwright-common": "workspace:*"
},
"private": true
}
+1 -1
View File
@@ -6,7 +6,7 @@ Please see LICENSE files in the repository root for full details.
*/
import {
StartedSynapseContainer,
type StartedSynapseContainer,
SynapseContainer,
} from "@element-hq/element-web-playwright-common/lib/testcontainers/index.js";
import { Readable } from "node:stream";
+1 -1
View File
@@ -16,7 +16,7 @@ import RegisterDialog from "./RegisterDialog.tsx";
interface Props {
api: Api;
config: ModuleConfig;
onLoggedIn(data: AccountAuthInfo): void;
onLoggedIn(this: void, data: AccountAuthInfo): void;
}
const Container = styled.aside`
+2 -1
View File
@@ -10,7 +10,8 @@
"moduleResolution": "bundler",
"module": "ESNext",
"allowImportingTsExtensions": true,
"skipLibCheck": true
"skipLibCheck": true,
"noEmit": true
},
"include": ["playwright.config.ts", "playwright"]
}
+2 -2
View File
@@ -1,8 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"jsx": "react-jsx"
"jsx": "react-jsx",
"noEmit": true
},
"include": ["src"]
}