From f96fffb83fdd72689f749429a68f761152a08125 Mon Sep 17 00:00:00 2001 From: Danila Poyarkov Date: Mon, 9 Mar 2026 09:05:04 +0300 Subject: [PATCH] Harden oxlint: consistent-type-imports, no-duplicates, no-misused-promises, prefer-optional-chain Add 6 new lint rules: typescript/consistent-type-imports, typescript/no-unnecessary-type-assertion, typescript/prefer-optional-chain, typescript/no-misused-promises, import/no-duplicates, import/no-mutable-exports. Ban @/types shim via no-restricted-imports. Fix all violations: replace inline import() annotations with proper type imports, merge duplicate module imports, add void to fire-and-forget promises, convert && chains to optional chaining. --- oxlint.json | 16 +++++++++++++ src/components/FontPicker.vue | 3 ++- src/components/LayerTree.vue | 4 ++-- src/components/Toolbar.vue | 4 ++-- src/components/VariablesDialog.vue | 8 +++---- src/components/properties/StrokeSection.vue | 3 +-- src/composables/use-canvas-input.ts | 4 ++-- src/composables/use-canvas.ts | 5 ++-- src/composables/use-collab.ts | 8 +++---- src/composables/use-keyboard.ts | 2 +- src/composables/use-menu.ts | 12 +++++----- src/stores/editor.ts | 26 ++++++++++++--------- src/stores/tabs.ts | 2 +- 13 files changed, 58 insertions(+), 39 deletions(-) diff --git a/oxlint.json b/oxlint.json index 7b2f41899..b911cb815 100644 --- a/oxlint.json +++ b/oxlint.json @@ -8,13 +8,29 @@ "rules": { "no-unused-vars": "warn", "no-console": "off", + "no-restricted-imports": ["error", { + "paths": [ + { "name": "@/types", "message": "Import types directly from @open-pencil/core." } + ], + "patterns": [{ + "group": ["@/engine/*"], + "message": "Import from @open-pencil/core unless the module adds platform-specific logic.", + "allowImportNames": ["loadFont", "listFamilies", "preloadFonts"] + }] + }], "typescript/no-explicit-any": "warn", "typescript/no-non-null-assertion": "warn", "typescript/no-floating-promises": "error", + "typescript/no-misused-promises": "error", + "typescript/consistent-type-imports": "error", + "typescript/no-unnecessary-type-assertion": "error", + "typescript/prefer-optional-chain": "error", "import/no-cycle": "error", "import/no-self-import": "error", + "import/no-duplicates": "error", + "import/no-mutable-exports": "error", "unicorn/no-instanceof-array": "error", "unicorn/no-typeof-undefined": "error", diff --git a/src/components/FontPicker.vue b/src/components/FontPicker.vue index 3320c3ba7..1d294089b 100644 --- a/src/components/FontPicker.vue +++ b/src/components/FontPicker.vue @@ -1,8 +1,9 @@