diff --git a/.oxlintrc.json b/.oxlintrc.json index 6bd1167c58..1e7e0fcdf0 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -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": [ { diff --git a/dev-docs/src/components/Homepage/index.js b/dev-docs/src/components/Homepage/index.js index 3c1c25f4f0..572a9a40cd 100644 --- a/dev-docs/src/components/Homepage/index.js +++ b/dev-docs/src/components/Homepage/index.js @@ -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't know + where to start? ), }, diff --git a/dev-docs/tsconfig.json b/dev-docs/tsconfig.json index 6f4756980d..1877a9cc4a 100644 --- a/dev-docs/tsconfig.json +++ b/dev-docs/tsconfig.json @@ -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": {} } diff --git a/excalidraw-app/App.tsx b/excalidraw-app/App.tsx index 7cc2f8ef53..c30c681562 100644 --- a/excalidraw-app/App.tsx +++ b/excalidraw-app/App.tsx @@ -787,7 +787,7 @@ const ExcalidrawWrapper = () => { height: "100%", }} > -

I'm not a pretzel!

+

I'm not a pretzel!

); } diff --git a/package.json b/package.json index 026aa2f84e..a5569556a7 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/element/src/delta.ts b/packages/element/src/delta.ts index 1f3533ee6a..ca3c9ead4c 100644 --- a/packages/element/src/delta.ts +++ b/packages/element/src/delta.ts @@ -467,6 +467,7 @@ export class Delta { } 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 { 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 { for (const key of Object.keys(partial) as Array) { // 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]; diff --git a/packages/element/src/linearElementEditor.ts b/packages/element/src/linearElementEditor.ts index 235d0aaa5b..4a6bc798d0 100644 --- a/packages/element/src/linearElementEditor.ts +++ b/packages/element/src/linearElementEditor.ts @@ -1,3 +1,4 @@ +// oxlint-disable typescript/no-misused-spread import { pointCenter, pointFrom, diff --git a/packages/excalidraw/components/App.tsx b/packages/excalidraw/components/App.tsx index e556b57eff..128432893c 100644 --- a/packages/excalidraw/components/App.tsx +++ b/packages/excalidraw/components/App.tsx @@ -1,3 +1,4 @@ +// oxlint-disable typescript/no-misused-spread import clsx from "clsx"; import throttle from "lodash.throttle"; import React, { useContext } from "react"; diff --git a/packages/excalidraw/renderer/staticSvgScene.ts b/packages/excalidraw/renderer/staticSvgScene.ts index c07e2c77be..f469685958 100644 --- a/packages/excalidraw/renderer/staticSvgScene.ts +++ b/packages/excalidraw/renderer/staticSvgScene.ts @@ -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%"; diff --git a/tsconfig.json b/tsconfig.json index 45a29dd618..622374dc76 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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/*"], diff --git a/yarn.lock b/yarn.lock index 5c4cf06e71..1af8db2b2b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"