more react rules & support type-aware linting for later

This commit is contained in:
dwelle
2026-01-25 18:20:13 +01:00
parent 29ba7fe96d
commit e1f6429e49
11 changed files with 93 additions and 8 deletions
+38 -1
View File
@@ -64,8 +64,43 @@
"allowReferrer": true
}
],
"jsx-a11y/no-autofocus": "off",
"eslint/no-unreachable": "warn",
// react
"react/jsx-no-comment-textnodes": "error",
"react/iframe-missing-sandbox": "warn",
"react/rules-of-hooks": "error",
"react/no-unescaped-entities": "warn",
// for later
// ----------
// "react/no-array-index-key": "warn",
// "react/jsx-no-useless-fragment": "warn",
// will require major refactor
// ---------------------------
// "react/only-export-components": "warn",
// type-aware rules (requires --type-aware flag)
// -------------------------------------------------------------------------
"typescript/switch-exhaustiveness-check": "warn",
"typescript/unbound-method": [
"warn",
{
"ignoreStatic": true
}
],
// disabled rules
// -------------------------------------------------------------------------
// may be re-enabled later
"typescript/no-redundant-type-constituents": "off",
"typescript/no-unsafe-unary-minus": "off",
"typescript/no-floating-promises": "off",
// not planned
"eslint/no-async-promise-executor": "off",
"jsx-a11y/no-autofocus": "off",
"eslint-plugin-jsx-a11y/click-events-have-key-events": "off",
"eslint-plugin-jsx-a11y/label-has-associated-control": "off"
},
@@ -80,6 +115,8 @@
"examples/**/public",
"dev-dist",
"coverage"
// "**/tests/**",
// "**/*.test*"
],
"overrides": [
{
+2 -2
View File
@@ -16,8 +16,8 @@ const FeatureList = [
Svg: require("@site/static/img/undraw_blank_canvas.svg").default,
description: (
<>
Want to build your own app powered by Excalidraw but don't know where to
start?
Want to build your own app powered by Excalidraw but don&apos;t know
where to start?
</>
),
},
+1 -3
View File
@@ -1,7 +1,5 @@
{
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@tsconfig/docusaurus/tsconfig.json",
"compilerOptions": {
"baseUrl": "."
}
"compilerOptions": {}
}
+1 -1
View File
@@ -787,7 +787,7 @@ const ExcalidrawWrapper = () => {
height: "100%",
}}
>
<h1>I'm not a pretzel!</h1>
<h1>I&apos;m not a pretzel!</h1>
</div>
);
}
+2
View File
@@ -32,6 +32,7 @@
"test:coverage:watch": "vitest --coverage --watch",
"test:ui": "yarn test --ui --coverage.enabled=true",
"lint": "oxlint",
"lint:type-aware": "oxlint --type-aware",
"lint:fix": "oxlint --fix",
"format:fix": "oxfmt",
"fix": "yarn lint:fix && yarn format:fix",
@@ -65,6 +66,7 @@
"lint-staged": "12.3.7",
"oxfmt": "0.26.0",
"oxlint": "1.41.0",
"oxlint-tsgolint": "0.11.1",
"pepjs": "0.5.3",
"rewire": "6.0.0",
"rimraf": "^5.0.0",
+3
View File
@@ -467,6 +467,7 @@ export class Delta<T> {
} else {
assertNever(
join,
// oxlint-disable-next-line typescript/restrict-template-expressions
`Unknown distinctKeysIterator's join param "${join}"`,
true,
);
@@ -860,6 +861,7 @@ export class AppStateDelta implements DeltaContainer<AppState> {
default:
assertNever(
key,
// oxlint-disable-next-line typescript/restrict-template-expressions
`Unknown ObservedElementsAppState's key "${key}"`,
true,
);
@@ -1332,6 +1334,7 @@ export class ElementsDelta implements DeltaContainer<SceneElementsMap> {
for (const key of Object.keys(partial) as Array<keyof typeof partial>) {
// do not update following props:
// - `boundElements`, as it is a reference value which is postprocessed to contain only deleted/inserted keys
// oxlint-disable-next-line typescript/switch-exhaustiveness-check
switch (key) {
case "boundElements":
latestPartial[key] = partial[key];
@@ -1,3 +1,4 @@
// oxlint-disable typescript/no-misused-spread
import {
pointCenter,
pointFrom,
+1
View File
@@ -1,3 +1,4 @@
// oxlint-disable typescript/no-misused-spread
import clsx from "clsx";
import throttle from "lodash.throttle";
import React, { useContext } from "react";
@@ -262,7 +262,9 @@ const renderElementToSvg = (
div.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
div.style.width = "100%";
div.style.height = "100%";
// oxlint-disable-next-line react/iframe-missing-sandbox
const iframe = div.ownerDocument.createElement("iframe");
iframe.setAttribute("sandbox", "");
iframe.src = embedLink?.link ?? "";
iframe.style.width = "100%";
iframe.style.height = "100%";
-1
View File
@@ -17,7 +17,6 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
"@excalidraw/common": ["./packages/common/src/index.ts"],
"@excalidraw/common/*": ["./packages/common/src/*"],
+42
View File
@@ -1879,6 +1879,36 @@
resolved "https://registry.yarnpkg.com/@oxfmt/win32-x64/-/win32-x64-0.26.0.tgz#592f45e38bd18a8f176c3dd6fa9ef3ca58d27240"
integrity sha512-m8TfIljU22i9UEIkD+slGPifTFeaCwIUfxszN3E6ABWP1KQbtwSw9Ak0TdoikibvukF/dtbeyG3WW63jv9DnEg==
"@oxlint-tsgolint/darwin-arm64@0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@oxlint-tsgolint/darwin-arm64/-/darwin-arm64-0.11.1.tgz#1d96695c044186e26c305c735e0fa68fcc513898"
integrity sha512-UJIOFeJZpFTJIGS+bMdFXcvjslvnXBEouMvzynfQD7RTazcFIRLbokYgEbhrN2P6B352Ut1TUtvR0CLAp/9QfA==
"@oxlint-tsgolint/darwin-x64@0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@oxlint-tsgolint/darwin-x64/-/darwin-x64-0.11.1.tgz#03eb7dee24f958352f0ca54fd974621374758599"
integrity sha512-68O8YvexIm+ISZKl2vBFII1dMfLrteDyPcuCIecDuiBIj2tV0KYq13zpSCMz4dvJUWJW6RmOOGZKrkkvOAy6uQ==
"@oxlint-tsgolint/linux-arm64@0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@oxlint-tsgolint/linux-arm64/-/linux-arm64-0.11.1.tgz#46a5f46899ef05987874ce7be1a5cb230ef71c19"
integrity sha512-hXBInrFxPNbPPbPQYozo8YpSsFFYdtHBWRUiLMxul71vTy1CdSA7H5Qq2KbrKomr/ASmhvIDVAQZxh9hIJNHMA==
"@oxlint-tsgolint/linux-x64@0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@oxlint-tsgolint/linux-x64/-/linux-x64-0.11.1.tgz#963b4197edd109ba14535461070db68faa5343db"
integrity sha512-aMaGctlwrJhaIQPOdVJR+AGHZGPm4D1pJ457l0SqZt4dLXAhuUt2ene6cUUGF+864R7bDyFVGZqbZHODYpENyA==
"@oxlint-tsgolint/win32-arm64@0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@oxlint-tsgolint/win32-arm64/-/win32-arm64-0.11.1.tgz#3a737021a8fa7b212d0c914eedb9bccd3e287e47"
integrity sha512-ipOs6kKo8fz5n5LSHvcbyZFmEpEIsh2m7+B03RW3jGjBEPMiXb4PfKNuxnusFYTtJM9WaR3bCVm5UxeJTA8r3w==
"@oxlint-tsgolint/win32-x64@0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@oxlint-tsgolint/win32-x64/-/win32-x64-0.11.1.tgz#30587956e2a3a8d5dea20c486c23d03f21c04b1c"
integrity sha512-m2apsAXg6qU3ulQG45W/qshyEpOjoL+uaQyXJG5dBoDoa66XPtCaSkBlKltD0EwGu0aoB8lM4I5I3OzQ6raNhw==
"@oxlint/darwin-arm64@1.41.0":
version "1.41.0"
resolved "https://registry.yarnpkg.com/@oxlint/darwin-arm64/-/darwin-arm64-1.41.0.tgz#e8cca78873b1fc7fe2e90babb3b7f0c56b70c3b8"
@@ -7088,6 +7118,18 @@ oxfmt@0.26.0:
"@oxfmt/win32-arm64" "0.26.0"
"@oxfmt/win32-x64" "0.26.0"
oxlint-tsgolint@0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/oxlint-tsgolint/-/oxlint-tsgolint-0.11.1.tgz#8ca311e38ee755df453740819d9ee1f0857ef5e8"
integrity sha512-WulCp+0/6RvpM4zPv+dAXybf03QvRA8ATxaBlmj4XMIQqTs5jeq3cUTk48WCt4CpLwKhyyGZPHmjLl1KHQ/cvA==
optionalDependencies:
"@oxlint-tsgolint/darwin-arm64" "0.11.1"
"@oxlint-tsgolint/darwin-x64" "0.11.1"
"@oxlint-tsgolint/linux-arm64" "0.11.1"
"@oxlint-tsgolint/linux-x64" "0.11.1"
"@oxlint-tsgolint/win32-arm64" "0.11.1"
"@oxlint-tsgolint/win32-x64" "0.11.1"
oxlint@1.41.0:
version "1.41.0"
resolved "https://registry.yarnpkg.com/oxlint/-/oxlint-1.41.0.tgz#6eb85e7d5fc45a4a55f25775bd60cafba4a293c1"