Refactor 24 complex functions across 14 files by extracting dispatch branches and property-group handlers into focused helpers. kiwi/kiwi-convert.ts (4 functions, was 22-81): - nodeChangeToProps → 6 property-group converters - convertOverrideToProps → 5 override applicators - importStyleRuns → 3 style-run helpers - mapNodeType → NODE_TYPE_MAP lookup table kiwi/instance-overrides.ts (3 functions, was 28-44): - applyDerivedSymbolData → resolveDsd* helpers - applyComponentProperties → assignment/override applicators - propagateOverridesTransitively → clone/sync helpers kiwi/fig-import.ts (2 functions, was 34-40): - importNodeChanges → buildChangeMaps, importPages, etc. - importVariables → importCollections, resolveVariableType, etc. render/export-jsx.ts (2 functions, was 70-85): - collectProps → property-category extractors - collectTailwindClasses → Tailwind class-group extractors render/renderer.ts: propsToOverrides (78) → style-category helpers renderer/scene.ts: renderNode (46), renderShapeUncached (30) → phase extractors (transforms, content, children, strokes) renderer/renderer.ts: buildParagraph (34) → buildTruncateOpts, addStyledRuns svg-export.ts: split into svg-export.ts + svg-export-defs.ts + svg-export-paths.ts; renderNode/renderTextNode/nodeShapeElements all reduced via helper extraction kiwi-serialize.ts: sceneNodeToKiwi (44) → 6 property serializers clipboard.ts: importClipboardNodes (36) → 5 focused helpers scene-graph.ts: hitTestChildren (31) → containsPoint, hitTestOpaqueContainer, hitTestTransparentContainer tools/analyze.ts: serializeNodeProps (23) → 4 prop serializers
124 lines
4.2 KiB
JSON
124 lines
4.2 KiB
JSON
{
|
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
"plugins": ["typescript", "import", "unicorn", "vue"],
|
|
"jsPlugins": ["./lint/plugin.js"],
|
|
"env": {
|
|
"browser": true,
|
|
"es2024": true
|
|
},
|
|
"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"]
|
|
}]
|
|
}],
|
|
|
|
"no-empty-function": "error",
|
|
"max-lines": ["warn", { "max": 600 }],
|
|
"complexity": ["error", { "max": 20 }],
|
|
|
|
"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/consistent-return": "error",
|
|
"typescript/no-unnecessary-condition": "error",
|
|
"typescript/no-unnecessary-type-assertion": "error",
|
|
"typescript/no-unnecessary-type-parameters": "error",
|
|
"typescript/no-unnecessary-boolean-literal-compare": "error",
|
|
"typescript/no-unnecessary-template-expression": "error",
|
|
"typescript/no-unnecessary-type-arguments": "error",
|
|
"typescript/prefer-optional-chain": "error",
|
|
"typescript/prefer-for-of": "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",
|
|
"unicorn/no-nested-ternary": "error",
|
|
|
|
"unicorn/no-useless-fallback-in-spread": "error",
|
|
"unicorn/no-length-as-slice-end": "error",
|
|
"unicorn/no-unnecessary-await": "error",
|
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
"unicorn/consistent-existence-index-check": "error",
|
|
|
|
"vue/no-arrow-functions-in-watch": "error",
|
|
"vue/no-deprecated-destroyed-lifecycle": "error",
|
|
"vue/no-export-in-script-setup": "error",
|
|
"vue/no-lifecycle-after-await": "error",
|
|
"vue/no-import-compiler-macros": "error",
|
|
"vue/prefer-import-from-vue": "error",
|
|
"vue/valid-define-emits": "error",
|
|
"vue/valid-define-props": "error",
|
|
"vue/no-required-prop-with-default": "error",
|
|
"vue/no-multiple-slot-args": "error",
|
|
"vue/define-emits-declaration": "error",
|
|
"vue/define-props-destructuring": "error",
|
|
"vue/require-typed-ref": "error",
|
|
|
|
"open-pencil/no-inline-named-types": ["error", {
|
|
"Vector": "x:number,y:number",
|
|
"Color": "a:number,b:number,g:number,r:number",
|
|
"GUID": "localID:number,sessionID:number",
|
|
"Rect": "height:number,width:number,x:number,y:number",
|
|
"Matrix": "m00:number,m01:number,m02:number,m10:number,m11:number,m12:number"
|
|
}],
|
|
"open-pencil/no-structuredclone-scene-arrays": "error",
|
|
"open-pencil/no-math-random": "error",
|
|
"open-pencil/no-hand-rolled-color": "error",
|
|
"open-pencil/no-raw-console-format": "off"
|
|
},
|
|
"overrides": [
|
|
{
|
|
"files": ["**/*.test.ts", "**/*.test.tsx"],
|
|
"rules": {
|
|
"typescript/no-explicit-any": "off",
|
|
"typescript/no-non-null-assertion": "off"
|
|
}
|
|
},
|
|
|
|
{
|
|
"files": ["**/kiwi/kiwi-schema/**"],
|
|
"rules": {
|
|
"typescript/no-explicit-any": "off",
|
|
"typescript/no-non-null-assertion": "off",
|
|
"typescript/prefer-for-of": "off",
|
|
"typescript/prefer-optional-chain": "off",
|
|
"typescript/consistent-type-imports": "off",
|
|
"typescript/no-unnecessary-condition": "off",
|
|
"import/no-mutable-exports": "off",
|
|
"complexity": "off"
|
|
}
|
|
},
|
|
{
|
|
"files": [
|
|
"src/stores/editor.ts",
|
|
"src/composables/use-canvas-input.ts",
|
|
"src/demo.ts"
|
|
],
|
|
"rules": {
|
|
"max-lines": "off"
|
|
}
|
|
},
|
|
{
|
|
"files": ["packages/cli/src/commands/**"],
|
|
"rules": {
|
|
"open-pencil/no-raw-console-format": "error"
|
|
}
|
|
}
|
|
],
|
|
"ignorePatterns": ["node_modules", "dist", "desktop", "*.config.*"]
|
|
}
|