AI-native design editor. Open-source Figma alternative.
refactor: replace complex conditional object spreads
Danila Poyarkov9bb94788336c
diff --git a/bun.lock b/bun.lockindex 9f7f39725..0c00a1593 100644--- a/bun.lock+++ b/bun.lock@@ -100,8 +100,10 @@"@types/node": "^25.9.5","@types/opentype.js": "^1.3.10","@types/ws": "^8.18.1",+ "@typescript-eslint/utils": "^8.67.0","@typescript/native-preview": "^7.0.0-dev.20260707.2","@vitejs/plugin-vue": "^6.0.8",+ "@vue/compiler-core": "^3.5.41","@wdio/cli": "9.30.1","@wdio/globals": "9.29.1","@wdio/local-runner": "9.30.1",@@ -789,6 +791,20 @@"@esbuild/win32-x64": ["@esbuild/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg=="],+ "@eslint-community/eslint-utils": ["@eslint-community/[email protected]", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg=="],++ "@eslint-community/regexpp": ["@eslint-community/[email protected]", "", {}, "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew=="],++ "@eslint/config-array": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/object-schema": "^3.0.5", "debug": "^4.3.1", "minimatch": "^10.2.4" } }, "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA=="],++ "@eslint/config-helpers": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^1.2.1" } }, "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw=="],++ "@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ=="],++ "@eslint/object-schema": ["@eslint/[email protected]", "", {}, "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw=="],++ "@eslint/plugin-kit": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^1.2.1", "levn": "^0.4.1" } }, "sha512-+CNAzxglkrpNf/kKywqQfk74QjtceuOE7Qm+AF8miRvPF/wmmK5+OJOgVh3AVTT3RP2mH3+FOaxlE5v72owk0A=="],+"@ethersproject/bytes": ["@ethersproject/[email protected]", "", { "dependencies": { "@ethersproject/logger": "^5.8.0" } }, "sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A=="],"@ethersproject/logger": ["@ethersproject/[email protected]", "", {}, "sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA=="],@@ -905,6 +921,16 @@"@hono/node-server": ["@hono/[email protected]", "", { "peerDependencies": { "hono": "^4" } }, "sha512-dSneS5qhiauZWGDCeK4o695Xd9nUNjviSZCMQrj10eetr8Uln1ucn6bbphOM6UynAMMtNIzZNSpL9vnASJwrPQ=="],+ "@humanfs/core": ["@humanfs/[email protected]", "", { "dependencies": { "@humanfs/types": "^0.15.0" } }, "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA=="],++ "@humanfs/node": ["@humanfs/[email protected]", "", { "dependencies": { "@humanfs/core": "^0.19.2", "@humanfs/types": "^0.15.0", "@humanwhocodes/retry": "^0.4.0" } }, "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ=="],++ "@humanfs/types": ["@humanfs/[email protected]", "", {}, "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q=="],++ "@humanwhocodes/module-importer": ["@humanwhocodes/[email protected]", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="],++ "@humanwhocodes/retry": ["@humanwhocodes/[email protected]", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="],+"@iconify-json/lucide": ["@iconify-json/[email protected]", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-mO6JyBVNER7uXEkW2bXiN9Rrm6w91IXxwnNmIMbu2KZX0ZPcVZH1xDUTw94pryxESUIpBhinkOUIZIav+TA9ng=="],"@iconify-json/simple-icons": ["@iconify-json/[email protected]", "", { "dependencies": { "@iconify/types": "*" } }, "sha512-/XhANjfGYOuqvSR3TmUnkQkINvQ4GVjVuukvymRbxtVFBvIq/yiXJqCDycKcQPT401OYT9H2vIY6ihAlz1QIAw=="],@@ -1719,6 +1745,8 @@"@types/diff": ["@types/[email protected]", "", { "dependencies": { "diff": "*" } }, "sha512-o7jqJM04gfaYrdCecCVMbZhNdG6T1MHg/oQoRFdERLV+4d+V7FijhiEAbFu0Usww84Yijk9yH58U4Jk4HbtzZw=="],+ "@types/esrecurse": ["@types/[email protected]", "", {}, "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw=="],+"@types/estree": ["@types/[email protected]", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="],"@types/geojson": ["@types/[email protected]", "", {}, "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg=="],@@ -1733,6 +1761,8 @@"@types/jsesc": ["@types/[email protected]", "", {}, "sha512-9VN+6yxLOPLOav+7PwjZbxiID2bVaeq0ED4qSQmdQTdjnXJSaCVKTR58t15oqH1H5t8Ng2ZX1SabJVoN9Q34bw=="],+ "@types/json-schema": ["@types/[email protected]", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],+"@types/katex": ["@types/[email protected]", "", {}, "sha512-trgaNyfU+Xh2Tc+ABIb44a5AYUpicB3uwirOioeOkNPPbmgRNtcWyDeeFRzjPZENO9Vq8gvVqfhaaXWLlevVwg=="],"@types/linkify-it": ["@types/[email protected]", "", {}, "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q=="],@@ -1795,15 +1825,19 @@"@types/yauzl": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q=="],- "@typescript-eslint/project-service": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.67.0", "@typescript-eslint/types": "^8.67.0", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-cvE8c7ulYeXN9fYuszhCeCsbzyVEXuhrRCybnBre7TUmqb5nRmBfQAwCj0O3WJFDeyAZt4VYv51vMCC9LHSdYw=="],+ "@typescript-eslint/project-service": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.69.0", "@typescript-eslint/types": "^8.69.0", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-yi4obFrHMmnsesWehHbkg9zMA7Jt8cXT+mKM08G999pH1yT6nqgsHx7MYm0uY1wAj8CqiBXYRJ7WAT0QdQHQXg=="],- "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/[email protected]", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-vV+LUSv5njUWsknE71fqKTlXUva+R76SaeORd6Zojcunk/6DvKFXONU3BrAs2H49mbygUXt6gbYunzwqNwlhdg=="],+ "@typescript-eslint/scope-manager": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.69.0", "@typescript-eslint/visitor-keys": "8.69.0" } }, "sha512-ewfspqWvSxKSOaplqAUNbaSFO0eB6w1EtQ+esfYFRm3614Ty4uNtExkcbgd6nWsXphbqKyf9ZYdbZdv2xEoWEQ=="],- "@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-sBtgslww8nsMYUjhdPBiSyUqSzT8uR6g93A2QXnQC8+cGdjz0CyaOdqHDRJb1AtORbZCNUJBBeFA/tNR2uQmww=="],+ "@typescript-eslint/tsconfig-utils": ["@typescript-eslint/[email protected]", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-xNqK7YTDZsLniQMV/4rpFR8Z5JlqeRvVjuG1YgF/mdPVH84HSD19L8CczMA0qg2RfwEV231GHH3VnToJDo4MfQ=="],- "@typescript-eslint/typescript-estree": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/project-service": "8.67.0", "@typescript-eslint/tsconfig-utils": "8.67.0", "@typescript-eslint/types": "8.67.0", "@typescript-eslint/visitor-keys": "8.67.0", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-EKQBCE9yNlRJYm7jdTW5AhDacDUmSwQb0FAJAmK2EKYrNXIsa2vxcSZx6PvJ/dEdI6lS+Y9W+EXckLj0iPFGcw=="],+ "@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-K3VrubUPhlo9VDBS6QdI8YB5j7ClpqLRdefcz6PFrhnwicehBweqQ9Evhl4l+FYz0HdDmMqIiSX0aldGRYtDCA=="],- "@typescript-eslint/visitor-keys": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.67.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-fkv8dHRDqfGtTHuJeebdrQ7cX6Ad4WAS00rgHh9UGvMycF1mjBfsxry1XsLIFhWZ6Judlh6UdzK+TYlbpCXgnA=="],+ "@typescript-eslint/typescript-estree": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/project-service": "8.69.0", "@typescript-eslint/tsconfig-utils": "8.69.0", "@typescript-eslint/types": "8.69.0", "@typescript-eslint/visitor-keys": "8.69.0", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-AdFkgqck3Vudb/kWnxlyafU/4aBhHrbQ9locP2N4psXTy5mOBg0SHJumnLvx7r6g1gV4DKvUFwV2nJZBoqOD8w=="],++ "@typescript-eslint/utils": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.69.0", "@typescript-eslint/types": "8.69.0", "@typescript-eslint/typescript-estree": "8.69.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } }, "sha512-tUbx60BBqQa31kXF5MCsOOLL5E/WzUuxIn7YpAvq+eaUlqvk8/NXnXMBNAdLCr0icjkzem7iUA5QqWHe/hJ1aw=="],++ "@typescript-eslint/visitor-keys": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.69.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-+rmdgPA+EXkNgKYvHvFfhrs35utXbwaC5PGpDquSXcoXQDKUA5UjV0LmTucG/4JXkM31BTu4TilHtrN8IVBe8w=="],"@typescript/native-preview": ["@typescript/[email protected]", "", { "optionalDependencies": { "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260707.2", "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260707.2", "@typescript/native-preview-linux-arm": "7.0.0-dev.20260707.2", "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260707.2", "@typescript/native-preview-linux-x64": "7.0.0-dev.20260707.2", "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260707.2", "@typescript/native-preview-win32-x64": "7.0.0-dev.20260707.2" }, "bin": { "tsgo": "bin/tsgo" } }, "sha512-oUGp+Rep/hqMhPunyinsALUwSlzHINSxitifPiSaeqoKOKD2OlR9NE3TaPqwsl4NlGslsOSUXI1JotWQzpYCPg=="],@@ -2011,6 +2045,8 @@"acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="],+ "acorn-jsx": ["[email protected]", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="],+"agent-base": ["[email protected]", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="],"agentfmt": ["[email protected]", "", { "dependencies": { "picocolors": "^1.1.1" } }, "sha512-BVSZr8ovigxjYewuBx42Ep4RJj00HURaQYUQ+id41sgb7r0PMUSEWsnD/+h96xj6t6v2WVyPuGPH0K6RtjftKQ=="],@@ -2409,6 +2445,8 @@"deep-extend": ["[email protected]", "", {}, "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="],+ "deep-is": ["[email protected]", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="],+"deepmerge": ["[email protected]", "", {}, "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="],"deepmerge-ts": ["[email protected]", "", {}, "sha512-gQhL1ksGBLQbHeAo47YU6cs2ahd3Pv+8PFYoWogNZbQnNwQyOh9Ad5kbeHFiWwbKdeWQJ5Z7Y7mwb9ew2hXBLw=="],@@ -2519,7 +2557,7 @@"enhanced-resolve": ["[email protected]", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.3.3" } }, "sha512-L1l8TNvomm6UVW5B253AGxQagSQr+vGwhMlrrfRS2qmhx46AMpMVJKQYLvWYbysTMY8VoicOvzHzoHMbyzB+4A=="],- "entities": ["[email protected]", "", {}, "sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA=="],+ "entities": ["[email protected]", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="],"env-paths": ["[email protected]", "", {}, "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="],@@ -2553,12 +2591,22 @@"escodegen": ["[email protected]", "", { "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", "esutils": "^2.0.2" }, "optionalDependencies": { "source-map": "~0.6.1" }, "bin": { "esgenerate": "bin/esgenerate.js", "escodegen": "bin/escodegen.js" } }, "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w=="],- "eslint-visitor-keys": ["[email protected]", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],+ "eslint": ["[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.5", "@eslint/config-helpers": "^0.7.0", "@eslint/core": "^1.2.1", "@eslint/plugin-kit": "^0.7.2", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^10.2.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-9VaAkDURekixUQJy0oJYl2DcN6oKMfxay7XzaGYAWQwsb6qfKf+x76R2k1L8kb1boc+FyCAaTA9GmiKaaiaF+A=="],++ "eslint-scope": ["[email protected]", "", { "dependencies": { "@types/esrecurse": "^4.3.1", "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ=="],++ "eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],"esm-resolve": ["[email protected]", "", {}, "sha512-LxF0wfUQm3ldUDHkkV2MIbvvY0TgzIpJ420jHSV1Dm+IlplBEWiJTKWM61GtxUfvjV6iD4OtTYFGAGM2uuIUWg=="],+ "espree": ["[email protected]", "", { "dependencies": { "acorn": "^8.16.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^5.0.1" } }, "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw=="],+"esprima": ["[email protected]", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],+ "esquery": ["[email protected]", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g=="],++ "esrecurse": ["[email protected]", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="],+"estraverse": ["[email protected]", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="],"estree-walker": ["[email protected]", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],@@ -2617,6 +2665,8 @@"fast-json-stable-stringify": ["[email protected]", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="],+ "fast-levenshtein": ["[email protected]", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="],+"fast-png": ["[email protected]", "", { "dependencies": { "@types/pako": "^2.0.3", "iobuffer": "^5.3.2", "pako": "^2.1.0" } }, "sha512-kAqZq1TlgBjZcLr5mcN6NP5Rv4V2f22z00c3g8vRrwkcqjerx7BEhPbOnWCPqaHUl2XWQBJQvOT/FQhdMT7X/Q=="],"fast-unique-numbers": ["[email protected]", "", { "dependencies": { "@babel/runtime": "^7.29.2", "tslib": "^2.8.1" } }, "sha512-nDA9ADeINN8SA2u2wCtU+siWFTTDqQR37XvgPIDDmboWQeExz7X0mImxuaN+kJddliIqy2FpVRmnvRZ+j8i1/A=="],@@ -2647,6 +2697,8 @@"figures": ["[email protected]", "", { "dependencies": { "is-unicode-supported": "^2.0.0" } }, "sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg=="],+ "file-entry-cache": ["[email protected]", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="],+"file-type": ["[email protected]", "", { "dependencies": { "@tokenizer/inflate": "^0.4.1", "strtok3": "^10.3.4", "token-types": "^6.1.1", "uint8array-extras": "^1.4.0" } }, "sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g=="],"filelist": ["[email protected]", "", { "dependencies": { "minimatch": "^5.0.1" } }, "sha512-5giy2PkLYY1cP39p17Ech+2xlpTRL9HLspOfEgm0L6CwBXBTgsK5ou0JtzYuepxkaQ/tvhCFIJ5uXo0OrM2DxA=="],@@ -2655,7 +2707,7 @@"finalhandler": ["[email protected]", "", { "dependencies": { "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "on-finished": "^2.4.1", "parseurl": "^1.3.3", "statuses": "^2.0.1" } }, "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA=="],- "find-up": ["[email protected]", "", { "dependencies": { "locate-path": "^7.1.0", "path-exists": "^5.0.0" } }, "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw=="],+ "find-up": ["[email protected]", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="],"find-up-simple": ["[email protected]", "", {}, "sha512-afd4O7zpqHeRyg4PfDQsXmlDe2PfdHtJt6Akt8jOWaApLOZk5JXs6VMR29lz03pRe9mpykrRCYIYxaJYcfpncQ=="],@@ -2663,6 +2715,10 @@"flat": ["[email protected]", "", { "bin": { "flat": "cli.js" } }, "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ=="],+ "flat-cache": ["[email protected]", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="],++ "flatted": ["[email protected]", "", {}, "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q=="],+"floating-vue": ["[email protected]", "", { "dependencies": { "@floating-ui/dom": "~1.1.1", "vue-resize": "^2.0.0-alpha.1" }, "peerDependencies": { "@nuxt/kit": "^3.2.0", "vue": "^3.2.0" }, "optionalPeers": ["@nuxt/kit"] }, "sha512-afW+h2CFafo+7Y9Lvw/xsqjaQlKLdJV7h1fCHfcYQ1C4SVMlu7OAekqWgu5d4SgvkBVU0pVpLlVsrSTBURFRkg=="],"focus-trap": ["[email protected]", "", { "dependencies": { "tabbable": "^6.5.0" } }, "sha512-qV0g8hRYBqgACcFOH3f9wXc4zPKhr/0z9RI2a6ZijZ72EeBi4g8oBy8zAWuUR1TsMpOzwpUMFvjdasrC41Joug=="],@@ -2745,7 +2801,7 @@"glob": ["[email protected]", "", { "dependencies": { "foreground-child": "^3.1.0", "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg=="],- "glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],+ "glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],"globalthis": ["[email protected]", "", { "dependencies": { "define-properties": "^1.2.1", "gopd": "^1.0.1" } }, "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ=="],@@ -2833,7 +2889,7 @@"ieee754": ["[email protected]", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],- "ignore": ["[email protected]", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],+ "ignore": ["[email protected]", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],"image-size": ["[email protected]", "", { "dependencies": { "queue": "6.0.2" }, "bin": { "image-size": "bin/image-size.js" } }, "sha512-rH+46sQJ2dlwfjfhCyNx5thzrv+dtmBIhPHk0zgRUukHzZ/kRueTJXoYYsclBaKcSMBWuGbOFXtioLpzTb5euw=="],@@ -2847,6 +2903,8 @@"import-without-cache": ["[email protected]", "", {}, "sha512-NkJQA7oZ4YHQhd2+H3BoRFKF3d/XNsiKpHZCQEMH9pDX27hQQLsTyOocyRgaIVtf8gHX3Nt3LPkR4e5EdtPAGQ=="],+ "imurmurhash": ["[email protected]", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],+"indent-string": ["[email protected]", "", {}, "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg=="],"inflight": ["[email protected]", "", { "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA=="],@@ -3053,6 +3111,8 @@"json-bigint": ["[email protected]", "", { "dependencies": { "bignumber.js": "^9.0.0" } }, "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ=="],+ "json-buffer": ["[email protected]", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="],+"json-parse-even-better-errors": ["[email protected]", "", {}, "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w=="],"json-schema": ["[email protected]", "", {}, "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="],@@ -3063,6 +3123,8 @@"json-schema-typed": ["[email protected]", "", {}, "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA=="],+ "json-stable-stringify-without-jsonify": ["[email protected]", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="],+"json5": ["[email protected]", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],"jsonc-parser": ["[email protected]", "", {}, "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ=="],@@ -3085,6 +3147,8 @@"katex": ["[email protected]", "", { "dependencies": { "commander": "^8.3.0" }, "bin": { "katex": "cli.js" } }, "sha512-Eeo8Ys1doU1z+x8AZsPpQu+p/QcZBI5PeOo7QGQdy2x2m0MU/hYagBbGOmXwr5KVbEfVuWv9LpnQWeehogurjg=="],+ "keyv": ["[email protected]", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="],+"khroma": ["[email protected]", "", {}, "sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw=="],"kind-of": ["[email protected]", "", {}, "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="],@@ -3097,6 +3161,8 @@"leven": ["[email protected]", "", {}, "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A=="],+ "levn": ["[email protected]", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],+"lib0": ["[email protected]", "", { "dependencies": { "isomorphic.js": "^0.2.4" }, "bin": { "0serve": "bin/0serve.js", "0gentesthtml": "bin/gentesthtml.js", "0ecdsa-generate-keypair": "bin/0ecdsa-generate-keypair.js" } }, "sha512-DeXj9X5xDCjgKLU/7RR+/HQEVzuuEUiwldwOGsHK/sfAfELGWEyTcf0x+uOvCvK3O2zPmZePXWL85vtia6GyZw=="],"libp2p": ["[email protected]", "", { "dependencies": { "@chainsafe/is-ip": "^2.1.0", "@chainsafe/netmask": "^2.0.0", "@libp2p/crypto": "^5.1.6", "@libp2p/interface": "^2.10.4", "@libp2p/interface-internal": "^2.3.17", "@libp2p/logger": "^5.1.20", "@libp2p/multistream-select": "^6.0.27", "@libp2p/peer-collections": "^6.0.33", "@libp2p/peer-id": "^5.1.7", "@libp2p/peer-store": "^11.2.5", "@libp2p/utils": "^6.7.0", "@multiformats/dns": "^1.0.6", "@multiformats/multiaddr": "^12.4.4", "@multiformats/multiaddr-matcher": "^1.7.2", "any-signal": "^4.1.1", "datastore-core": "^10.0.2", "interface-datastore": "^8.3.1", "it-byte-stream": "^2.0.2", "it-merge": "^3.0.11", "it-parallel": "^3.0.11", "main-event": "^1.0.1", "multiformats": "^13.3.6", "p-defer": "^4.0.1", "p-retry": "^6.2.1", "progress-events": "^1.0.1", "race-event": "^1.3.0", "race-signal": "^1.1.3", "uint8arrays": "^5.1.0" } }, "sha512-EjkyN0CI6uP+e4OOkEcZvhbZtlwFl4Y0rkkMvDbXmcfILX4E4n/jKE4Ppoc1qhNufxToxVWCMDS2ipniQgiYaw=="],@@ -3135,7 +3201,7 @@"locate-app": ["[email protected]", "", { "dependencies": { "@promptbook/utils": "0.69.5", "type-fest": "4.26.0", "userhome": "1.0.1" } }, "sha512-xIqbzPMBYArJRmPGUZD9CzV9wOqmVtQnaAn3wrj3s6WYW0bQvPI7x+sPYUGmDTYMHefVK//zc6HEYZ1qnxIK+Q=="],- "locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^6.0.0" } }, "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA=="],+ "locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="],"lodash": ["[email protected]", "", {}, "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q=="],@@ -3371,6 +3437,8 @@"napi-build-utils": ["[email protected]", "", {}, "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="],+ "natural-compare": ["[email protected]", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="],+"negotiator": ["[email protected]", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],"netmask": ["[email protected]", "", {}, "sha512-eonl3sLUha+S1GzTPxychyhnUzKyeQkZ7jLjKrBagJgPla13F+uQ71HgpFefyHgqrjEbCPkDArxYsjY8/+gLKA=="],@@ -3439,6 +3507,8 @@"opentype.js": ["[email protected]", "", { "bin": { "ot": "bin/ot" } }, "sha512-kCyjv6xdDY1W/jLWZ/L3QhhTlKUqDZMQ5+Jdlw12b3dXkKNpYBqqlMMj0YDQPShWFTMwgZI1hG14kN3XUDSg/A=="],+ "optionator": ["[email protected]", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],+"own-keys": ["[email protected]", "", { "dependencies": { "call-bound": "^1.0.4", "get-intrinsic": "^1.3.0", "object-keys": "^1.1.1", "safe-push-apply": "^1.0.0" } }, "sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg=="],"oxc-parser": ["[email protected]", "", { "dependencies": { "@oxc-project/types": "^0.137.0" }, "optionalDependencies": { "@oxc-parser/binding-android-arm-eabi": "0.137.0", "@oxc-parser/binding-android-arm64": "0.137.0", "@oxc-parser/binding-darwin-arm64": "0.137.0", "@oxc-parser/binding-darwin-x64": "0.137.0", "@oxc-parser/binding-freebsd-x64": "0.137.0", "@oxc-parser/binding-linux-arm-gnueabihf": "0.137.0", "@oxc-parser/binding-linux-arm-musleabihf": "0.137.0", "@oxc-parser/binding-linux-arm64-gnu": "0.137.0", "@oxc-parser/binding-linux-arm64-musl": "0.137.0", "@oxc-parser/binding-linux-ppc64-gnu": "0.137.0", "@oxc-parser/binding-linux-riscv64-gnu": "0.137.0", "@oxc-parser/binding-linux-riscv64-musl": "0.137.0", "@oxc-parser/binding-linux-s390x-gnu": "0.137.0", "@oxc-parser/binding-linux-x64-gnu": "0.137.0", "@oxc-parser/binding-linux-x64-musl": "0.137.0", "@oxc-parser/binding-openharmony-arm64": "0.137.0", "@oxc-parser/binding-wasm32-wasi": "0.137.0", "@oxc-parser/binding-win32-arm64-msvc": "0.137.0", "@oxc-parser/binding-win32-ia32-msvc": "0.137.0", "@oxc-parser/binding-win32-x64-msvc": "0.137.0" } }, "sha512-yFImD+WLElJpLKy8llG1qe4DCmMsL18peRp8XP1JKfig/gISbJkglnpDtX2aTmAn10kZF7164HbN2H8QPsXxGg=="],@@ -3455,9 +3525,9 @@"p-event": ["[email protected]", "", { "dependencies": { "p-timeout": "^6.1.2" } }, "sha512-Q6Bekk5wpzW5qIyUP4gdMEujObYstZl6DMMOSenwBvV0BlE5LkDwkjs5yHbZmdCEq2o4RJx4tE1vwxFVf2FG1w=="],- "p-limit": ["[email protected]", "", { "dependencies": { "yocto-queue": "^1.0.0" } }, "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ=="],+ "p-limit": ["[email protected]", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="],- "p-locate": ["[email protected]", "", { "dependencies": { "p-limit": "^4.0.0" } }, "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw=="],+ "p-locate": ["[email protected]", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="],"p-queue": ["[email protected]", "", { "dependencies": { "eventemitter3": "^5.0.4", "p-timeout": "^7.0.0" } }, "sha512-NXAOdnEe5FsZJfT4oK84lE1Y5cFFdWlRuOo5tww8DyNMxyRXwn39fIkUtNLKppcPC+UYU/bXujNCUGDv01y7CA=="],@@ -3497,7 +3567,7 @@"path-data-parser": ["[email protected]", "", {}, "sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w=="],- "path-exists": ["[email protected]", "", {}, "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ=="],+ "path-exists": ["[email protected]", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],"path-expression-matcher": ["[email protected]", "", {}, "sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ=="],@@ -3561,6 +3631,8 @@"precinct": ["[email protected]", "", { "dependencies": { "@dependents/detective-less": "^5.0.3", "commander": "^12.1.0", "detective-amd": "^6.1.0", "detective-cjs": "^6.1.1", "detective-es6": "^5.0.2", "detective-postcss": "^8.0.3", "detective-sass": "^6.0.2", "detective-scss": "^5.0.2", "detective-stylus": "^5.0.1", "detective-typescript": "^14.1.2", "detective-vue2": "^2.3.0", "module-definition": "^6.0.2", "node-source-walk": "^7.0.2", "postcss": "^8.5.14", "typescript": "^5.9.3" }, "bin": { "precinct": "bin/cli.js" } }, "sha512-JbJevI1K80z8e/WIyDt/4vUN/4qcfBSKKqOjJA4mosPPPb7zODKRJQV7YN7apVWN3k58nZYm/vEsLgEGYmnxwg=="],+ "prelude-ls": ["[email protected]", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],+"pretty-bytes": ["[email protected]", "", {}, "sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ=="],"pretty-format": ["[email protected]", "", { "dependencies": { "@jest/schemas": "30.4.1", "ansi-styles": "^5.2.0", "react-is-18": "npm:react-is@^18.3.1", "react-is-19": "npm:react-is@^19.2.5" } }, "sha512-K6KiKMHTL4jjX4u3Kir2EW07nRfcqVTXIImx50wbjHQTcZPgg+gjVeNTIT3l3L1Rd4UefxfogquC9J37SoFyyw=="],@@ -3623,6 +3695,8 @@"pump": ["[email protected]", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="],+ "punycode": ["[email protected]", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],+"punycode.js": ["[email protected]", "", {}, "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA=="],"qs": ["[email protected]", "", { "dependencies": { "es-define-property": "^1.0.1", "side-channel": "^1.1.1" } }, "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A=="],@@ -4085,6 +4159,8 @@"twoslash-vue": ["[email protected]", "", { "dependencies": { "@vue/language-core": "^3.2.6", "twoslash": "0.3.9", "twoslash-protocol": "0.3.9" }, "peerDependencies": { "typescript": "^5.5.0 || ^6.0.0" } }, "sha512-2zO1u4iPhZz9k7ysuDaJL1FUn4SHzm78ZF6/0Q4yFR2VP3NW0JwRpw/4cWqEM6ye3pDf8Zr9lVPBvsX4uK315A=="],+ "type-check": ["[email protected]", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="],+"type-detect": ["[email protected]", "", {}, "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw=="],"type-fest": ["[email protected]", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-YGYEVz3Fm5iy/AybuA0oyNFq7H4CgQNfRp/qfe8nurE1kuCeNm3/vfm9X4Mtl+qLyaKJUh5xrFZwogr41SMjYA=="],@@ -4181,6 +4257,8 @@"update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ=="],+ "uri-js": ["[email protected]", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],+"urlpattern-polyfill": ["[email protected]", "", {}, "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw=="],"use-sync-external-store": ["[email protected]", "", { "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w=="],@@ -4287,6 +4365,8 @@"with": ["[email protected]", "", { "dependencies": { "@babel/parser": "^7.9.6", "@babel/types": "^7.9.6", "assert-never": "^1.2.1", "babel-walk": "3.0.0-canary-5" } }, "sha512-RNGKj82nUPg3g5ygxkQl0R937xLyho1J24ItRCBTr/m1YnZkzJy1hUiHUJrc/VlsDQzsCnInEGSg3bci0Lmd4w=="],+ "word-wrap": ["[email protected]", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="],+"workbox-background-sync": ["[email protected]", "", { "dependencies": { "idb": "^7.0.1", "workbox-core": "7.4.1" } }, "sha512-HhT7KE8tOWDm02wRNshXUnUPofMlhenF2DBdUnDPOubhizzPeItkYTmAB6td1Z2cjYPa98vzEiPLEuzn5hN66g=="],"workbox-broadcast-update": ["[email protected]", "", { "dependencies": { "workbox-core": "7.4.1" } }, "sha512-uAlgslKLvbQY+suirIdnBCSYrcgBhjp81Nj4l1lj/Jmj0MJO2CJERnCJjT0GFVwmReV0N+zs78K6gqd5gr9/+A=="],@@ -4363,7 +4443,7 @@"yjs": ["[email protected]", "", { "dependencies": { "lib0": "^0.2.99" } }, "sha512-lfiJIIC4Xayt5ItynE407ehlE03pCjeOc4hkR4yxxvvNJ4kuiN25B0g+Qp8XagYz361LLL7DCzR5bvFJ81QKtQ=="],- "yocto-queue": ["[email protected]", "", {}, "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ=="],+ "yocto-queue": ["[email protected]", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="],"yoctocolors": ["[email protected]", "", {}, "sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg=="],@@ -4415,6 +4495,8 @@"@earendil-works/pi-agent-core/@earendil-works/pi-ai": ["@earendil-works/[email protected]", "", { "dependencies": { "@anthropic-ai/sdk": "0.91.1", "@aws-sdk/client-bedrock-runtime": "3.1048.0", "@google/genai": "1.52.0", "@mistralai/mistralai": "2.2.6", "@opentelemetry/api": "1.9.0", "@smithy/node-http-handler": "4.7.3", "http-proxy-agent": "7.0.2", "https-proxy-agent": "7.0.6", "openai": "6.26.0", "partial-json": "0.1.7", "typebox": "1.1.38" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-Moe/H8c87yacDGK9dPbWphZNjVsrb3nTrIHycOQJAkFEnY9PYxOOd74+ny44kATfPU9Dm7aTHefar3pZF+UKUA=="],+ "@earendil-works/pi-agent-core/ignore": ["[email protected]", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],+"@earendil-works/pi-agent-core/typebox": ["[email protected]", "", {}, "sha512-pZ0aQPmMmXoUvSbeuWf/Hzsc+avNw/Zd6VeE8CFgkVGWyuHPJvqeJJDeJqLve+K70LvjYIoleGcoJHPT17cWoA=="],"@earendil-works/pi-coding-agent/@earendil-works/pi-ai": ["@earendil-works/[email protected]", "", { "dependencies": { "@anthropic-ai/sdk": "0.91.1", "@aws-sdk/client-bedrock-runtime": "3.1048.0", "@google/genai": "1.52.0", "@mistralai/mistralai": "2.2.6", "@opentelemetry/api": "1.9.0", "@smithy/node-http-handler": "4.7.3", "http-proxy-agent": "7.0.2", "https-proxy-agent": "7.0.6", "openai": "6.26.0", "partial-json": "0.1.7", "typebox": "1.1.38" }, "bin": { "pi-ai": "dist/cli.js" } }, "sha512-Moe/H8c87yacDGK9dPbWphZNjVsrb3nTrIHycOQJAkFEnY9PYxOOd74+ny44kATfPU9Dm7aTHefar3pZF+UKUA=="],@@ -4423,6 +4505,8 @@"@earendil-works/pi-coding-agent/glob": ["[email protected]", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" } }, "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw=="],+ "@earendil-works/pi-coding-agent/ignore": ["[email protected]", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],+"@earendil-works/pi-coding-agent/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.5" } }, "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg=="],"@earendil-works/pi-coding-agent/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA=="],@@ -4501,6 +4585,8 @@"@testing-library/jest-dom/dom-accessibility-api": ["[email protected]", "", {}, "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w=="],+ "@typescript-eslint/visitor-keys/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],+"@vitest/expect/@vitest/utils": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/pretty-format": "3.2.4", "loupe": "^3.1.4", "tinyrainbow": "^2.0.0" } }, "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA=="],"@vitest/pretty-format/tinyrainbow": ["[email protected]", "", {}, "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ=="],@@ -4511,8 +4597,6 @@"@vitest/utils/tinyrainbow": ["[email protected]", "", {}, "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw=="],- "@vue/compiler-core/entities": ["[email protected]", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="],-"@vue/devtools-kit/hookable": ["[email protected]", "", {}, "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ=="],"@waku/core/it-length-prefixed": ["[email protected]", "", { "dependencies": { "it-reader": "^6.0.1", "it-stream-types": "^2.0.1", "uint8-varint": "^2.0.1", "uint8arraylist": "^2.0.0", "uint8arrays": "^5.0.1" } }, "sha512-O88nBweT6M9ozsmok68/auKH7ik/slNM4pYbM9lrfy2z5QnpokW5SlrepHZDKtN71llhG2sZvd6uY4SAl+lAQg=="],@@ -4567,8 +4651,6 @@"babel-plugin-polyfill-corejs2/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],- "beautiful-mermaid/entities": ["[email protected]", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="],-"blamer/execa": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.0", "get-stream": "^5.0.0", "human-signals": "^1.1.1", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.0", "onetime": "^5.1.0", "signal-exit": "^3.0.2", "strip-final-newline": "^2.0.0" } }, "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA=="],"body-parser/content-type": ["[email protected]", "", {}, "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag=="],@@ -4605,6 +4687,8 @@"degenerator/ast-types": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w=="],+ "detective-typescript/@typescript-eslint/typescript-estree": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/project-service": "8.67.0", "@typescript-eslint/tsconfig-utils": "8.67.0", "@typescript-eslint/types": "8.67.0", "@typescript-eslint/visitor-keys": "8.67.0", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.5.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-EKQBCE9yNlRJYm7jdTW5AhDacDUmSwQb0FAJAmK2EKYrNXIsa2vxcSZx6PvJ/dEdI6lS+Y9W+EXckLj0iPFGcw=="],+"dom-serializer/entities": ["[email protected]", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="],"easy-table/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],@@ -4615,12 +4699,20 @@"encoding-sniffer/iconv-lite": ["[email protected]", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],+ "eslint/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],++ "eslint/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],++ "espree/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],+"execa/@sindresorhus/merge-streams": ["@sindresorhus/[email protected]", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="],"expect-webdriverio/@vitest/snapshot": ["@vitest/[email protected]", "", { "dependencies": { "@vitest/pretty-format": "4.1.11", "@vitest/utils": "4.1.11", "magic-string": "^0.30.21", "pathe": "^2.0.3" } }, "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog=="],"extract-zip/get-stream": ["[email protected]", "", { "dependencies": { "pump": "^3.0.0" } }, "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA=="],+ "fast-glob/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],+"figures/is-unicode-supported": ["[email protected]", "", {}, "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ=="],"filelist/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="],@@ -4629,9 +4721,9 @@"glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.2" } }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="],- "gray-matter/js-yaml": ["[email protected]", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-S99WuO3HlhO3XN41EtYUNl9zzXjoJx7QvmipxsJVxtCBT0YHEFy+iOJhjSvrmV12nYhWpZaM8lPHkJm0yUMbag=="],+ "globby/ignore": ["[email protected]", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],- "htmlparser2/entities": ["[email protected]", "", {}, "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA=="],+ "gray-matter/js-yaml": ["[email protected]", "", { "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-S99WuO3HlhO3XN41EtYUNl9zzXjoJx7QvmipxsJVxtCBT0YHEFy+iOJhjSvrmV12nYhWpZaM8lPHkJm0yUMbag=="],"is-expression/acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A=="],@@ -4683,8 +4775,6 @@"mocha/diff": ["[email protected]", "", {}, "sha512-vtcDfH3TOjP8UekytvnHH1o1P4FcUdt4eQ1Y+Abap1tk/OB2MWQvcwS2ClCd1zuIhc3JKOx6p3kod8Vfys3E+A=="],- "mocha/find-up": ["[email protected]", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="],-"mocha/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", "once": "^1.3.0" } }, "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ=="],"mocha/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="],@@ -4709,6 +4799,8 @@"p-retry/retry": ["[email protected]", "", {}, "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg=="],+ "parse5/entities": ["[email protected]", "", {}, "sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA=="],+"parse5-htmlparser2-tree-adapter/parse5": ["[email protected]", "", {}, "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="],"parse5-parser-stream/parse5": ["[email protected]", "", { "dependencies": { "entities": "^6.0.0" } }, "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw=="],@@ -4741,6 +4833,8 @@"read-pkg/type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],+ "read-pkg-up/find-up": ["[email protected]", "", { "dependencies": { "locate-path": "^7.1.0", "path-exists": "^5.0.0" } }, "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw=="],+"read-pkg-up/type-fest": ["[email protected]", "", {}, "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA=="],"readdir-glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw=="],@@ -5049,8 +5143,18 @@"d3-sankey/d3-shape/d3-path": ["[email protected]", "", {}, "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg=="],+ "detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/project-service": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.67.0", "@typescript-eslint/types": "^8.67.0", "debug": "^4.4.3" }, "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-cvE8c7ulYeXN9fYuszhCeCsbzyVEXuhrRCybnBre7TUmqb5nRmBfQAwCj0O3WJFDeyAZt4VYv51vMCC9LHSdYw=="],++ "detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/tsconfig-utils": ["@typescript-eslint/[email protected]", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-vV+LUSv5njUWsknE71fqKTlXUva+R76SaeORd6Zojcunk/6DvKFXONU3BrAs2H49mbygUXt6gbYunzwqNwlhdg=="],++ "detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-sBtgslww8nsMYUjhdPBiSyUqSzT8uR6g93A2QXnQC8+cGdjz0CyaOdqHDRJb1AtORbZCNUJBBeFA/tNR2uQmww=="],++ "detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.67.0", "eslint-visitor-keys": "^5.0.0" } }, "sha512-fkv8dHRDqfGtTHuJeebdrQ7cX6Ad4WAS00rgHh9UGvMycF1mjBfsxry1XsLIFhWZ6Judlh6UdzK+TYlbpCXgnA=="],+"edgedriver/which/isexe": ["[email protected]", "", {}, "sha512-FFUtZMpoZ8RqHS3XeXEmHWLA4thH+ZxCv2lOiPIn1Xc7CxrqhWzNSDzD+/chS/zbYezmiwWLdQC09JdQKmthOw=="],+ "eslint/ajv/json-schema-traverse": ["[email protected]", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],+"expect-webdriverio/@vitest/snapshot/@vitest/pretty-format": ["@vitest/[email protected]", "", { "dependencies": { "tinyrainbow": "^3.1.0" } }, "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw=="],"filelist/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg=="],@@ -5065,11 +5169,9 @@"mlly/pkg-types/confbox": ["[email protected]", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="],- "mocha/chokidar/readdirp": ["[email protected]", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],-- "mocha/find-up/locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="],+ "mocha/chokidar/glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],- "mocha/find-up/path-exists": ["[email protected]", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],+ "mocha/chokidar/readdirp": ["[email protected]", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],"mocha/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg=="],@@ -5083,6 +5185,10 @@"prebuild-install/tar-fs/tar-stream": ["[email protected]", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="],+ "read-pkg-up/find-up/locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^6.0.0" } }, "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA=="],++ "read-pkg-up/find-up/path-exists": ["[email protected]", "", {}, "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ=="],+"read-pkg/normalize-package-data/hosted-git-info": ["[email protected]", "", { "dependencies": { "lru-cache": "^10.0.1" } }, "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w=="],"read-pkg/parse-json/json-parse-even-better-errors": ["[email protected]", "", {}, "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ=="],@@ -5383,6 +5489,8 @@"cli-highlight/yargs/cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],+ "detective-typescript/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA=="],+"expect-webdriverio/@vitest/snapshot/@vitest/pretty-format/tinyrainbow": ["[email protected]", "", {}, "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw=="],"filelist/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],@@ -5393,8 +5501,6 @@"mocha/chokidar/readdirp/picomatch": ["[email protected]", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],- "mocha/find-up/locate-path/p-locate": ["[email protected]", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="],-"mocha/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],"mocha/yargs/cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],@@ -5403,6 +5509,8 @@"prebuild-install/tar-fs/tar-stream/readable-stream": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],+ "read-pkg-up/find-up/locate-path/p-locate": ["[email protected]", "", { "dependencies": { "p-limit": "^4.0.0" } }, "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw=="],+"read-pkg/normalize-package-data/hosted-git-info/lru-cache": ["[email protected]", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],"readdir-glob/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],@@ -5423,16 +5531,16 @@"cli-highlight/yargs/cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],- "mocha/find-up/locate-path/p-locate/p-limit": ["[email protected]", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="],-"mocha/yargs/cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],"prebuild-install/tar-fs/tar-stream/bl/buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],+ "read-pkg-up/find-up/locate-path/p-locate/p-limit": ["[email protected]", "", { "dependencies": { "yocto-queue": "^1.0.0" } }, "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ=="],+"storybook/oxc-parser/@oxc-parser/binding-wasm32-wasi/@emnapi/core/@emnapi/wasi-threads": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w=="],"@waku/enr/@libp2p/peer-id/@libp2p/crypto/@libp2p/interface/@multiformats/multiaddr/uint8-varint": ["[email protected]", "", { "dependencies": { "uint8arraylist": "^3.0.1", "uint8arrays": "^6.1.0" } }, "sha512-S4DdpXBaLwKcFo7f0bWzWfHjbZ/i3QhM842qn+ZvHjxqFCfUcEB9SQNcmI69S+zMlcmIcKxsk9Iyw77S2Kxv6Q=="],- "mocha/find-up/locate-path/p-locate/p-limit/yocto-queue": ["[email protected]", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="],+ "read-pkg-up/find-up/locate-path/p-locate/p-limit/yocto-queue": ["[email protected]", "", {}, "sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ=="],}}diff --git a/lint/plugin.js b/lint/plugin.jsindex da2973b7d..e993d13f1 100644--- a/lint/plugin.js+++ b/lint/plugin.js@@ -1,2290 +1 @@-import { existsSync } from 'node:fs'--import { parse as parseVueSfc } from 'vue/compiler-sfc'--function normalizedFilename(context) {- return (context.filename ?? context.getFilename?.() ?? '').replace(/\\/g, '/')-}--function importSource(node) {- return typeof node.source?.value === 'string' ? node.source.value : null-}--function createProgramFilenameRule({ description, check }) {- return {- meta: {- docs: { description }- },- create(context) {- const file = normalizedFilename(context)- const message = check(file)- if (!message) return {}-- return {- Program(node) {- context.report({ node, message })- }- }- }- }-}--function createImportSourceRule({- description,- applies = () => true,- includeExports = false,- includeDynamic = false,- check-}) {- return {- meta: {- docs: { description }- },- create(context) {- const file = normalizedFilename(context)- if (!applies(file)) return {}-- function reportIfRestricted(node) {- const source = importSource(node)- if (!source) return- const message = check(source, file)- if (!message) return- context.report({ node, message })- }-- const visitors = { ImportDeclaration: reportIfRestricted }- if (includeExports) {- visitors.ExportAllDeclaration = reportIfRestricted- visitors.ExportNamedDeclaration = reportIfRestricted- }- if (includeDynamic) visitors.ImportExpression = reportIfRestricted- return visitors- }- }-}--function isUnknownTypeAnnotation(typeAnnotation) {- return typeAnnotation?.type === 'TSUnknownKeyword'-}--const noInlineNamedTypes = {- meta: {- docs: {- description: 'Disallow inline type literals that duplicate a named type'- },- schema: [- {- type: 'object',- additionalProperties: {- type: 'string'- }- }- ]- },- create(context) {- const typesOption = context.options[0]- if (!typesOption || typeof typesOption !== 'object') return {}-- const shapeToName = new Map()- for (const [name, shape] of Object.entries(typesOption)) {- shapeToName.set(shape, name)- }-- return {- TSTypeLiteral(node) {- const props = node.members?.filter(- (m) => m.type === 'TSPropertySignature' && m.key?.type === 'Identifier'- )- if (!props || props.length < 2) return-- const shape = props- .map((m) => {- const typeNode = m.typeAnnotation?.typeAnnotation- let typeName = 'unknown'- if (typeNode) {- switch (typeNode.type) {- case 'TSNumberKeyword':- typeName = 'number'- break- case 'TSStringKeyword':- typeName = 'string'- break- case 'TSBooleanKeyword':- typeName = 'boolean'- break- }- }- return `${m.key.name}:${typeName}`- })- .sort()- .join(',')-- const namedType = shapeToName.get(shape)- if (namedType) {- context.report({- node,- message: `Use '${namedType}' instead of inline type literal. Import from '@open-pencil/core'.`- })- }- }- }- }-}--const noStructuredCloneSceneArrays = {- meta: {- docs: {- description:- 'Disallow structuredClone on fills/strokes/effects — use typed copy helpers from copy.ts'- },- schema: [- {- type: 'array',- items: { type: 'string' },- description: 'Property names that should use typed copy helpers'- }- ]- },- create(context) {- const props = new Set(- context.options[0] ?? [- 'fills',- 'strokes',- 'effects',- 'styleRuns',- 'fillGeometry',- 'strokeGeometry'- ]- )- return {- CallExpression(node) {- if (node.callee?.type !== 'Identifier' || node.callee.name !== 'structuredClone') return- if (node.arguments?.length !== 1) return- const arg = node.arguments[0]- if (arg.type === 'MemberExpression' && arg.property?.type === 'Identifier') {- if (props.has(arg.property.name)) {- context.report({- node,- message: `Use the typed copy helper instead of structuredClone for '${arg.property.name}'. Import from '@open-pencil/core'.`- })- }- }- }- }- }-}--function vueSfcDescriptor(source, filename) {- return parseVueSfc(source, { filename }).descriptor-}--function vueTemplateAst(source, filename) {- return vueSfcDescriptor(source, filename).template?.ast ?? null-}--function isVueSourceFile(file) {- return (- file.endsWith('.vue') &&- (file.startsWith('src/') ||- file.includes('/src/') ||- file.startsWith('packages/vue/src/') ||- file.includes('/packages/vue/src/'))- )-}--function sourceLineCount(source) {- const normalized = source.endsWith('\n') ? source.slice(0, -1) : source- return normalized.split('\n').length-}--const VUE_ELEMENT_NODE = 1-const VUE_SIMPLE_EXPRESSION_NODE = 4-const VUE_INTERPOLATION_NODE = 5-const VUE_ATTRIBUTE_NODE = 6-const VUE_DIRECTIVE_NODE = 7--function walkVueTemplateAst(node, visitor) {- visitor(node)- for (const prop of node.props ?? []) walkVueTemplateAst(prop, visitor)- for (const child of node.children ?? []) walkVueTemplateAst(child, visitor)- if (node.type === VUE_INTERPOLATION_NODE && node.content) {- walkVueTemplateAst(node.content, visitor)- }- if (node.type === VUE_DIRECTIVE_NODE) {- if (node.arg) walkVueTemplateAst(node.arg, visitor)- if (node.exp) walkVueTemplateAst(node.exp, visitor)- }-}--function walkExpressionAst(node, visitor) {- if (!node || typeof node !== 'object') return- visitor(node)- for (const value of Object.values(node)) {- if (!value || value === node.loc) continue- if (Array.isArray(value)) {- for (const item of value) walkExpressionAst(item, visitor)- continue- }- walkExpressionAst(value, visitor)- }-}--function isUiHelperName(name) {- const prefix = 'use'- const suffix = 'UI'- if (!name.startsWith(prefix) || !name.endsWith(suffix)) return false- const firstDomainChar = name.at(prefix.length)- return firstDomainChar !== undefined && firstDomainChar === firstDomainChar.toUpperCase()-}--function hasExpressionCall(expression, predicate) {- if (expression?.type !== VUE_SIMPLE_EXPRESSION_NODE || !expression.ast) return false- let found = false- walkExpressionAst(expression.ast, (node) => {- if (found || node.type !== 'CallExpression') return- if (node.callee?.type === 'Identifier' && predicate(node.callee.name)) found = true- })- return found-}--function hasUiHelperCall(expression) {- return hasExpressionCall(expression, isUiHelperName)-}--function isStaticVueAttribute(node, name) {- return node.type === VUE_ATTRIBUTE_NODE && node.name === name-}--function isVueBindDirective(node, name) {- return node.type === VUE_DIRECTIVE_NODE && node.name === 'bind' && node.arg?.content === name-}--function isBoundStringLiteral(node, name) {- if (!isVueBindDirective(node, name)) return false- const expression = node.exp- if (expression?.type !== VUE_SIMPLE_EXPRESSION_NODE) return false- const ast = expression.ast- if (!ast) return false- if (ast.type === 'StringLiteral' || (ast.type === 'Literal' && typeof ast.value === 'string')) {- return true- }- return ast.type === 'TemplateLiteral' && ast.expressions?.length === 0-}--const noVueStyleBlocks = {- meta: {- docs: {- description: 'Disallow Vue component <style> blocks — use Tailwind utilities or global tokens'- }- },- create(context) {- const file = normalizedFilename(context)- if (!isVueSourceFile(file)) return {}-- return {- Program(node) {- const descriptor = vueSfcDescriptor(context.sourceCode.getText(), file)- if (descriptor.styles.length === 0) return- context.report({- node,- message:- 'Vue components must not use <style> blocks. Use Tailwind utilities or global app.css tokens.'- })- }- }- }-}--const noNativeTitleAttributesInVue = {- meta: {- docs: {- description: 'Disallow native title attributes in Vue components — use Tip/Reka tooltip'- }- },- create(context) {- const file = normalizedFilename(context)- if (!isVueSourceFile(file)) return {}-- return {- Program(node) {- const template = vueTemplateAst(context.sourceCode.getText(), file)- if (!template) return- let hasTitleAttribute = false- walkVueTemplateAst(template, (templateNode) => {- if (hasTitleAttribute) return- if (- isStaticVueAttribute(templateNode, 'title') ||- isVueBindDirective(templateNode, 'title')- ) {- hasTitleAttribute = true- }- })- if (!hasTitleAttribute) return- context.report({- node,- message: 'Use the shared tooltip UI instead of native title attributes.'- })- }- }- }-}--const noHardcodedTipLabelsInVue = {- meta: {- docs: {- description: 'Disallow hardcoded Tip labels — use localized i18n messages'- }- },- create(context) {- const file = normalizedFilename(context)- if (!isVueSourceFile(file)) return {}-- return {- Program(node) {- const template = vueTemplateAst(context.sourceCode.getText(), file)- if (!template) return- let hasHardcodedTipLabel = false- walkVueTemplateAst(template, (templateNode) => {- if (hasHardcodedTipLabel) return- if (templateNode.type !== VUE_ELEMENT_NODE || templateNode.tag !== 'Tip') return- hasHardcodedTipLabel = templateNode.props?.some(- (prop) => isStaticVueAttribute(prop, 'label') || isBoundStringLiteral(prop, 'label')- )- })- if (!hasHardcodedTipLabel) return- context.report({- node,- message: 'Use a localized binding for Tip labels, not a hardcoded string.'- })- }- }- }-}--const noRawSvgInAppVueTemplates = {- meta: {- docs: {- description: 'Disallow raw SVG in app Vue templates — use Iconify/unplugin icons'- }- },- create(context) {- const file = normalizedFilename(context)- if (!isVueSourceFile(file)) return {}-- return {- Program(node) {- const template = vueTemplateAst(context.sourceCode.getText(), file)- if (!template) return- let hasRawSvg = false- walkVueTemplateAst(template, (templateNode) => {- if (templateNode.type === VUE_ELEMENT_NODE && templateNode.tag === 'svg') {- hasRawSvg = true- }- })- if (!hasRawSvg) return- context.report({- node,- message: 'Use Iconify/unplugin icon components instead of raw <svg> in app templates.'- })- }- }- }-}--const noUiHelperCallsInVueTemplates = {- meta: {- docs: {- description: 'Disallow use*UI() helper calls inside Vue templates'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue') || !file.includes('/src/components/')) return {}-- return {- Program(node) {- const template = vueTemplateAst(context.sourceCode.getText(), file)- if (!template) return- let hasTemplateUiHelperCall = false- walkVueTemplateAst(template, (templateNode) => {- if (!hasTemplateUiHelperCall && hasUiHelperCall(templateNode)) {- hasTemplateUiHelperCall = true- }- })- if (!hasTemplateUiHelperCall) return- context.report({- node,- message: 'Hoist use*UI() calls out of templates or hide them inside shared UI components.'- })- }- }- }-}--const PROPERTY_SECTION_LINE_ALLOWLIST = new Set([- '/src/components/properties/LayoutSection/SizeControls.vue'-])--const noLargePropertySectionComponents = {- meta: {- docs: {- description: 'Disallow oversized property-section Vue components'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue') || !file.includes('/src/components/properties/')) return {}- if ([...PROPERTY_SECTION_LINE_ALLOWLIST].some((suffix) => file.endsWith(suffix))) return {}-- return {- Program(node) {- const lineCount = sourceLineCount(context.sourceCode.getText())- if (lineCount <= 250) return- context.report({- node,- message:- 'Split property-section components over 250 lines into focused controls or document an explicit allowlist.'- })- }- }- }-}--const TEST_ID_FORMAT = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/--const noRawTestIdStringProps = {- meta: {- docs: {- description:- 'Disallow test-id component props — use data-test-id attrs or internal semantic ids'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue')) return {}-- function isTestIdKey(key) {- if (key?.type !== 'Identifier') return false- return key.name === 'testId' || /TestId$/u.test(key.name)- }-- return {- TSPropertySignature(node) {- if (!isTestIdKey(node.key)) return- context.report({- node,- message:- 'Do not expose test-id component props. Let callers pass data-test-id attrs or derive internal ids from semantic component state.'- })- }- }- }-}--const noDynamicDataTestIdInVue = {- meta: {- docs: {- description: 'Disallow dynamic :data-test-id in Vue components — use v-test-id'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue')) return {}-- return {- Program(node) {- const template = vueTemplateAst(context.sourceCode.getText(), file)- if (!template) return- let hasDynamicDataTestId = false- walkVueTemplateAst(template, (templateNode) => {- if (hasDynamicDataTestId) return- if (isVueBindDirective(templateNode, 'data-test-id')) hasDynamicDataTestId = true- })- if (!hasDynamicDataTestId) return- context.report({- node,- message: 'Use v-test-id for dynamic/configurable test ids instead of :data-test-id.'- })- }- }- }-}--const noTestIdHelperBindInVue = {- meta: {- docs: {- description: 'Prefer v-test-id over v-bind="testId(...)" in Vue templates'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue')) return {}-- return {- Program(node) {- const template = vueTemplateAst(context.sourceCode.getText(), file)- if (!template) return- let hasTestIdHelperBind = false- walkVueTemplateAst(template, (templateNode) => {- if (hasTestIdHelperBind) return- if (templateNode.type !== VUE_DIRECTIVE_NODE || templateNode.name !== 'bind') return- if (templateNode.arg) return- hasTestIdHelperBind = hasExpressionCall(- templateNode.exp,- (name) => name === 'testId' || name === 'testIdAttr'- )- })- if (!hasTestIdHelperBind) return- context.report({- node,- message: 'Use v-test-id instead of v-bind="testId(...)" in Vue templates.'- })- }- }- }-}--const noInvalidTestIdAttributes = {- meta: {- docs: {- description: 'Enforce data-test-id spelling and kebab-case static test ids in Vue components'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue')) return {}-- return {- Program(node) {- const template = vueTemplateAst(context.sourceCode.getText(), file)- if (!template) return- let invalidId = null- let hasInvalidSpelling = false- walkVueTemplateAst(template, (templateNode) => {- if (hasInvalidSpelling || invalidId !== null) return- if (- isStaticVueAttribute(templateNode, 'data-testid') ||- isVueBindDirective(templateNode, 'data-testid') ||- isStaticVueAttribute(templateNode, 'test-id') ||- isVueBindDirective(templateNode, 'test-id')- ) {- hasInvalidSpelling = true- return- }- if (!isStaticVueAttribute(templateNode, 'data-test-id')) return- const id = templateNode.value?.content ?? ''- if (!TEST_ID_FORMAT.test(id)) invalidId = id- })- if (hasInvalidSpelling) {- context.report({- node,- message: 'Use data-test-id attrs instead of data-testid or test-id component props.'- })- return- }- if (invalidId === null) return- context.report({- node,- message: `Static data-test-id values must be kebab-case. Invalid id: "${invalidId}".`- })- }- }- }-}--const noRawTestIdSelectorsInTests = {- meta: {- docs: {- description: 'Disallow raw data-test-id CSS selectors in Playwright tests — use getByTestId()'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.includes('/tests/')) return {}-- return {- CallExpression(node) {- const callee = node.callee- if (callee?.type !== 'MemberExpression') return- if (callee.property?.type !== 'Identifier' || callee.property.name !== 'locator') return- const firstArg = node.arguments?.[0]- if (!firstArg) return-- const isRawTestIdSelector =- (firstArg.type === 'Literal' &&- typeof firstArg.value === 'string' &&- firstArg.value.includes('[data-test-id')) ||- (firstArg.type === 'TemplateLiteral' &&- firstArg.quasis?.some((part) => part.value.raw.includes('[data-test-id')))-- if (!isRawTestIdSelector) return- context.report({- node,- message: 'Use getByTestId() instead of raw [data-test-id] CSS selectors in tests.'- })- }- }- }-}--function isGeneratedTestIdLiteral(value) {- if (typeof value !== 'string') return false- const toolbarValue = value.startsWith('mobile-toolbar-') ? value.slice('mobile-'.length) : value- return (- toolbarValue.startsWith('toolbar-tool-') ||- toolbarValue.startsWith('toolbar-flyout-') ||- toolbarValue.startsWith('toolbar-flyout-item-') ||- value === 'variables-add-float' ||- value === 'variables-add-string' ||- value === 'variables-add-boolean' ||- value.startsWith('acp-permission-option-')- )-}--const noGeneratedTestIdLiterals = {- meta: {- docs: {- description: 'Disallow hand-written generated test-id literals — use shared helper functions'- }- },- create(context) {- const file = normalizedFilename(context)- if (file.endsWith('/packages/vue/src/testing/test-id.ts')) return {}- if (file.endsWith('/tests/helpers/test-ids.ts')) return {}- if (!file.includes('/src/') && !file.includes('/tests/')) return {}-- function report(node) {- context.report({- node,- message:- 'Use shared generated test-id helpers instead of hand-written toolbar/variable/permission id literals.'- })- }-- return {- Program(node) {- if (!file.endsWith('.vue')) return- const template = vueTemplateAst(context.sourceCode.getText(), file)- if (!template) return- let hasGeneratedTemplateId = false- walkVueTemplateAst(template, (templateNode) => {- if (hasGeneratedTemplateId || !isStaticVueAttribute(templateNode, 'data-test-id')) return- hasGeneratedTemplateId = isGeneratedTestIdLiteral(templateNode.value?.content)- })- if (hasGeneratedTemplateId) report(node)- },- Literal(node) {- if (isGeneratedTestIdLiteral(node.value)) report(node)- },- TemplateElement(node) {- if (isGeneratedTestIdLiteral(node.value?.raw)) report(node)- }- }- }-}--const noBrowserSideEffectsInVue = {- meta: {- docs: {- description:- 'Disallow direct browser side effects in Vue components — use VueUse, refs, or app services'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue')) return {}-- function propertyName(property) {- if (property?.type === 'Identifier') return property.name- if (property?.type === 'Literal' && typeof property.value === 'string') return property.value- return null- }-- function objectName(object) {- return object?.type === 'Identifier' ? object.name : null- }-- return {- CallExpression(node) {- const callee = node.callee- if (callee?.type !== 'MemberExpression') return- const object = objectName(callee.object)- const property = propertyName(callee.property)-- if (- (object === 'window' || object === 'document') &&- (property === 'addEventListener' || property === 'removeEventListener')- ) {- context.report({- node,- message:- 'Use VueUse useEventListener() instead of direct browser event listeners in Vue components.'- })- return- }-- if (object === 'document' && property === 'createElement') {- context.report({- node,- message:- 'Do not create DOM elements directly in Vue components. Use template refs, components, or an app service.'- })- }- },- MemberExpression(node) {- const object = objectName(node.object)- if (object !== 'localStorage' && object !== 'sessionStorage') return- context.report({- node,- message:- 'Do not access localStorage/sessionStorage directly in Vue components. Use VueUse storage helpers or an app service.'- })- }- }- }-}--const noDocumentQuerySelectorInVue = {- meta: {- docs: {- description:- 'Disallow document.querySelector in Vue components — use template refs or composables'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue')) return {}-- return {- CallExpression(node) {- const callee = node.callee- if (callee?.type !== 'MemberExpression') return- if (callee.object?.type !== 'Identifier' || callee.object.name !== 'document') return- if (callee.property?.type !== 'Identifier') return- if (- callee.property.name !== 'querySelector' &&- callee.property.name !== 'querySelectorAll'- ) {- return- }- context.report({- node,- message:- 'Do not query the document from Vue components. Use template refs, component APIs, or a composable.'- })- }- }- }-}--const noDirectSelectionToolStateMutation = {- meta: {- docs: {- description:- 'Disallow direct editor selection/tool state assignment outside core editor internals'- }- },- create(context) {- const file = normalizedFilename(context)- if (file.includes('/packages/core/src/editor/')) return {}-- return {- AssignmentExpression(node) {- if (node.operator !== '=') return- const left = node.left- if (left?.type !== 'MemberExpression') return- if (left.property?.type !== 'Identifier') return- if (left.property.name !== 'selectedIds' && left.property.name !== 'activeTool') return- const stateExpr = left.object- if (stateExpr?.type !== 'MemberExpression') return- if (stateExpr.property?.type !== 'Identifier' || stateExpr.property.name !== 'state') return- context.report({- node,- message:- 'Do not assign editor.state.selectedIds or editor.state.activeTool directly. Use editor selection/tool actions.'- })- }- }- }-}--const noMathRandom = {- meta: {- docs: {- description: 'Disallow Math.random() — use crypto.getRandomValues() instead'- }- },- create(context) {- return {- CallExpression(node) {- if (- node.callee?.type === 'MemberExpression' &&- node.callee.object?.type === 'Identifier' &&- node.callee.object.name === 'Math' &&- node.callee.property?.type === 'Identifier' &&- node.callee.property.name === 'random'- ) {- context.report({- node,- message: 'Use crypto.getRandomValues() instead of Math.random().'- })- }- }- }- }-}--function isNumericLiteral(node, value) {- return node?.type === 'Literal' && node.value === value-}--function colorObjectLiteral(node, color) {- if (node?.type !== 'ObjectExpression') return false- const props = new Map()- for (const prop of node.properties ?? []) {- if (prop.type !== 'Property') return false- const key = prop.key.type === 'Identifier' ? prop.key.name : prop.key.value- props.set(key, prop.value)- }- return Object.entries(color).every(([key, value]) => isNumericLiteral(props.get(key), value))-}--const noHardcodedColorConstants = {- meta: {- docs: {- description:- 'Use named color constants instead of inline Color object literals for shared colors'- }- },- create(context) {- const file = normalizedFilename(context)- if (file.includes('/tests/') || file.endsWith('/packages/core/src/constants.ts')) return {}-- return {- ObjectExpression(node) {- if (colorObjectLiteral(node, { r: 0, g: 0, b: 0, a: 1 })) {- context.report({- node,- message: 'Use BLACK from constants instead of an inline black Color literal.'- })- }- if (colorObjectLiteral(node, { r: 0, g: 0, b: 0, a: 0 })) {- context.report({- node,- message:- 'Use TRANSPARENT from constants instead of an inline transparent Color literal.'- })- }- }- }- }-}--const noHandRolledColor = {- meta: {- docs: {- description:- 'Disallow hand-rolled color conversions — use helpers from color.ts (colorToCSS, colorToHex, parseColor, etc.)'- }- },- create(context) {- const file = normalizedFilename(context)- if (file.includes('/color') && /(?:color\.ts|color\/index\.ts)$/.test(file)) return {}-- return {- TemplateLiteral(node) {- const hasHandRolledRgb = node.quasis?.some((quasi) => {- const raw = quasi.value?.raw- return typeof raw === 'string' && (raw.includes('rgb(') || raw.includes('rgba('))- })- if (!hasHandRolledRgb) return- context.report({- node,- message:- 'Use colorToCSS() or colorToHex() from color.ts instead of hand-rolled rgba()/rgb() strings.'- })- }- }- }-}--const noRawConsoleFormat = {- meta: {- docs: {- description:- 'Disallow hand-rolled formatting in console.log — use agentfmt helpers (bold, dim, kv, entity, fmtTree, fmtList, etc.)'- }- },- create(context) {- return {- CallExpression(node) {- if (- node.callee?.type !== 'MemberExpression' ||- node.callee.object?.type !== 'Identifier' ||- node.callee.object.name !== 'console' ||- node.callee.property?.type !== 'Identifier' ||- node.callee.property.name !== 'log'- )- return- if (!node.arguments?.length) return-- for (const arg of node.arguments) {- if (arg.type === 'TemplateLiteral' && arg.expressions?.length > 0) {- context.report({- node,- message:- 'Use agentfmt helpers (bold, dim, kv, entity, etc.) instead of template literals in console.log.'- })- return- }- if (arg.type === 'BinaryExpression' && arg.operator === '+') {- context.report({- node,- message:- 'Use agentfmt helpers (bold, dim, kv, entity, etc.) instead of string concatenation in console.log.'- })- return- }- }- }- }- }-}--const noSilentCatch = {- meta: {- docs: {- description:- 'Disallow empty catch blocks — log a warning or re-throw instead of silently swallowing errors'- }- },- create(context) {- return {- CatchClause(node) {- const body = node.body- if (!body || !body.body) return- const stmts = body.body.filter((s) => s.type !== 'EmptyStatement')- if (stmts.length === 0) {- context.report({- node,- message:- 'Empty catch block silently swallows errors. Add console.warn(), re-throw, or an explicit // oxlint-ignore-next-line comment.'- })- }- }- }- }-}--const noTypeofWindowCheck = {- meta: {- docs: {- description: 'Disallow raw typeof window checks — use IS_BROWSER or IS_TAURI from constants'- }- },- create(context) {- const file = normalizedFilename(context)- if (file.endsWith('constants.ts')) return {}-- return {- BinaryExpression(node) {- if (node.operator !== '!==' && node.operator !== '===') return- const isTypeofWindow = (side) =>- side.type === 'UnaryExpression' &&- side.operator === 'typeof' &&- side.argument?.type === 'Identifier' &&- side.argument.name === 'window'- if (isTypeofWindow(node.left) || isTypeofWindow(node.right)) {- context.report({- node,- message:- "Use IS_BROWSER or IS_TAURI from constants instead of raw 'typeof window' checks."- })- }- }- }- }-}--const noVueSelfPackageImports = createImportSourceRule({- description: 'Disallow @open-pencil/vue self-imports inside the Vue SDK — use #vue/* aliases',- applies: (file) => file.includes('/packages/vue/src/'),- check: (source) =>- source.startsWith('@open-pencil/vue') &&- `Use #vue/* for internal Vue SDK imports instead of self-package import '${source}'.`-})--const noCrossPackageSourceImports = createImportSourceRule({- description:- 'Disallow imports that reach into another workspace package source tree — use package exports or package-local aliases',- check: (source) =>- (source.includes('/packages/') ||- /^(?:\.\.\/){2,}packages\//.test(source) ||- /^(?:\.\.\/)+(?:core|vue|cli|mcp)\/src\//.test(source)) &&- `Use workspace package exports or package-local aliases instead of cross-package source import '${source}'.`-})--function createParentRelativeImportRule({ description, applies, message, minDepth = 1 }) {- return {- meta: {- docs: { description }- },- create(context) {- const file = normalizedFilename(context)- if (!applies(file)) return {}-- function reportSource(node, source) {- if (!source?.startsWith('../')) return- const depth = source.match(/^(?:\.\.\/)+/)?.[0].split('../').length - 1- if ((depth ?? 0) < minDepth) return- if (/^(?:\.\.\/)+package\.json$/.test(source)) return- context.report({ node, message })- }-- function reportParentRelative(node) {- reportSource(node, importSource(node))- }-- return {- ExportAllDeclaration: reportParentRelative,- ExportNamedDeclaration: reportParentRelative,- ImportDeclaration: reportParentRelative,- ImportExpression(node) {- reportSource(node, typeof node.source?.value === 'string' ? node.source.value : null)- }- }- }- }-}--const noDeepParentRelativeImports = createParentRelativeImportRule({- description: 'Disallow deep parent-relative imports — use package/test aliases instead',- applies: () => true,- message: 'Use an import alias instead of path drilling with ../.. imports.',- minDepth: 2-})--const noCoreParentRelativeImports = createParentRelativeImportRule({- description: 'Disallow parent-relative imports in core internals — use #core/* aliases',- applies: (file) =>- file.includes('/packages/core/src/') && !file.includes('/packages/core/src/kiwi/kiwi-schema/'),- message: 'Use the #core/* package-local alias instead of parent-relative core imports.'-})--const noMcpParentRelativeImports = createParentRelativeImportRule({- description: 'Disallow parent-relative imports in MCP internals — use #mcp/* aliases',- applies: (file) => file.includes('/packages/mcp/src/'),- message: 'Use the #mcp/* package-local alias instead of parent-relative MCP imports.'-})--const noVueParentRelativeImports = createParentRelativeImportRule({- description: 'Disallow parent-relative imports in Vue SDK internals — use #vue/* aliases',- applies: (file) => file.includes('/packages/vue/src/'),- message: 'Use the #vue/* package-local alias instead of parent-relative Vue SDK imports.'-})--const noCliParentRelativeImports = createParentRelativeImportRule({- description: 'Disallow parent-relative imports in CLI internals — use #cli/* aliases',- applies: (file) => file.includes('/packages/cli/src/'),- message: 'Use the #cli/* package-local alias instead of parent-relative CLI imports.'-})--function createExactCoreBarrelImportRule({ description, applies, message }) {- return createImportSourceRule({- description,- applies,- check: (source) => source === '@open-pencil/core' && message- })-}--const noMcpCoreBarrelImports = createExactCoreBarrelImportRule({- description: 'Disallow MCP imports from @open-pencil/core root barrel — use domain subpaths',- applies: (file) => file.includes('/packages/mcp/src/'),- message:- 'Use a targeted @open-pencil/core subpath in MCP code instead of the compatibility barrel.'-})--const noCliCoreBarrelImports = createExactCoreBarrelImportRule({- description: 'Disallow CLI imports from @open-pencil/core root barrel — use domain subpaths',- applies: (file) => file.includes('/packages/cli/src/'),- message:- 'Use a targeted @open-pencil/core subpath in CLI code instead of the compatibility barrel.'-})--const noScriptCoreBarrelImports = createExactCoreBarrelImportRule({- description: 'Disallow script imports from @open-pencil/core root barrel — use domain subpaths',- applies: (file) => file.includes('/scripts/'),- message:- 'Use a targeted @open-pencil/core subpath or #core/* alias in scripts instead of the compatibility barrel.'-})--const noCoreSelfPackageImports = createImportSourceRule({- description: 'Disallow @open-pencil/core self-imports inside packages/core/src',- applies: (file) => file.includes('/packages/core/src/'),- check: (source) =>- source.startsWith('@open-pencil/core') &&- 'Core internals must import local modules directly instead of importing the @open-pencil/core public package entrypoints.'-})--const noInlinePromptConstants = {- meta: {- docs: {- description: 'Disallow inline prompt/context template literals — use markdown prompt files'- }- },- create(context) {- return {- VariableDeclarator(node) {- if (node.id?.type !== 'Identifier') return- if (!/(?:PROMPT|CONTEXT)/.test(node.id.name)) return- if (node.init?.type !== 'TemplateLiteral') return- context.report({- node,- message:- 'Move prompt/context text to a dedicated markdown file and import it instead of using an inline template literal.'- })- }- }- }-}--const noAppVueCoreBarrelImports = createExactCoreBarrelImportRule({- description:- 'Disallow app and Vue SDK imports from @open-pencil/core root barrel — use domain subpaths',- applies: (file) =>- (file.includes('/src/') && !file.includes('/packages/')) || file.includes('/packages/vue/src/'),- message:- 'Use a targeted @open-pencil/core subpath (editor, scene-graph, constants, io, etc.) instead of the compatibility barrel.'-})--const noAppImportsInPackages = createImportSourceRule({- description: 'Disallow app-shell imports from workspace packages',- applies: (file) => file.includes('/packages/'),- check: (source) =>- source.startsWith('@/') && `Workspace packages must not import app-shell alias '${source}'.`-})--const frameworkImportPrefixes = ['@vue/', '@open-pencil/vue', '@tauri-apps/', '@/']--const noCoreFrameworkImports = createImportSourceRule({- description: 'Keep @open-pencil/core framework-agnostic by disallowing Vue/Tauri/app imports',- applies: (file) => file.includes('/packages/core/src/'),- check: (source) =>- (source === 'vue' || frameworkImportPrefixes.some((prefix) => source.startsWith(prefix))) &&- `@open-pencil/core must stay framework-agnostic; do not import '${source}'.`-})--const noDirectStorageAccess = {- meta: {- docs: {- description:- 'Disallow direct localStorage/sessionStorage access outside dedicated storage modules'- }- },- create(context) {- const file = normalizedFilename(context)- const allowedFiles = [- '/src/app/ai/chat/storage.ts',- '/src/app/cache/index.ts',- '/src/app/settings/credentials/storage.ts',- '/src/app/shell/layout-storage.ts',- '/packages/vue/src/i18n/locale.ts'- ]- if (allowedFiles.some((suffix) => file.endsWith(suffix))) return {}-- function reportStorage(node, name) {- context.report({- node,- message: `Use a dedicated storage module instead of direct ${name} access.`- })- }-- return {- Identifier(node) {- if (node.name !== 'localStorage' && node.name !== 'sessionStorage') return- reportStorage(node, node.name)- }- }- }-}--const noBroadDoubleCast = {- meta: {- docs: {- description: 'Disallow broad `as unknown as` casts outside vendored code'- }- },- create(context) {- const file = normalizedFilename(context)- if (file.includes('/packages/core/src/kiwi/kiwi-schema/')) return {}-- return {- TSAsExpression(node) {- if (isUnknownTypeAnnotation(node.expression?.typeAnnotation)) {- context.report({- node,- message: 'Avoid `as unknown as ...`; model the value with a precise type or helper.'- })- }- }- }- }-}--const noUnknownRecordDoubleCast = {- meta: {- docs: {- description: 'Disallow `as unknown as Record<string, unknown>` broad object casts'- }- },- create(context) {- return {- TSAsExpression(node) {- if (!isUnknownTypeAnnotation(node.expression?.typeAnnotation)) return- const targetType = context.sourceCode.getText(node.typeAnnotation).replace(/\s+/g, '')- if (targetType !== 'Record<string,unknown>') return- context.report({- node,- message:- 'Avoid `as unknown as Record<string, unknown>`; use a precise type or direct public API.'- })- }- }- }-}--const noFunctionType = {- meta: {- docs: {- description: 'Disallow the broad Function type; use an explicit callable signature'- }- },- create(context) {- return {- TSTypeReference(node) {- if (node.typeName?.type !== 'Identifier' || node.typeName.name !== 'Function') return- context.report({- node,- message: 'Use an explicit function signature instead of the broad Function type.'- })- }- }- }-}--const noReflectDeleteGlobalThisOutsideTests = {- meta: {- docs: {- description: 'Disallow Reflect.deleteProperty(globalThis, ...) outside tests'- }- },- create(context) {- const file = normalizedFilename(context)- if (file.includes('/tests/')) return {}-- return {- CallExpression(node) {- if (node.callee?.type !== 'MemberExpression') return- if (node.callee.object?.type !== 'Identifier' || node.callee.object.name !== 'Reflect')- return- if (- node.callee.property?.type !== 'Identifier' ||- node.callee.property.name !== 'deleteProperty'- )- return- const firstArg = node.arguments?.[0]- if (firstArg?.type !== 'Identifier' || firstArg.name !== 'globalThis') return- context.report({- node,- message:- 'Do not mutate globalThis outside tests; isolate platform state behind a boundary.'- })- }- }- }-}--const noTsSuppressionComments = {- meta: {- docs: {- description: 'Disallow TypeScript suppression comments; fix types instead'- }- },- create(context) {- return {- Program() {- const comments = context.sourceCode.getAllComments?.() ?? []- for (const comment of comments) {- if (!/@ts-(?:ignore|expect-error|nocheck|check)\b/.test(comment.value)) continue- context.report({- node: comment,- message:- 'Do not use TypeScript suppression comments; fix the type or add a typed helper.'- })- }- }- }- }-}--const noCoreBrowserGlobals = {- meta: {- docs: {- description:- 'Disallow direct browser globals in core outside explicit platform boundary modules'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.includes('/packages/core/src/')) return {}-- const allowedFiles = [- '/packages/core/src/constants.ts',- '/packages/core/src/editor/create.ts',- '/packages/core/src/canvas/renderer.ts',- '/packages/core/src/text/fonts.ts',- '/packages/core/src/profiler/render-profiler.ts',- '/packages/core/src/figma-api/index.ts'- ]- if (allowedFiles.some((suffix) => file.endsWith(suffix))) return {}-- return {- Identifier(node) {- if (node.name !== 'window' && node.name !== 'document' && node.name !== 'navigator') return- context.report({- node,- message: `Do not use browser global '${node.name}' in core; route it through a platform boundary.`- })- }- }- }-}--const noDirectGraphEmitterSubscriptions = {- meta: {- docs: {- description: 'Disallow direct graph.emitter.on subscriptions outside SceneGraph helpers'- }- },- create(context) {- const file = normalizedFilename(context)- if (file.endsWith('/packages/core/src/scene-graph/index.ts')) return {}-- return {- CallExpression(node) {- const callee = node.callee- if (callee?.type !== 'MemberExpression') return- if (callee.property?.type !== 'Identifier' || callee.property.name !== 'on') return- const object = callee.object- if (object?.type !== 'MemberExpression') return- if (object.property?.type !== 'Identifier' || object.property.name !== 'emitter') return- context.report({- node,- message: 'Use SceneGraph.onNodeEvents() instead of subscribing to graph.emitter directly.'- })- }- }- }-}--const noOnUnmountedInCompositionRoots = {- meta: {- docs: {- description: 'Prefer tryOnScopeDispose over onUnmounted in composable roots'- }- },- create(context) {- const file = normalizedFilename(context)- const applies =- (file.includes('/src/app/') || file.includes('/packages/vue/src/')) &&- /\/(?:use|create)\.ts$/.test(file)- if (!applies) return {}-- return {- CallExpression(node) {- if (node.callee?.type !== 'Identifier' || node.callee.name !== 'onUnmounted') return- context.report({- node,- message:- 'Use tryOnScopeDispose() for composable cleanup so callers outside component setup are handled safely.'- })- }- }- }-}--const noComposableStateWrappers = {- meta: {- docs: {- description: 'Disallow create*ComposableState wrapper factories in app and Vue SDK code'- }- },- create(context) {- const file = normalizedFilename(context)- const applies = file.includes('/src/app/') || file.includes('/packages/vue/src/')- if (!applies) return {}-- return {- FunctionDeclaration(node) {- if (!node.id?.name || !/^create\w*ComposableState$/.test(node.id.name)) return- context.report({- node,- message:- 'Avoid wrapper-of-wrapper composable state factories; keep setup local or extract a cohesive domain helper.'- })- }- }- }-}--const preferVueUseIntervals = {- meta: {- docs: {- description: 'Prefer VueUse interval helpers over manual setInterval/clearInterval pairs'- }- },- create(context) {- const file = normalizedFilename(context)- const applies = file.includes('/src/app/') || file.includes('/packages/vue/src/')- if (!applies) return {}-- function intervalName(callee) {- if (callee?.type === 'Identifier') return callee.name- if (callee?.type === 'MemberExpression' && callee.property?.type === 'Identifier') {- return callee.property.name- }- return null- }-- return {- CallExpression(node) {- const name = intervalName(node.callee)- if (name !== 'setInterval' && name !== 'clearInterval') return- context.report({- node,- message: 'Use useIntervalFn() from @vueuse/core instead of manual interval cleanup.'- })- }- }- }-}--const preferVueUseTimeouts = {- meta: {- docs: {- description: 'Prefer VueUse timeout helpers over manual timeout cleanup in composables'- }- },- create(context) {- const file = normalizedFilename(context)- const applies =- ((file.includes('/src/app/') || file.includes('/packages/vue/src/')) &&- /\/(?:use|create)\.ts$/.test(file)) ||- file.endsWith('/src/app/shell/toast/action.ts')- if (!applies) return {}-- return {- CallExpression(node) {- if (node.callee?.type !== 'Identifier' || node.callee.name !== 'clearTimeout') return- context.report({- node,- message:- 'Use useTimeoutFn() from @vueuse/core instead of manual timeout cleanup in composables.'- })- }- }- }-}--const maxCompositionRootLines = {- meta: {- docs: {- description:- 'Keep composition roots small; extract domain helpers before they become cleanup projects'- },- schema: [- {- type: 'object',- properties: {- max: { type: 'number' }- },- additionalProperties: false- }- ]- },- create(context) {- const file = normalizedFilename(context)- const applies =- (file.includes('/src/app/') || file.includes('/packages/vue/src/')) &&- /\/(?:use|create)\.ts$/.test(file)- if (!applies) return {}-- const max = context.options[0]?.max ?? 260-- return {- Program(node) {- const lineCount = context.sourceCode.getText().split('\n').length- if (lineCount <= max) return- context.report({- node,- message: `Composition root is ${lineCount} lines; extract helpers before exceeding ${max} lines.`- })- }- }- }-}--function isPascalCaseName(name) {- return /^[A-Z][A-Za-z0-9]*$/.test(name)-}--function isKebabOrLowercaseName(name) {- return /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(name)-}--const vueComponentFilePascalCase = {- meta: {- docs: {- description: 'Require Vue component files to use PascalCase names'- }- },- create(context) {- const file = normalizedFilename(context)- if (!file.endsWith('.vue')) return {}-- return {- Program(node) {- const basename =- file- .split('/')- .at(-1)- ?.replace(/\.vue$/, '') ?? ''- if (isPascalCaseName(basename)) return- context.report({- node,- message: 'Vue component files must use PascalCase names.'- })- }- }- }-}--const componentNamespaceCasing = {- meta: {- docs: {- description: 'Require component namespace folders to use the project casing convention'- }- },- create(context) {- const file = normalizedFilename(context)-- return {- Program(node) {- const primitiveMatch = file.match(/\/packages\/vue\/src\/primitives\/([^/]+)/)- if (primitiveMatch && !isPascalCaseName(primitiveMatch[1])) {- context.report({- node,- message: `Vue primitive namespace folder '${primitiveMatch[1]}' must use PascalCase.`- })- return- }-- const componentMatch = file.match(/\/src\/components\/(.+)$/)- if (!componentMatch) return-- const parts = componentMatch[1].split('/')- const first = parts[0]- const second = parts[1]-- if (parts.length > 1 && !isPascalCaseName(first) && !isKebabOrLowercaseName(first)) {- context.report({- node,- message: `Component namespace folder '${first}' must use PascalCase or kebab-case.`- })- return- }-- if (- parts.length > 2 &&- (first === 'chat' || first === 'properties') &&- second !== undefined &&- !isPascalCaseName(second) &&- !isKebabOrLowercaseName(second)- ) {- context.report({- node,- message: `Nested component namespace folder '${first}/${second}' must use PascalCase or kebab-case.`- })- }- }- }- }-}--const nonComponentSourceDirectoriesKebabCase = {- meta: {- docs: {- description: 'Require non-component source directories to use lowercase or kebab-case names'- }- },- create(context) {- const file = normalizedFilename(context)-- const roots = [- '/src/app/',- '/packages/core/src/',- '/packages/cli/src/',- '/packages/mcp/src/',- '/packages/vue/src/canvas/',- '/packages/vue/src/controls/',- '/packages/vue/src/document/',- '/packages/vue/src/editor/',- '/packages/vue/src/i18n/',- '/packages/vue/src/internal/',- '/packages/vue/src/shared/',- '/packages/vue/src/variables/'- ]-- const root = roots.find((candidate) => file.includes(candidate))- if (!root) return {}-- return {- Program(node) {- const relativePath = file.slice(file.indexOf(root) + root.length)- const directories = relativePath.split('/').slice(0, -1)- const invalid = directories.find((part) => !isKebabOrLowercaseName(part))- if (!invalid) return- context.report({- node,- message: `Non-component source directory '${invalid}' must use lowercase or kebab-case.`- })- }- }- }-}--const noComponentRootSiblingFolder = {- meta: {- docs: {- description: 'Disallow multi-file component roots beside their namespace folder'- }- },- create(context) {- const file = normalizedFilename(context)- const match = file.match(/\/src\/components\/(?:chat\/|properties\/)?([A-Z][A-Za-z0-9]*)\.vue$/)- if (!match) return {}-- return {- Program(node) {- const dir = file.replace(/\.vue$/, '')- if (!existsSync(dir)) return- context.report({- node,- message: `Move '${match[1]}.vue' inside its '${match[1]}/' component namespace folder.`- })- }- }- }-}--const noUselessPassThroughWrappers = {- meta: {- docs: {- description:- 'Disallow functions that only return another function call with the same arguments'- }- },- create(context) {- function paramNames(params) {- const names = []- for (const param of params ?? []) {- if (param.type !== 'Identifier') return null- names.push(param.name)- }- return names- }-- function returnedCall(body) {- if (!body) return null- if (body.type === 'CallExpression') return body- if (body.type !== 'BlockStatement') return null- const statements = body.body?.filter((statement) => statement.type !== 'EmptyStatement') ?? []- if (statements.length !== 1) return null- const statement = statements[0]- if (statement.type !== 'ReturnStatement') return null- return statement.argument?.type === 'CallExpression' ? statement.argument : null- }-- function calleeName(callee) {- return callee?.type === 'Identifier' ? callee.name : null- }-- function isSameArgumentForwarding(args, params) {- if (args?.length !== params.length) return false- return args.every((arg, index) => arg.type === 'Identifier' && arg.name === params[index])- }-- function check(node, name, params, body) {- const names = paramNames(params)- if (!names) return- const call = returnedCall(body)- if (!call || !isSameArgumentForwarding(call.arguments, names)) return- const target = calleeName(call.callee)- if (!target || target === name) return- context.report({- node,- message: `Remove pass-through wrapper '${name}'. Call '${target}' directly or give the wrapper real domain logic.`- })- }-- return {- FunctionDeclaration(node) {- if (!node.id?.name) return- check(node, node.id.name, node.params, node.body)- },- VariableDeclarator(node) {- if (node.id?.type !== 'Identifier') return- const init = node.init- if (- !init ||- (init.type !== 'ArrowFunctionExpression' && init.type !== 'FunctionExpression')- )- return- check(node, node.id.name, init.params, init.body)- }- }- }-}--const noFunctionAliasImports = {- meta: {- docs: {- description: 'Disallow import aliases ending in Fn for facade delegation'- }- },- create(context) {- return {- ImportSpecifier(node) {- if (!node.imported || !node.local) return- if (node.imported.type !== 'Identifier' || node.local.type !== 'Identifier') return- if (node.imported.name === node.local.name) return- if (!node.local.name.endsWith('Fn')) return- context.report({- node,- message:- 'Avoid aliasing imports as *Fn. Use a namespace import or give the exported helper a clearer domain name.'- })- }- }- }-}--const noDirectOpenPencilBrowserStore = {- meta: {- docs: {- description: 'Disallow direct window.openPencil.store access'- }- },- create(context) {- function propertyName(property) {- if (property?.type === 'Identifier') return property.name- if (property?.type === 'Literal' && typeof property.value === 'string') return property.value- return null- }-- function isOpenPencilMember(node) {- return (- node?.type === 'MemberExpression' &&- propertyName(node.property) === 'openPencil' &&- ((node.object?.type === 'Identifier' && node.object.name === 'window') ||- (node.object?.type === 'Identifier' && node.object.name === 'globalThis'))- )- }-- return {- MemberExpression(node) {- if (propertyName(node.property) !== 'store') return- if (!isOpenPencilMember(node.object)) return- context.report({- node,- message:- 'Use window.openPencil.getStore() instead of accessing window.openPencil.store directly.'- })- }- }- }-}--const noDirectOpenPencilWindowInternals = {- meta: {- docs: {- description: 'Disallow direct access to private OpenPencil window internals'- }- },- create(context) {- function propertyName(property) {- if (property?.type === 'Identifier') return property.name- if (property?.type === 'Literal' && typeof property.value === 'string') return property.value- return null- }-- return {- MemberExpression(node) {- const name = propertyName(node.property)- if (!name?.startsWith('__OPEN_PENCIL')) return- context.report({- node,- message:- 'Do not access window.__OPEN_PENCIL* directly. Use src/app/browser-bridge.ts or tests/helpers/store.ts instead.'- })- }- }- }-}--const noBunGlobalsInCli = {- meta: { docs: { description: 'Disallow Bun globals in Node-compatible CLI source' } },- create(context) {- const file = normalizedFilename(context)- if (!file.includes('/packages/cli/src/')) return {}- return {- MemberExpression(node) {- if (node.object?.type !== 'Identifier' || node.object.name !== 'Bun') return- context.report({- node,- message: 'Use Node-compatible APIs in CLI source instead of Bun globals.'- })- }- }- }-}-const noTopLevelPrefixedTestFiles = createProgramFilenameRule({- description: 'Disallow top-level test files that encode domains as filename prefixes',- check(file) {- const match = file.match(/\/tests\/(engine|e2e)\/([^/]+-[^/]+\.(?:test|spec)\.ts)$/)- if (!match) return false- return `Move '${match[2]}' under a domain folder instead of encoding the domain as a filename prefix.`- }-})--const noSiblingDomainPrefixedFiles = createProgramFilenameRule({- description: 'Disallow files that repeat an existing sibling domain folder in the filename',- check(file) {- const match = file.match(/^(.*\/)([^/]+)\.(?:test\.)?(?:spec\.)?(?:ts|tsx|vue)$/)- if (!match) return false-- const [, dir, name] = match- const parts = name.split('-')- if (parts.length < 2) return false-- const prefix = parts[0]- const suffix = parts.at(-1)- const domain = existsSync(`${dir}${prefix}`)- ? prefix- : suffix && existsSync(`${dir}${suffix}`)- ? suffix- : null- if (!domain) return false-- const filename = file.slice(dir.length)- return `Move '${filename}' under the existing '${domain}/' folder instead of repeating the domain in the filename.`- }-})--function typeParameterNodes(node) {- return node?.typeParameters?.params ?? node?.typeArguments?.params ?? []-}--function isRecordStringUnknownType(node) {- if (node?.type !== 'TSTypeReference') return false- if (node.typeName?.type !== 'Identifier' || node.typeName.name !== 'Record') return false- const params = typeParameterNodes(node)- return params[0]?.type === 'TSStringKeyword' && params[1]?.type === 'TSUnknownKeyword'-}--function hasAstChild(node, predicate, seen = new WeakSet()) {- if (!node || typeof node !== 'object') return false- if (seen.has(node)) return false- seen.add(node)- if (predicate(node)) return true-- for (const [key, value] of Object.entries(node)) {- if (key === 'parent' || key === 'range' || key === 'loc') continue- if (Array.isArray(value)) {- if (value.some((child) => hasAstChild(child, predicate, seen))) return true- } else if (value && typeof value === 'object' && hasAstChild(value, predicate, seen)) {- return true- }- }- return false-}--function containsRecordStringUnknownType(node) {- if (isRecordStringUnknownType(node)) return true- if (node?.type === 'TSArrayType') return isRecordStringUnknownType(node.elementType)- if (node?.type === 'TSUnionType')- return node.types?.some(containsRecordStringUnknownType) ?? false- return false-}--function isUnknownArrayType(node) {- return node?.type === 'TSArrayType' && node.elementType?.type === 'TSUnknownKeyword'-}--function hasInlineUnknownArrayProperty(node) {- if (node?.type !== 'TSTypeLiteral') return false- return (node.members ?? []).some((member) => {- const typeNode = member.typeAnnotation?.typeAnnotation- return isUnknownArrayType(typeNode)- })-}--function containsInlineUnknownObjectType(node) {- return hasAstChild(node, hasInlineUnknownArrayProperty)-}--const noBroadUnknownTypeAssertions = {- meta: {- docs: {- description:- 'Disallow broad unknown object type assertions. Add a named domain type or a type guard instead.'- }- },- create(context) {- function check(node) {- if (containsRecordStringUnknownType(node.typeAnnotation)) {- context.report({- node,- message:- 'Do not cast to Record<string, unknown>. Add a named domain type or a type guard.'- })- return- }- if (containsInlineUnknownObjectType(node.typeAnnotation)) {- context.report({- node,- message: 'Do not cast to an inline unknown object shape. Add a named domain type.'- })- }- }-- return {- TSAsExpression: check,- TSTypeAssertion: check- }- }-}--function typeNameText(node) {- if (!node) return 'unknown'- if (node.type === 'Identifier') return node.name- if (node.type === 'TSQualifiedName')- return `${typeNameText(node.left)}.${typeNameText(node.right)}`- return node.type-}--function canonicalType(node) {- if (!node) return 'unknown'- switch (node.type) {- case 'TSStringKeyword':- return 'string'- case 'TSNumberKeyword':- return 'number'- case 'TSBooleanKeyword':- return 'boolean'- case 'TSUnknownKeyword':- return 'unknown'- case 'TSNullKeyword':- return 'null'- case 'TSUndefinedKeyword':- return 'undefined'- case 'TSLiteralType':- return `literal:${node.literal?.value ?? node.literal?.type}`- case 'TSArrayType':- return `array<${canonicalType(node.elementType)}>`- case 'TSTypeReference': {- const params = typeParameterNodes(node).map(canonicalType).join(',')- return `ref:${typeNameText(node.typeName)}<${params}>`- }- case 'TSUnionType':- return `union<${node.types.map(canonicalType).sort().join('|')}>`- case 'TSTypeLiteral':- return `object{${canonicalMembers(node.members)}}`- case 'TSParenthesizedType':- return canonicalType(node.typeAnnotation)- case 'TSFunctionType':- return 'function'- default:- return node.type- }-}--function propertyKeyName(key) {- if (key?.type === 'Identifier') return key.name- if (key?.type === 'Literal') return String(key.value)- return null-}--function canonicalMember(member) {- if (member.type === 'TSIndexSignature') {- const param = member.parameters?.[0]- const keyType = param?.typeAnnotation?.typeAnnotation- return `index:${canonicalType(keyType)}:${canonicalType(member.typeAnnotation?.typeAnnotation)}`- }- if (member.type !== 'TSPropertySignature') return null- const name = propertyKeyName(member.key)- if (!name) return null- const optional = member.optional ? '?' : ''- return `prop:${name}${optional}:${canonicalType(member.typeAnnotation?.typeAnnotation)}`-}--function canonicalMembers(members) {- return (members ?? []).map(canonicalMember).filter(Boolean).sort().join(';')-}--function namedTypeShape(node) {- if (node.type === 'TSInterfaceDeclaration') return canonicalMembers(node.body?.body)- if (node.type === 'TSTypeAliasDeclaration' && node.typeAnnotation?.type === 'TSTypeLiteral') {- return canonicalMembers(node.typeAnnotation.members)- }- return null-}--const noDuplicateTypeShapes = {- meta: {- docs: {- description: 'Disallow duplicate local object type/interface shapes in one file'- }- },- create(context) {- const seen = new Map()- return {- 'TSInterfaceDeclaration, TSTypeAliasDeclaration'(node) {- const shape = namedTypeShape(node)- if (!shape) return- const memberCount = shape ? shape.split(';').filter(Boolean).length : 0- if (memberCount < 2) return- const first = seen.get(shape)- if (!first) {- seen.set(shape, node)- return- }- context.report({- node,- message:- 'Duplicate object type shape. Reuse the existing named type instead of redeclaring the same members.'- })- }- }- }-}--const noLocalJsonObjectAliases = {- meta: {- docs: {- description: 'Disallow local JsonObject aliases — import the shared type instead'- }- },- create(context) {- return {- TSTypeAliasDeclaration(node) {- if (node.id?.name !== 'JsonObject') return- if (!isRecordStringUnknownType(node.typeAnnotation)) return- context.report({- node,- message:- 'Import JsonObject from @open-pencil/scene-graph/primitives instead of declaring a local alias.'- })- }- }- }-}--const noImportTypeAnnotations = {- meta: {- docs: {- description: 'Disallow inline import() type annotations — use top-level import type instead'- }- },- create(context) {- return {- TSImportType(node) {- context.report({- node,- message:- 'Use a top-level import type instead of an inline import() type annotation. Dynamic imports are only for runtime lazy loading.'- })- }- }- }-}--const noMixedCaseAcronymIdentifiers = {- meta: {- docs: {- description: 'Require canonical uppercase casing for acronyms in first-party identifiers'- }- },- create(context) {- const canonicalAcronym =- /(?:Acp|Ai|Api|Cli|Cors|Css|Html|Ime|Json|Jsx|Mcp|Pdf|Png|Rgb|Rpc|Rtl|Svg|Ui|Url|Uri|Xml)/g- const ignoredImports = new Set([- '@agentclientprotocol/sdk',- '@tauri-apps/plugin-clipboard-manager',- '@tauri-apps/plugin-opener',- '@vueuse/core',- 'culori',- 'reka-ui'- ])- const upstreamIdentifiers = new Set([- 'convertToHsb',- 'convertToHsl',- 'convertToRgb',- 'formatCss',- 'formatRgb',- 'McpServer',- 'ndJsonStream',- 'openUrl',- 'useObjectUrl',- 'useUrlSearchParams',- 'writeHtml'- ])-- return {- Identifier(node) {- if (upstreamIdentifiers.has(node.name)) return- const mixedCaseAcronym = [...node.name.matchAll(canonicalAcronym)].find((match) => {- const end = (match.index ?? 0) + match[0].length- return end === node.name.length || /[A-Z0-9_$]/.test(node.name[end] ?? '')- })- if (!mixedCaseAcronym) return- const parent = node.parent- if (- (parent?.type === 'Property' || parent?.type === 'TSPropertySignature') &&- parent.key === node &&- !parent.computed &&- parent.value !== node- ) {- return- }- if (- parent?.type === 'MemberExpression' &&- parent.property === node &&- !parent.computed &&- parent.object.type !== 'ThisExpression'- ) {- return- }- if (- parent?.type === 'ImportSpecifier' &&- parent.imported === node &&- parent.parent?.source?.type === 'Literal' &&- ignoredImports.has(parent.parent.source.value)- ) {- return- }- if (parent?.type === 'ImportSpecifier' && parent.imported === node) return- if (- parent?.type === 'ImportDefaultSpecifier' ||- parent?.type === 'ImportNamespaceSpecifier'- ) {- return- }- context.report({- node,- message: `Use canonical uppercase acronym casing in "${node.name}".`- })- }- }- }-}--const noFlatKiwiModules = createProgramFilenameRule({- description: 'Disallow flat top-level Kiwi modules — group code under Kiwi subdomains',- check(file) {- const marker = '/packages/core/src/kiwi/'- const start = file.indexOf(marker)- if (start === -1) return false-- const relativePath = file.slice(start + marker.length)- if (relativePath.includes('/') || relativePath === 'index.ts') return false-- return 'Move Kiwi modules under binary/, fig/, node-change/, instance-overrides/, or kiwi-schema/ instead of adding flat top-level files.'- }-})--const plugin = {- meta: { name: 'open-pencil' },- rules: {- 'no-inline-named-types': noInlineNamedTypes,- 'no-import-type-annotations': noImportTypeAnnotations,- 'no-structuredclone-scene-arrays': noStructuredCloneSceneArrays,- 'no-vue-style-blocks': noVueStyleBlocks,- 'no-native-title-attributes-in-vue': noNativeTitleAttributesInVue,- 'no-hardcoded-tip-labels-in-vue': noHardcodedTipLabelsInVue,- 'no-raw-svg-in-app-vue-templates': noRawSvgInAppVueTemplates,- 'no-ui-helper-calls-in-vue-templates': noUiHelperCallsInVueTemplates,- 'no-large-property-section-components': noLargePropertySectionComponents,- 'no-raw-test-id-string-props': noRawTestIdStringProps,- 'no-dynamic-data-test-id-in-vue': noDynamicDataTestIdInVue,- 'no-test-id-helper-bind-in-vue': noTestIdHelperBindInVue,- 'no-invalid-test-id-attributes': noInvalidTestIdAttributes,- 'no-raw-test-id-selectors-in-tests': noRawTestIdSelectorsInTests,- 'no-generated-test-id-literals': noGeneratedTestIdLiterals,- 'no-browser-side-effects-in-vue': noBrowserSideEffectsInVue,- 'no-document-query-selector-in-vue': noDocumentQuerySelectorInVue,- 'no-direct-selection-tool-state-mutation': noDirectSelectionToolStateMutation,- 'no-math-random': noMathRandom,- 'no-hardcoded-color-constants': noHardcodedColorConstants,- 'no-hand-rolled-color': noHandRolledColor,- 'no-raw-console-format': noRawConsoleFormat,- 'no-silent-catch': noSilentCatch,- 'no-typeof-window-check': noTypeofWindowCheck,- 'no-vue-self-package-imports': noVueSelfPackageImports,- 'no-cross-package-source-imports': noCrossPackageSourceImports,- 'no-deep-parent-relative-imports': noDeepParentRelativeImports,- 'no-core-parent-relative-imports': noCoreParentRelativeImports,- 'no-mcp-parent-relative-imports': noMcpParentRelativeImports,- 'no-vue-parent-relative-imports': noVueParentRelativeImports,- 'no-cli-parent-relative-imports': noCliParentRelativeImports,- 'no-mcp-core-barrel-imports': noMcpCoreBarrelImports,- 'no-cli-core-barrel-imports': noCliCoreBarrelImports,- 'no-script-core-barrel-imports': noScriptCoreBarrelImports,- 'no-core-self-package-imports': noCoreSelfPackageImports,- 'no-inline-prompt-constants': noInlinePromptConstants,- 'no-app-vue-core-barrel-imports': noAppVueCoreBarrelImports,- 'no-app-imports-in-packages': noAppImportsInPackages,- 'no-core-framework-imports': noCoreFrameworkImports,- 'no-direct-storage-access': noDirectStorageAccess,- 'no-broad-double-cast': noBroadDoubleCast,- 'no-unknown-record-double-cast': noUnknownRecordDoubleCast,- 'no-broad-unknown-type-assertions': noBroadUnknownTypeAssertions,- 'no-local-json-object-aliases': noLocalJsonObjectAliases,- 'no-duplicate-type-shapes': noDuplicateTypeShapes,- 'no-ts-suppression-comments': noTsSuppressionComments,- 'no-function-type': noFunctionType,- 'no-reflect-delete-global-this-outside-tests': noReflectDeleteGlobalThisOutsideTests,- 'no-core-browser-globals': noCoreBrowserGlobals,- 'no-direct-open-pencil-window-internals': noDirectOpenPencilWindowInternals,- 'no-direct-open-pencil-browser-store': noDirectOpenPencilBrowserStore,- 'no-direct-graph-emitter-subscriptions': noDirectGraphEmitterSubscriptions,- 'no-on-unmounted-in-composition-roots': noOnUnmountedInCompositionRoots,- 'no-composable-state-wrappers': noComposableStateWrappers,- 'prefer-vueuse-intervals': preferVueUseIntervals,- 'prefer-vueuse-timeouts': preferVueUseTimeouts,- 'max-composition-root-lines': maxCompositionRootLines,- 'vue-component-file-pascal-case': vueComponentFilePascalCase,- 'component-namespace-casing': componentNamespaceCasing,- 'non-component-source-directories-kebab-case': nonComponentSourceDirectoriesKebabCase,- 'no-component-root-sibling-folder': noComponentRootSiblingFolder,- 'no-useless-pass-through-wrappers': noUselessPassThroughWrappers,- 'no-function-alias-imports': noFunctionAliasImports,- 'no-mixed-case-acronym-identifiers': noMixedCaseAcronymIdentifiers,- 'no-flat-kiwi-modules': noFlatKiwiModules,- 'no-bun-globals-in-cli': noBunGlobalsInCli,- 'no-top-level-prefixed-test-files': noTopLevelPrefixedTestFiles,- 'no-sibling-domain-prefixed-files': noSiblingDomainPrefixedFiles- }-}--export default plugin+export { default } from '../tools/lint/src/plugin.ts'diff --git a/oxlint.json b/oxlint.jsonindex d98eafde8..80fa0fc7b 100644--- a/oxlint.json+++ b/oxlint.json@@ -216,6 +216,7 @@"open-pencil/no-flat-kiwi-modules": "error","open-pencil/no-bun-globals-in-cli": "error","open-pencil/no-top-level-prefixed-test-files": "error",+ "open-pencil/no-conditional-object-spreads": "error","open-pencil/no-sibling-domain-prefixed-files": "error","array-callback-return": "error","block-scoped-var": "error",@@ -416,6 +417,17 @@"typescript/no-dynamic-delete": "error"},"overrides": [+ {+ "files": [+ "tools/lint/src/**/*.ts",+ "tools/lint/tests/**/*.ts"+ ],+ "rules": {+ "open-pencil/no-generated-test-id-literals": "off",+ "open-pencil/no-hardcoded-color-constants": "off",+ "open-pencil/no-mixed-case-acronym-identifiers": "off"+ }+ },{"files": ["src/**/*.ts",diff --git a/package.json b/package.jsonindex 9d9e89b3f..08a739305 100644--- a/package.json+++ b/package.json@@ -164,8 +164,10 @@"@types/node": "^25.9.5","@types/opentype.js": "^1.3.10","@types/ws": "^8.18.1",+ "@typescript-eslint/utils": "^8.67.0","@typescript/native-preview": "^7.0.0-dev.20260707.2","@vitejs/plugin-vue": "^6.0.8",+ "@vue/compiler-core": "^3.5.41","@wdio/cli": "9.30.1","@wdio/globals": "9.29.1","@wdio/local-runner": "9.30.1",diff --git a/packages/cli/src/app-client.ts b/packages/cli/src/app-client.tsindex 416b8f809..29f887c8d 100644--- a/packages/cli/src/app-client.ts+++ b/packages/cli/src/app-client.ts@@ -34,10 +34,9 @@ function doRequest(): Promise<{ status: number; data: unknown }> {return new Promise((resolve, reject) => {const bodyJSON = body ? JSON.stringify(body) : undefined- const headers: Record<string, string> = {- ...(bodyJSON ? { 'Content-Type': 'application/json' } : {}),- ...(info.authToken ? { Authorization: `Bearer ${info.authToken}` } : {})- }+ const headers: Record<string, string> = {}+ if (bodyJSON) headers['Content-Type'] = 'application/json'+ if (info.authToken) headers.Authorization = `Bearer ${info.authToken}`// Use the narrowed `useSocket` variable (string | false) to construct// request options so TypeScript knows socketPath is a string when truthy.diff --git a/packages/cli/src/app-target.ts b/packages/cli/src/app-target.tsindex 2b45e3c20..6533ef9d9 100644--- a/packages/cli/src/app-target.ts+++ b/packages/cli/src/app-target.ts@@ -20,8 +20,8 @@ export function appTargetRPCArgs(args: AppTargetCLIArgs): {document_id?: stringpage_id?: string} {- return {- ...(args['document-id'] ? { document_id: args['document-id'] } : {}),- ...(args['page-id'] ? { page_id: args['page-id'] } : {})- }+ const target: { document_id?: string; page_id?: string } = {}+ if (args['document-id']) target.document_id = args['document-id']+ if (args['page-id']) target.page_id = args['page-id']+ return target}diff --git a/packages/cli/src/commands/fonts.ts b/packages/cli/src/commands/fonts.tsindex 31d3948bf..964470ed5 100644--- a/packages/cli/src/commands/fonts.ts+++ b/packages/cli/src/commands/fonts.ts@@ -66,15 +66,18 @@ export default defineCommand({console.log('')console.log(fmtList(- data.faces.map((face) => ({- header: entity(face.family, face.style),- details: {- status: statusLabel(face.status),- ...(face.source ? { source: face.source } : {}),- ...(face.substituteFamily ? { substitute: face.substituteFamily } : {}),- ...(face.nodeIds.length > 0 ? { nodes: face.nodeIds.length } : {})+ data.faces.map((face) => {+ const details: Record<string, string | number> = {+ status: statusLabel(face.status)}- })),+ if (face.source) details.source = face.source+ if (face.substituteFamily) details.substitute = face.substituteFamily+ if (face.nodeIds.length > 0) details.nodes = face.nodeIds.length+ return {+ header: entity(face.family, face.style),+ details+ }+ }),{ compact: true }))diff --git a/packages/cli/src/rpc-data.ts b/packages/cli/src/rpc-data.tsindex 6e1a14ce0..0efdc8d95 100644--- a/packages/cli/src/rpc-data.ts+++ b/packages/cli/src/rpc-data.ts@@ -17,10 +17,9 @@ export async function loadRPCData<Result>(targetArgs?: AppTargetCLIArgs): Promise<Result> {if (isAppMode(file)) {- return rpc<Result>(command, {- ...(isRPCArgs(args) ? args : {}),- ...(targetArgs ? appTargetRPCArgs(targetArgs) : {})- })+ const rpcArgs: RPCArgs = isRPCArgs(args) ? { ...args } : {}+ if (targetArgs) Object.assign(rpcArgs, appTargetRPCArgs(targetArgs))+ return rpc<Result>(command, rpcArgs)}const graph = await loadDocument(requireFile(file))prepareDocumentForRPC(graph, command, args)diff --git a/packages/core/src/figma-api/components.ts b/packages/core/src/figma-api/components.tsindex 844a1ae4e..dee125373 100644--- a/packages/core/src/figma-api/components.ts+++ b/packages/core/src/figma-api/components.ts@@ -140,14 +140,14 @@ function propertyMetadata(definition: ComponentPropertyDefinition,includeVariantOptions: boolean): Pick<FigmaComponentPropertyDefinition, 'preferredValues' | 'variantOptions'> {- return {- ...(definition.preferredValues- ? { preferredValues: preferredValues(graph(target, internals), definition.preferredValues) }- : {}),- ...(includeVariantOptions && definition.variantOptions- ? { variantOptions: [...definition.variantOptions] }- : {})+ const metadata: Pick<FigmaComponentPropertyDefinition, 'preferredValues' | 'variantOptions'> = {}+ if (definition.preferredValues) {+ metadata.preferredValues = preferredValues(graph(target, internals), definition.preferredValues)}+ if (includeVariantOptions && definition.variantOptions) {+ metadata.variantOptions = [...definition.variantOptions]+ }+ return metadata}function definitions(target: ProxyThis,@@ -233,20 +233,16 @@ function editPropertyDefinitions(}const updatedName = changes.name?.trim()if (updatedName === '') throw new Error('Property name must not be empty')- const updated = {- ...definition,- ...(updatedName ? { name: updatedName } : {}),- ...(changes.defaultValue !== undefined- ? {- defaultValue:- definition.type === 'BOOLEAN'- ? String(changes.defaultValue === true || changes.defaultValue === 'true')- : String(changes.defaultValue)- }- : {}),- ...(changes.preferredValues- ? { preferredValues: changes.preferredValues.map((value) => value.key) }- : {})+ const updated: ComponentPropertyDefinition = { ...definition }+ if (updatedName) updated.name = updatedName+ if (changes.defaultValue !== undefined) {+ updated.defaultValue =+ definition.type === 'BOOLEAN'+ ? String(changes.defaultValue === true || changes.defaultValue === 'true')+ : String(changes.defaultValue)+ }+ if (changes.preferredValues) {+ updated.preferredValues = changes.preferredValues.map((value) => value.key)}updateNode(target, internals, {componentPropertyDefinitions: node.componentPropertyDefinitions.map((item) =>@@ -400,10 +396,10 @@ export function installComponentPropertyAccessors(defaultValue:type === 'BOOLEAN'? String(defaultValue === true || defaultValue === 'true')- : String(defaultValue),- ...(options?.preferredValues- ? { preferredValues: options.preferredValues.map((value) => value.key) }- : {})+ : String(defaultValue)+ }+ if (options?.preferredValues) {+ definition.preferredValues = options.preferredValues.map((value) => value.key)}updateNode(this, internals, {componentPropertyDefinitions: [...node.componentPropertyDefinitions, definition]diff --git a/packages/core/src/layout/effective-generated-text.ts b/packages/core/src/layout/effective-generated-text.tsindex 09133797e..2940f6098 100644--- a/packages/core/src/layout/effective-generated-text.ts+++ b/packages/core/src/layout/effective-generated-text.ts@@ -250,11 +250,10 @@ function propagateIntrinsicSizes(if (Object.keys(updates).length === 0) continueif (node.derivedLayout) {- updates.derivedLayout = {- ...node.derivedLayout,- ...(updates.width === undefined ? {} : { width: nextWidth }),- ...(updates.height === undefined ? {} : { height: nextHeight })- }+ const derivedLayout = { ...node.derivedLayout }+ if (updates.width !== undefined) derivedLayout.width = nextWidth+ if (updates.height !== undefined) derivedLayout.height = nextHeight+ updates.derivedLayout = derivedLayout}if (updates.width !== undefined) {stretchChildrenToEffectiveWidth(diff --git a/packages/core/src/tools/create/render.ts b/packages/core/src/tools/create/render.tsindex 11b3f3ce3..b983f29ef 100644--- a/packages/core/src/tools/create/render.ts+++ b/packages/core/src/tools/create/render.ts@@ -50,19 +50,25 @@ export const render = defineTool({figma.graph.reorderChild(result.id, parentId, args.insert_index)}- return {+ const response: {+ id: string+ name: string+ type: string+ children: string[]+ warnings?: typeof result.warnings+ siblings?: Array<{ id: string; name: string; type: string }>+ } = {id: result.id,name: result.name,type: result.type,- children: result.childIds,- ...(result.warnings ? { warnings: result.warnings } : {}),- ...(results.length > 1- ? {- siblings: results- .slice(1)- .map((node) => ({ id: node.id, name: node.name, type: node.type }))- }- : {})+ children: result.childIds}+ if (result.warnings) response.warnings = result.warnings+ if (results.length > 1) {+ response.siblings = results+ .slice(1)+ .map((node) => ({ id: node.id, name: node.name, type: node.type }))+ }+ return response}})diff --git a/packages/dom-css/src/serialize.ts b/packages/dom-css/src/serialize.tsindex daf0c1213..84ac27c12 100644--- a/packages/dom-css/src/serialize.ts+++ b/packages/dom-css/src/serialize.ts@@ -80,13 +80,11 @@ function serializeAttrs(node: DesignElement, options: SerializeHTMLOptions): strconst attrsWithoutStyle = { ...node.attrs }delete attrsWithoutStyle.styleconst sourceAttrs = options.style === 'tailwind' && tailwindClass ? attrsWithoutStyle : node.attrs- const attrs = {- ...sourceAttrs,- ...(tailwindClass ? { class: mergeClassNames(node.attrs.class, tailwindClass) } : {}),- ...(style && options.style !== 'tailwind' ? { style } : {})- }+ const attrs: Record<string, string | undefined> = { ...sourceAttrs }+ if (tailwindClass) attrs.class = mergeClassNames(node.attrs.class, tailwindClass)+ if (style && options.style !== 'tailwind') attrs.style = styleconst serialized = Object.entries(attrs)- .filter(([, value]) => value !== '')+ .filter((entry): entry is [string, string] => typeof entry[1] === 'string' && entry[1] !== '').map(([name, value]) => `${name}="${escapeAttr(value)}"`)if (serialized.length === 0) return ''diff --git a/packages/fig/src/instance-overrides/derived-symbol-data/propagate.ts b/packages/fig/src/instance-overrides/derived-symbol-data/propagate.tsindex 98415789a..00e908fd2 100644--- a/packages/fig/src/instance-overrides/derived-symbol-data/propagate.ts+++ b/packages/fig/src/instance-overrides/derived-symbol-data/propagate.ts@@ -8,9 +8,7 @@ import { overrideCandidates } from '../utils'function buildSizeOverriddenCloneUpdates(source: SceneNode, clone: SceneNode): Partial<SceneNode> {if (clone.type !== 'INSTANCE' || !source.derivedLayout) return {}const sourceLayout = source.derivedLayout- return {- ...(sourceLayout.x === undefined ? {} : { x: sourceLayout.x }),- ...(sourceLayout.y === undefined ? {} : { y: sourceLayout.y }),+ const updates: Partial<SceneNode> = {derivedLayout: {...sourceLayout,...clone.derivedLayout,@@ -18,6 +16,9 @@ function buildSizeOverriddenCloneUpdates(source: SceneNode, clone: SceneNode): Py: sourceLayout.y ?? clone.derivedLayout?.y}}+ if (sourceLayout.x !== undefined) updates.x = sourceLayout.x+ if (sourceLayout.y !== undefined) updates.y = sourceLayout.y+ return updates}function buildCloneUpdates(diff --git a/packages/harness/src/backends/pi.ts b/packages/harness/src/backends/pi.tsindex a457b975a..e61e0c606 100644--- a/packages/harness/src/backends/pi.ts+++ b/packages/harness/src/backends/pi.ts@@ -163,13 +163,16 @@ export class PiHarnessBackend implements HarnessBackend {...optional('instructions', configuration.instructions ?? this.defaults.instructions),permissionMode: permissionMode ?? this.defaults.permissionMode ?? 'allow-edits'})- const session = await agent.createSession({- sessionId: options.sessionId,- ...(options.resumeState === undefined- ? {}- : { resumeFrom: options.resumeState as HarnessAgentResumeSessionState }),- ...(options.signal === undefined ? {} : { abortSignal: options.signal })- })+ const sessionOptions: {+ sessionId: string+ resumeFrom?: HarnessAgentResumeSessionState+ abortSignal?: AbortSignal+ } = { sessionId: options.sessionId }+ if (options.resumeState !== undefined) {+ sessionOptions.resumeFrom = options.resumeState as HarnessAgentResumeSessionState+ }+ if (options.signal !== undefined) sessionOptions.abortSignal = options.signal+ const session = await agent.createSession(sessionOptions)return new PiBackendSession(agent, session)})}diff --git a/packages/harness/src/protocol.ts b/packages/harness/src/protocol.tsindex 1917e808a..ccb11c9ce 100644--- a/packages/harness/src/protocol.ts+++ b/packages/harness/src/protocol.ts@@ -97,16 +97,18 @@ function parseConfiguration(value: unknown): HarnessSessionConfiguration {if (!isAdapterID(value.adapter)) throw new Error('Unknown Harness adapter')if (!isSandboxID(value.sandbox)) throw new Error('Unknown Harness sandbox')const mcpServers = parseJSONRecord(value.mcpServers, 'mcpServers')- return {+ const settings = parseJSONRecord(value.settings, 'settings')+ const configuration: HarnessSessionConfiguration = {adapter: value.adapter,sandbox: value.sandbox,- model: requireString(value, 'model'),- ...(parseJSONRecord(value.settings, 'settings')- ? { settings: parseJSONRecord(value.settings, 'settings') }- : {}),- ...(mcpServers ? { mcpServers: mcpServers as Record<string, Record<string, JSONValue>> } : {}),- ...(typeof value.instructions === 'string' ? { instructions: value.instructions } : {})+ model: requireString(value, 'model')}+ if (settings) configuration.settings = settings+ if (mcpServers) {+ configuration.mcpServers = mcpServers as Record<string, Record<string, JSONValue>>+ }+ if (typeof value.instructions === 'string') configuration.instructions = value.instructions+ return configuration}function parseSessionParams(value: unknown): { sessionId: string } {diff --git a/packages/harness/src/stdio.ts b/packages/harness/src/stdio.tsindex a4833ee54..5c4258b69 100644--- a/packages/harness/src/stdio.ts+++ b/packages/harness/src/stdio.ts@@ -5,6 +5,7 @@ import { join } from 'node:path'import { createInterface } from 'node:readline'import { PiHarnessBackend } from '#harness/backends/pi'+import type { PiHarnessBackendOptions } from '#harness/backends/pi'import type { HarnessRequest, HarnessSidecarMessage } from '#harness/protocol'import { parseHarnessRequest } from '#harness/protocol'import { HarnessSessionService } from '#harness/service'@@ -14,10 +15,10 @@ const stateRoot =process.env.OPENPENCIL_HARNESS_STATE_DIR ?? join(homedir(), '.open-pencil', 'harness-sessions')const agentDir = process.env.OPENPENCIL_HARNESS_AGENT_DIRconst apiKey = process.env.OPENPENCIL_HARNESS_API_KEY-const backend = new PiHarnessBackend({- ...(agentDir ? { agentDir } : {}),- ...(apiKey ? { apiKey } : {})-})+const backendOptions: PiHarnessBackendOptions = {}+if (agentDir) backendOptions.agentDir = agentDir+if (apiKey) backendOptions.apiKey = apiKey+const backend = new PiHarnessBackend(backendOptions)const service = new HarnessSessionService(new Map([[backend.id, backend]]),new FileResumeStateStore(stateRoot)diff --git a/packages/mcp/src/stdio/bridge.ts b/packages/mcp/src/stdio/bridge.tsindex 4c21092e8..746eb86d3 100644--- a/packages/mcp/src/stdio/bridge.ts+++ b/packages/mcp/src/stdio/bridge.ts@@ -140,10 +140,9 @@ export function createStdioRPCBridge({): Promise<{ status: number; data: unknown; req: ClientRequest }> {return new Promise((resolve, reject) => {const bodyJSON = body ? JSON.stringify(body) : undefined- const headers: Record<string, string> = {- ...(bodyJSON ? { 'Content-Type': 'application/json' } : {}),- ...(resolvedAuthToken ? { Authorization: `Bearer ${resolvedAuthToken}` } : {})- }+ const headers: Record<string, string> = {}+ if (bodyJSON) headers['Content-Type'] = 'application/json'+ if (resolvedAuthToken) headers.Authorization = `Bearer ${resolvedAuthToken}`let reqOpts: RequestOptions | null = nullif (transportMode === 'socket' && resolvedSocketPath) {diff --git a/packages/mcp/src/tool/registration.ts b/packages/mcp/src/tool/registration.tsindex dc315f62f..97fb999d1 100644--- a/packages/mcp/src/tool/registration.ts+++ b/packages/mcp/src/tool/registration.ts@@ -27,13 +27,10 @@ function splitAutomationTarget(args: Record<string, unknown>): {args: Record<string, unknown>} {const { document_id, page_id, ...rest } = args- return {- target: {- ...(typeof document_id === 'string' ? { document_id } : {}),- ...(typeof page_id === 'string' ? { page_id } : {})- },- args: rest- }+ const target: { document_id?: string; page_id?: string } = {}+ if (typeof document_id === 'string') target.document_id = document_id+ if (typeof page_id === 'string') target.page_id = page_id+ return { target, args: rest }}export interface RegisterToolsOptions {@@ -183,11 +180,10 @@ export function registerTools(mcpServer: McpServer, options: RegisterToolsOption})const res = result as { ok?: boolean; result?: unknown; target?: unknown; error?: string }if (res.ok === false) return fail(new Error(res.error))- return ok({- saved: true,- ...(safePath ? { path: safePath.resolved } : {}),- ...(res.target ? { target: res.target } : {})- })+ const response: { saved: true; path?: string; target?: unknown } = { saved: true }+ if (safePath) response.path = safePath.resolved+ if (res.target) response.target = res.target+ return ok(response)} catch (e) {return fail(e)}@@ -217,7 +213,9 @@ export function registerTools(mcpServer: McpServer, options: RegisterToolsOption})const res = result as { ok?: boolean; result?: unknown; target?: unknown; error?: string }if (res.ok === false) return fail(new Error(res.error))- return ok({ opened: true, ...(res.target ? { target: res.target } : {}) })+ const response: { opened: true; target?: unknown } = { opened: true }+ if (res.target) response.target = res.target+ return ok(response)} catch (e) {return fail(e)}@@ -249,7 +247,9 @@ export function registerTools(mcpServer: McpServer, options: RegisterToolsOption})const res = result as { ok?: boolean; result?: unknown; target?: unknown; error?: string }if (res.ok === false) return fail(new Error(res.error))- return ok({ created: true, ...(res.target ? { target: res.target } : {}) })+ const response: { created: true; target?: unknown } = { created: true }+ if (res.target) response.target = res.target+ return ok(response)} catch (e) {return fail(e)}diff --git a/packages/vue/src/shared/input/resize.ts b/packages/vue/src/shared/input/resize.tsindex 76533a7ec..3b2310b41 100644--- a/packages/vue/src/shared/input/resize.ts+++ b/packages/vue/src/shared/input/resize.ts@@ -277,15 +277,14 @@ export function commitResizePreview(dragState: DragResize, editor: Editor) {editor.updateNode(d.nodeId, finalChanges)})clearResizedRawGeometry(editor, d.nodeId)- editor.commitResize(d.nodeId, {- ...d.origRect,- ...(d.origVectorNetwork || node.vectorNetwork ? { vectorNetwork: d.origVectorNetwork } : {}),- ...(d.origFillGeometry.length > 0 ? { fillGeometry: d.origFillGeometry } : {}),- ...(d.origStrokeGeometry.length > 0 ? { strokeGeometry: d.origStrokeGeometry } : {}),- ...(d.origDerivedTextGlyphs?.length ? { derivedTextGlyphs: d.origDerivedTextGlyphs } : {}),- ...(d.origStrokes.length > 0 ? { strokes: d.origStrokes } : {}),- ...(d.origTextPathData ? { textPathData: d.origTextPathData } : {}),- ...(d.origTextPathBox ? { textPathBox: d.origTextPathBox } : {})- })+ const original: Parameters<typeof editor.commitResize>[1] = { ...d.origRect }+ if (d.origVectorNetwork || node.vectorNetwork) original.vectorNetwork = d.origVectorNetwork+ if (d.origFillGeometry.length > 0) original.fillGeometry = d.origFillGeometry+ if (d.origStrokeGeometry.length > 0) original.strokeGeometry = d.origStrokeGeometry+ if (d.origDerivedTextGlyphs?.length) original.derivedTextGlyphs = d.origDerivedTextGlyphs+ if (d.origStrokes.length > 0) original.strokes = d.origStrokes+ if (d.origTextPathData) original.textPathData = d.origTextPathData+ if (d.origTextPathBox) original.textPathBox = d.origTextPathBox+ editor.commitResize(d.nodeId, original)}}diff --git a/src/app/automation/bridge/vite-plugin.ts b/src/app/automation/bridge/vite-plugin.tsindex 5af41db5c..66756dec9 100644--- a/src/app/automation/bridge/vite-plugin.ts+++ b/src/app/automation/bridge/vite-plugin.ts@@ -34,17 +34,18 @@ export function createAutomationEnvironment(const childEnv = { ...baseEnv }delete childEnv.OPENPENCIL_MCP_SOCKETdelete childEnv.OPENPENCIL_MCP_AUTH_TOKEN- return {+ const environment: NodeJS.ProcessEnv = {...childEnv,PORT: String(httpPort),OPENPENCIL_MCP_TCP: '1',- ...(socketPath ? { OPENPENCIL_MCP_SOCKET: socketPath } : {}),- ...(discoveryPath ? { OPENPENCIL_MCP_DISCOVERY_PATH: discoveryPath } : {}),OPENPENCIL_MCP_AUTH_TOKEN: configuration.authenticationEnabled ? (authToken ?? '') : '',OPENPENCIL_MCP_CORS_ORIGIN: corsOrigin,OPENPENCIL_MCP_ROOT: configuration.rootDirectory.trim() || process.cwd(),OPENPENCIL_MCP_DISABLED_TOOLS: serializeDisabledTools(configuration.disabledTools)}+ if (socketPath) environment.OPENPENCIL_MCP_SOCKET = socketPath+ if (discoveryPath) environment.OPENPENCIL_MCP_DISCOVERY_PATH = discoveryPath+ return environment}const MAX_CONFIGURATION_BYTES = 70_000diff --git a/src/app/automation/mcp/spawn.ts b/src/app/automation/mcp/spawn.tsindex b14928c40..388303d02 100644--- a/src/app/automation/mcp/spawn.ts+++ b/src/app/automation/mcp/spawn.ts@@ -219,14 +219,13 @@ function parseAutomationHealth(value: unknown): AutomationHealth | null {) {return null}- return {- status: value.status,- ...(version !== undefined ? { version } : {}),- ...(installCommand !== undefined ? { installCommand } : {}),- ...(authRequired !== undefined ? { authRequired } : {}),- ...(discoveryPath !== undefined ? { discoveryPath } : {}),- ...(tools !== undefined ? { tools } : {})- }+ const health: AutomationHealth = { status: value.status }+ if (version !== undefined) health.version = version+ if (installCommand !== undefined) health.installCommand = installCommand+ if (authRequired !== undefined) health.authRequired = authRequired+ if (discoveryPath !== undefined) health.discoveryPath = discoveryPath+ if (tools !== undefined) health.tools = tools+ return health}export async function readAutomationHealth(diff --git a/src/app/integrations/storage/s3/client.ts b/src/app/integrations/storage/s3/client.tsindex 0d9fb7fec..0afbe21f0 100644--- a/src/app/integrations/storage/s3/client.ts+++ b/src/app/integrations/storage/s3/client.ts@@ -215,16 +215,15 @@ export async function putObject(bytes.byteOffset,bytes.byteOffset + bytes.byteLength) as ArrayBuffer+ const headers: Record<string, string> = { 'Content-Type': contentType }+ if (options?.ifMatch) headers['If-Match'] = options.ifMatch+ if (options?.ifNoneMatch) headers['If-None-Match'] = options.ifNoneMatchconst res = await s3Request(config,objectURL(config, key),{method: 'PUT',- headers: {- 'Content-Type': contentType,- ...(options?.ifMatch ? { 'If-Match': options.ifMatch } : {}),- ...(options?.ifNoneMatch ? { 'If-None-Match': options.ifNoneMatch } : {})- },+ headers,body: payload},onUploadProgressdiff --git a/tests/e2e/canvas/component-labels.spec.ts b/tests/e2e/canvas/labels/component.spec.tssimilarity index 100%rename from tests/e2e/canvas/component-labels.spec.tsrename to tests/e2e/canvas/labels/component.spec.tsdiff --git a/tests/engine/app/variables-editor.test.ts b/tests/engine/app/editor/variables.test.tssimilarity index 100%rename from tests/engine/app/variables-editor.test.tsrename to tests/engine/app/editor/variables.test.tsdiff --git a/tests/engine/app/font-settings.test.ts b/tests/engine/app/settings/font.test.tssimilarity index 100%rename from tests/engine/app/font-settings.test.tsrename to tests/engine/app/settings/font.test.tsdiff --git a/tests/engine/editor/variable-bindings-undo.test.ts b/tests/engine/editor/undo/variable-bindings.test.tssimilarity index 100%rename from tests/engine/editor/variable-bindings-undo.test.tsrename to tests/engine/editor/undo/variable-bindings.test.tsdiff --git a/tests/engine/layout/auto-layout/imported-derived-layout.test.ts b/tests/engine/layout/auto-layout/layout/imported-derived.test.tssimilarity index 100%rename from tests/engine/layout/auto-layout/imported-derived-layout.test.tsrename to tests/engine/layout/auto-layout/layout/imported-derived.test.tsdiff --git a/tests/engine/render/canvas/boolean-visual.test.ts b/tests/engine/render/canvas/visual/boolean.test.tssimilarity index 100%rename from tests/engine/render/canvas/boolean-visual.test.tsrename to tests/engine/render/canvas/visual/boolean.test.tsdiff --git a/tools/lint/package.json b/tools/lint/package.jsonnew file mode 100644index 000000000..f8e0b3b12--- /dev/null+++ b/tools/lint/package.json@@ -0,0 +1,11 @@+{+ "name": "@open-pencil/lint-tools",+ "private": true,+ "type": "module",+ "imports": {+ "#lint/*": "./src/*"+ },+ "scripts": {+ "test": "tsc --noEmit -p tsconfig.json && bun test tests"+ }+}diff --git a/tools/lint/src/plugin.ts b/tools/lint/src/plugin.tsnew file mode 100644index 000000000..c907668c7--- /dev/null+++ b/tools/lint/src/plugin.ts@@ -0,0 +1,494 @@+import {+ noConditionalObjectSpreads,+ noFlatKiwiModules,+ noMixedCaseAcronymIdentifiers+} from '#lint/rules/policy.ts'+import { normalizedFilename } from '#lint/support/context.ts'+import type { RuleDefinition } from '#lint/support/types.ts'+import type { TSESTree } from '@typescript-eslint/utils'++import type { Color } from '@open-pencil/scene-graph'++const noInlineNamedTypes = {+ meta: {+ docs: {+ description: 'Disallow inline type literals that duplicate a named type'+ },+ schema: [+ {+ type: 'object',+ additionalProperties: {+ type: 'string'+ }+ }+ ]+ },+ create(context) {+ const typesOption = context.options[0]+ if (!typesOption || typeof typesOption !== 'object') return {}++ const shapeToName = new Map<string, string>()+ for (const [name, shape] of Object.entries(typesOption)) {+ if (typeof shape === 'string') shapeToName.set(shape, name)+ }++ return {+ TSTypeLiteral(node) {+ const props = node.members?.filter(+ (member) => member.type === 'TSPropertySignature' && member.key?.type === 'Identifier'+ )+ if (!props || props.length < 2) return++ const shape = props+ .map((member) => {+ if (member.type !== 'TSPropertySignature' || member.key.type !== 'Identifier') {+ return ''+ }+ const typeNode = member.typeAnnotation?.typeAnnotation+ let typeName = 'unknown'+ if (typeNode) {+ switch (typeNode.type) {+ case 'TSNumberKeyword':+ typeName = 'number'+ break+ case 'TSStringKeyword':+ typeName = 'string'+ break+ case 'TSBooleanKeyword':+ typeName = 'boolean'+ break+ }+ }+ return `${member.key.name}:${typeName}`+ })+ .sort()+ .join(',')++ const namedType = shapeToName.get(shape)+ if (namedType) {+ context.report({+ node,+ message: `Use '${namedType}' instead of inline type literal. Import from '@open-pencil/core'.`+ })+ }+ }+ }+ }+} satisfies RuleDefinition++const noStructuredCloneSceneArrays = {+ meta: {+ docs: {+ description:+ 'Disallow structuredClone on fills/strokes/effects — use typed copy helpers from copy.ts'+ },+ schema: [+ {+ type: 'array',+ items: { type: 'string' },+ description: 'Property names that should use typed copy helpers'+ }+ ]+ },+ create(context) {+ const configuredProperties = context.options[0]+ const props = new Set<string>(+ Array.isArray(configuredProperties)+ ? configuredProperties.filter((value): value is string => typeof value === 'string')+ : ['fills', 'strokes', 'effects', 'styleRuns', 'fillGeometry', 'strokeGeometry']+ )+ return {+ CallExpression(node) {+ if (node.callee?.type !== 'Identifier' || node.callee.name !== 'structuredClone') return+ if (node.arguments?.length !== 1) return+ const arg = node.arguments[0]+ if (arg.type === 'MemberExpression' && arg.property?.type === 'Identifier') {+ if (props.has(arg.property.name)) {+ context.report({+ node,+ message: `Use the typed copy helper instead of structuredClone for '${arg.property.name}'. Import from '@open-pencil/core'.`+ })+ }+ }+ }+ }+ }+} satisfies RuleDefinition++import {+ noVueStyleBlocks,+ noNativeTitleAttributesInVue,+ noHardcodedTipLabelsInVue,+ noRawSvgInAppVueTemplates,+ noUiHelperCallsInVueTemplates,+ noLargePropertySectionComponents,+ noRawTestIdStringProps,+ noDynamicDataTestIdInVue,+ noTestIdHelperBindInVue,+ noInvalidTestIdAttributes,+ noRawTestIdSelectorsInTests,+ noGeneratedTestIdLiterals,+ noBrowserSideEffectsInVue,+ noDocumentQuerySelectorInVue+} from '#lint/rules/vue/index.ts'++const noDirectSelectionToolStateMutation = {+ meta: {+ docs: {+ description:+ 'Disallow direct editor selection/tool state assignment outside core editor internals'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.includes('/packages/core/src/editor/')) return {}++ return {+ AssignmentExpression(node) {+ if (node.operator !== '=') return+ const left = node.left+ if (left?.type !== 'MemberExpression') return+ if (left.property?.type !== 'Identifier') return+ if (left.property.name !== 'selectedIds' && left.property.name !== 'activeTool') return+ const stateExpr = left.object+ if (stateExpr?.type !== 'MemberExpression') return+ if (stateExpr.property?.type !== 'Identifier' || stateExpr.property.name !== 'state') return+ context.report({+ node,+ message:+ 'Do not assign editor.state.selectedIds or editor.state.activeTool directly. Use editor selection/tool actions.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noMathRandom = {+ meta: {+ docs: {+ description: 'Disallow Math.random() — use crypto.getRandomValues() instead'+ }+ },+ create(context) {+ return {+ CallExpression(node) {+ if (+ node.callee?.type === 'MemberExpression' &&+ node.callee.object?.type === 'Identifier' &&+ node.callee.object.name === 'Math' &&+ node.callee.property?.type === 'Identifier' &&+ node.callee.property.name === 'random'+ ) {+ context.report({+ node,+ message: 'Use crypto.getRandomValues() instead of Math.random().'+ })+ }+ }+ }+ }+} satisfies RuleDefinition++function isNumericLiteral(node: TSESTree.Node | undefined, value: number): boolean {+ return node?.type === 'Literal' && node.value === value+}++function colorObjectLiteral(node: TSESTree.ObjectExpression, color: Color): boolean {+ if (node?.type !== 'ObjectExpression') return false+ const props = new Map<string, TSESTree.Node>()+ for (const prop of node.properties ?? []) {+ if (prop.type !== 'Property') return false+ let key: string | null = null+ if (prop.key.type === 'Identifier') key = prop.key.name+ else if (prop.key.type === 'Literal') key = String(prop.key.value)+ if (key === null) return false+ props.set(key, prop.value)+ }+ return Object.entries(color).every(([key, value]) => isNumericLiteral(props.get(key), value))+}++const noHardcodedColorConstants = {+ meta: {+ docs: {+ description:+ 'Use named color constants instead of inline Color object literals for shared colors'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.includes('/tests/') || file.endsWith('/packages/core/src/constants.ts')) return {}++ return {+ ObjectExpression(node) {+ if (colorObjectLiteral(node, { r: 0, g: 0, b: 0, a: 1 })) {+ context.report({+ node,+ message: 'Use BLACK from constants instead of an inline black Color literal.'+ })+ }+ if (colorObjectLiteral(node, { r: 0, g: 0, b: 0, a: 0 })) {+ context.report({+ node,+ message:+ 'Use TRANSPARENT from constants instead of an inline transparent Color literal.'+ })+ }+ }+ }+ }+} satisfies RuleDefinition++const noHandRolledColor = {+ meta: {+ docs: {+ description:+ 'Disallow hand-rolled color conversions — use helpers from color.ts (colorToCSS, colorToHex, parseColor, etc.)'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.includes('/color') && /(?:color\.ts|color\/index\.ts)$/.test(file)) return {}++ return {+ TemplateLiteral(node) {+ const hasHandRolledRgb = node.quasis?.some((quasi) => {+ const raw = quasi.value?.raw+ return typeof raw === 'string' && (raw.includes('rgb(') || raw.includes('rgba('))+ })+ if (!hasHandRolledRgb) return+ context.report({+ node,+ message:+ 'Use colorToCSS() or colorToHex() from color.ts instead of hand-rolled rgba()/rgb() strings.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noRawConsoleFormat = {+ meta: {+ docs: {+ description:+ 'Disallow hand-rolled formatting in console.log — use agentfmt helpers (bold, dim, kv, entity, fmtTree, fmtList, etc.)'+ }+ },+ create(context) {+ return {+ CallExpression(node) {+ if (+ node.callee?.type !== 'MemberExpression' ||+ node.callee.object?.type !== 'Identifier' ||+ node.callee.object.name !== 'console' ||+ node.callee.property?.type !== 'Identifier' ||+ node.callee.property.name !== 'log'+ )+ return+ if (!node.arguments?.length) return++ for (const arg of node.arguments) {+ if (arg.type === 'TemplateLiteral' && arg.expressions?.length > 0) {+ context.report({+ node,+ message:+ 'Use agentfmt helpers (bold, dim, kv, entity, etc.) instead of template literals in console.log.'+ })+ return+ }+ if (arg.type === 'BinaryExpression' && arg.operator === '+') {+ context.report({+ node,+ message:+ 'Use agentfmt helpers (bold, dim, kv, entity, etc.) instead of string concatenation in console.log.'+ })+ return+ }+ }+ }+ }+ }+} satisfies RuleDefinition++const noSilentCatch = {+ meta: {+ docs: {+ description:+ 'Disallow empty catch blocks — log a warning or re-throw instead of silently swallowing errors'+ }+ },+ create(context) {+ return {+ CatchClause(node) {+ const body = node.body+ if (!body || !body.body) return+ const stmts = body.body.filter((s) => s.type !== 'EmptyStatement')+ if (stmts.length === 0) {+ context.report({+ node,+ message:+ 'Empty catch block silently swallows errors. Add console.warn(), re-throw, or an explicit // oxlint-ignore-next-line comment.'+ })+ }+ }+ }+ }+} satisfies RuleDefinition++const noTypeofWindowCheck = {+ meta: {+ docs: {+ description: 'Disallow raw typeof window checks — use IS_BROWSER or IS_TAURI from constants'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.endsWith('constants.ts')) return {}++ return {+ BinaryExpression(node) {+ if (node.operator !== '!==' && node.operator !== '===') return+ const isTypeofWindow = (side: TSESTree.Expression) =>+ side.type === 'UnaryExpression' &&+ side.operator === 'typeof' &&+ side.argument?.type === 'Identifier' &&+ side.argument.name === 'window'+ if (isTypeofWindow(node.left) || isTypeofWindow(node.right)) {+ context.report({+ node,+ message:+ "Use IS_BROWSER or IS_TAURI from constants instead of raw 'typeof window' checks."+ })+ }+ }+ }+ }+} satisfies RuleDefinition++import {+ noVueSelfPackageImports,+ noCrossPackageSourceImports,+ noDeepParentRelativeImports,+ noCoreParentRelativeImports,+ noMcpParentRelativeImports,+ noVueParentRelativeImports,+ noCliParentRelativeImports,+ noMcpCoreBarrelImports,+ noCliCoreBarrelImports,+ noScriptCoreBarrelImports,+ noCoreSelfPackageImports,+ noInlinePromptConstants,+ noAppVueCoreBarrelImports,+ noAppImportsInPackages,+ noCoreFrameworkImports+} from '#lint/rules/imports.ts'+import {+ noDirectStorageAccess,+ noBroadDoubleCast,+ noUnknownRecordDoubleCast,+ noFunctionType,+ noReflectDeleteGlobalThisOutsideTests,+ noTsSuppressionComments,+ noCoreBrowserGlobals,+ noDirectGraphEmitterSubscriptions,+ noOnUnmountedInCompositionRoots,+ noComposableStateWrappers,+ preferVueUseIntervals,+ preferVueUseTimeouts,+ maxCompositionRootLines+} from '#lint/rules/runtime.ts'+import {+ vueComponentFilePascalCase,+ componentNamespaceCasing,+ nonComponentSourceDirectoriesKebabCase,+ noComponentRootSiblingFolder,+ noUselessPassThroughWrappers,+ noFunctionAliasImports,+ noDirectOpenPencilBrowserStore,+ noDirectOpenPencilWindowInternals,+ noBunGlobalsInCli,+ noTopLevelPrefixedTestFiles,+ noSiblingDomainPrefixedFiles+} from '#lint/rules/structure.ts'+import {+ noBroadUnknownTypeAssertions,+ noDuplicateTypeShapes,+ noLocalJsonObjectAliases,+ noImportTypeAnnotations+} from '#lint/rules/typescript.ts'++const plugin = {+ meta: { name: 'open-pencil' },+ rules: {+ 'no-inline-named-types': noInlineNamedTypes,+ 'no-import-type-annotations': noImportTypeAnnotations,+ 'no-structuredclone-scene-arrays': noStructuredCloneSceneArrays,+ 'no-vue-style-blocks': noVueStyleBlocks,+ 'no-native-title-attributes-in-vue': noNativeTitleAttributesInVue,+ 'no-hardcoded-tip-labels-in-vue': noHardcodedTipLabelsInVue,+ 'no-raw-svg-in-app-vue-templates': noRawSvgInAppVueTemplates,+ 'no-ui-helper-calls-in-vue-templates': noUiHelperCallsInVueTemplates,+ 'no-large-property-section-components': noLargePropertySectionComponents,+ 'no-raw-test-id-string-props': noRawTestIdStringProps,+ 'no-dynamic-data-test-id-in-vue': noDynamicDataTestIdInVue,+ 'no-test-id-helper-bind-in-vue': noTestIdHelperBindInVue,+ 'no-invalid-test-id-attributes': noInvalidTestIdAttributes,+ 'no-raw-test-id-selectors-in-tests': noRawTestIdSelectorsInTests,+ 'no-generated-test-id-literals': noGeneratedTestIdLiterals,+ 'no-browser-side-effects-in-vue': noBrowserSideEffectsInVue,+ 'no-document-query-selector-in-vue': noDocumentQuerySelectorInVue,+ 'no-direct-selection-tool-state-mutation': noDirectSelectionToolStateMutation,+ 'no-math-random': noMathRandom,+ 'no-hardcoded-color-constants': noHardcodedColorConstants,+ 'no-hand-rolled-color': noHandRolledColor,+ 'no-raw-console-format': noRawConsoleFormat,+ 'no-silent-catch': noSilentCatch,+ 'no-typeof-window-check': noTypeofWindowCheck,+ 'no-vue-self-package-imports': noVueSelfPackageImports,+ 'no-cross-package-source-imports': noCrossPackageSourceImports,+ 'no-deep-parent-relative-imports': noDeepParentRelativeImports,+ 'no-core-parent-relative-imports': noCoreParentRelativeImports,+ 'no-mcp-parent-relative-imports': noMcpParentRelativeImports,+ 'no-vue-parent-relative-imports': noVueParentRelativeImports,+ 'no-cli-parent-relative-imports': noCliParentRelativeImports,+ 'no-mcp-core-barrel-imports': noMcpCoreBarrelImports,+ 'no-cli-core-barrel-imports': noCliCoreBarrelImports,+ 'no-script-core-barrel-imports': noScriptCoreBarrelImports,+ 'no-core-self-package-imports': noCoreSelfPackageImports,+ 'no-inline-prompt-constants': noInlinePromptConstants,+ 'no-app-vue-core-barrel-imports': noAppVueCoreBarrelImports,+ 'no-app-imports-in-packages': noAppImportsInPackages,+ 'no-core-framework-imports': noCoreFrameworkImports,+ 'no-direct-storage-access': noDirectStorageAccess,+ 'no-broad-double-cast': noBroadDoubleCast,+ 'no-unknown-record-double-cast': noUnknownRecordDoubleCast,+ 'no-broad-unknown-type-assertions': noBroadUnknownTypeAssertions,+ 'no-local-json-object-aliases': noLocalJsonObjectAliases,+ 'no-duplicate-type-shapes': noDuplicateTypeShapes,+ 'no-ts-suppression-comments': noTsSuppressionComments,+ 'no-function-type': noFunctionType,+ 'no-reflect-delete-global-this-outside-tests': noReflectDeleteGlobalThisOutsideTests,+ 'no-core-browser-globals': noCoreBrowserGlobals,+ 'no-direct-open-pencil-window-internals': noDirectOpenPencilWindowInternals,+ 'no-direct-open-pencil-browser-store': noDirectOpenPencilBrowserStore,+ 'no-direct-graph-emitter-subscriptions': noDirectGraphEmitterSubscriptions,+ 'no-on-unmounted-in-composition-roots': noOnUnmountedInCompositionRoots,+ 'no-composable-state-wrappers': noComposableStateWrappers,+ 'prefer-vueuse-intervals': preferVueUseIntervals,+ 'prefer-vueuse-timeouts': preferVueUseTimeouts,+ 'max-composition-root-lines': maxCompositionRootLines,+ 'vue-component-file-pascal-case': vueComponentFilePascalCase,+ 'component-namespace-casing': componentNamespaceCasing,+ 'non-component-source-directories-kebab-case': nonComponentSourceDirectoriesKebabCase,+ 'no-component-root-sibling-folder': noComponentRootSiblingFolder,+ 'no-useless-pass-through-wrappers': noUselessPassThroughWrappers,+ 'no-function-alias-imports': noFunctionAliasImports,+ 'no-mixed-case-acronym-identifiers': noMixedCaseAcronymIdentifiers,+ 'no-flat-kiwi-modules': noFlatKiwiModules,+ 'no-bun-globals-in-cli': noBunGlobalsInCli,+ 'no-top-level-prefixed-test-files': noTopLevelPrefixedTestFiles,+ 'no-conditional-object-spreads': noConditionalObjectSpreads,+ 'no-sibling-domain-prefixed-files': noSiblingDomainPrefixedFiles+ }+}++export default plugindiff --git a/tools/lint/src/rules/imports.ts b/tools/lint/src/rules/imports.tsnew file mode 100644index 000000000..992bb432b--- /dev/null+++ b/tools/lint/src/rules/imports.ts@@ -0,0 +1,229 @@+import { importSource, normalizedFilename } from '#lint/support/context.ts'+import { createImportSourceRule } from '#lint/support/factories.ts'+import type { RuleContext, RuleDefinition } from '#lint/support/types.ts'+import type { TSESTree } from '@typescript-eslint/utils'++function isPackageOrSubpath(source: string, packageName: string): boolean {+ return source === packageName || source.startsWith(`${packageName}/`)+}++const noVueSelfPackageImports = createImportSourceRule({+ description: 'Disallow @open-pencil/vue self-imports inside the Vue SDK — use #vue/* aliases',+ applies: (file) => file.includes('/packages/vue/src/'),+ check: (source) =>+ isPackageOrSubpath(source, '@open-pencil/vue') &&+ `Use #vue/* for internal Vue SDK imports instead of self-package import '${source}'.`+})++const noCrossPackageSourceImports = createImportSourceRule({+ description:+ 'Disallow imports that reach into another workspace package source tree — use package exports or package-local aliases',+ check: (source) =>+ (source.includes('/packages/') ||+ /^(?:\.\.\/){2,}packages\//.test(source) ||+ /^(?:\.\.\/)+(?:core|vue|cli|mcp)\/src\//.test(source)) &&+ `Use workspace package exports or package-local aliases instead of cross-package source import '${source}'.`+})++interface ImportBoundaryRuleOptions {+ description: string+ applies(file: string): boolean+ message: string+ minDepth?: number+}++function createParentRelativeImportRule({+ description,+ applies,+ message,+ minDepth = 1+}: ImportBoundaryRuleOptions): RuleDefinition {+ return {+ meta: {+ docs: { description }+ },+ create(context: RuleContext) {+ const file = normalizedFilename(context)+ if (!applies(file)) return {}++ function reportSource(node: TSESTree.Node, source: string | null) {+ if (!source?.startsWith('../')) return+ const parentPrefix = source.match(/^(?:\.\.\/)+/)?.[0]+ const depth = parentPrefix ? parentPrefix.split('../').length - 1 : 0+ if ((depth ?? 0) < minDepth) return+ if (/^(?:\.\.\/)+package\.json$/.test(source)) return+ context.report({ node, message })+ }++ function reportParentRelative(+ node:+ | TSESTree.ImportDeclaration+ | TSESTree.ExportAllDeclaration+ | TSESTree.ExportNamedDeclaration+ ) {+ reportSource(node, importSource(node))+ }++ return {+ ExportAllDeclaration: reportParentRelative,+ ExportNamedDeclaration: reportParentRelative,+ ImportDeclaration: reportParentRelative,+ ImportExpression(node) {+ reportSource(+ node,+ node.source?.type === 'Literal' && typeof node.source.value === 'string'+ ? node.source.value+ : null+ )+ }+ }+ }+ }+}++const noDeepParentRelativeImports = createParentRelativeImportRule({+ description: 'Disallow deep parent-relative imports — use package/test aliases instead',+ applies: () => true,+ message: 'Use an import alias instead of path drilling with ../.. imports.',+ minDepth: 2+})++const noCoreParentRelativeImports = createParentRelativeImportRule({+ description: 'Disallow parent-relative imports in core internals — use #core/* aliases',+ applies: (file) =>+ file.includes('/packages/core/src/') && !file.includes('/packages/core/src/kiwi/kiwi-schema/'),+ message: 'Use the #core/* package-local alias instead of parent-relative core imports.'+})++const noMcpParentRelativeImports = createParentRelativeImportRule({+ description: 'Disallow parent-relative imports in MCP internals — use #mcp/* aliases',+ applies: (file) => file.includes('/packages/mcp/src/'),+ message: 'Use the #mcp/* package-local alias instead of parent-relative MCP imports.'+})++const noVueParentRelativeImports = createParentRelativeImportRule({+ description: 'Disallow parent-relative imports in Vue SDK internals — use #vue/* aliases',+ applies: (file) => file.includes('/packages/vue/src/'),+ message: 'Use the #vue/* package-local alias instead of parent-relative Vue SDK imports.'+})++const noCliParentRelativeImports = createParentRelativeImportRule({+ description: 'Disallow parent-relative imports in CLI internals — use #cli/* aliases',+ applies: (file) => file.includes('/packages/cli/src/'),+ message: 'Use the #cli/* package-local alias instead of parent-relative CLI imports.'+})++interface ExactCoreBarrelRuleOptions {+ description: string+ applies(file: string): boolean+ message: string+}++function createExactCoreBarrelImportRule({+ description,+ applies,+ message+}: ExactCoreBarrelRuleOptions): RuleDefinition {+ return createImportSourceRule({+ description,+ applies,+ check: (source) => source === '@open-pencil/core' && message+ })+}++const noMcpCoreBarrelImports = createExactCoreBarrelImportRule({+ description: 'Disallow MCP imports from @open-pencil/core root barrel — use domain subpaths',+ applies: (file) => file.includes('/packages/mcp/src/'),+ message:+ 'Use a targeted @open-pencil/core subpath in MCP code instead of the compatibility barrel.'+})++const noCliCoreBarrelImports = createExactCoreBarrelImportRule({+ description: 'Disallow CLI imports from @open-pencil/core root barrel — use domain subpaths',+ applies: (file) => file.includes('/packages/cli/src/'),+ message:+ 'Use a targeted @open-pencil/core subpath in CLI code instead of the compatibility barrel.'+})++const noScriptCoreBarrelImports = createExactCoreBarrelImportRule({+ description: 'Disallow script imports from @open-pencil/core root barrel — use domain subpaths',+ applies: (file) => file.includes('/scripts/'),+ message:+ 'Use a targeted @open-pencil/core subpath or #core/* alias in scripts instead of the compatibility barrel.'+})++const noCoreSelfPackageImports = createImportSourceRule({+ description: 'Disallow @open-pencil/core self-imports inside packages/core/src',+ applies: (file) => file.includes('/packages/core/src/'),+ check: (source) =>+ isPackageOrSubpath(source, '@open-pencil/core') &&+ 'Core internals must import local modules directly instead of importing the @open-pencil/core public package entrypoints.'+})++const noInlinePromptConstants = {+ meta: {+ docs: {+ description: 'Disallow inline prompt/context template literals — use markdown prompt files'+ }+ },+ create(context) {+ return {+ VariableDeclarator(node) {+ if (node.id?.type !== 'Identifier') return+ if (!/(?:PROMPT|CONTEXT)/.test(node.id.name)) return+ if (node.init?.type !== 'TemplateLiteral') return+ context.report({+ node,+ message:+ 'Move prompt/context text to a dedicated markdown file and import it instead of using an inline template literal.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noAppVueCoreBarrelImports = createExactCoreBarrelImportRule({+ description:+ 'Disallow app and Vue SDK imports from @open-pencil/core root barrel — use domain subpaths',+ applies: (file) =>+ (file.includes('/src/') && !file.includes('/packages/')) || file.includes('/packages/vue/src/'),+ message:+ 'Use a targeted @open-pencil/core subpath (editor, scene-graph, constants, io, etc.) instead of the compatibility barrel.'+})++const noAppImportsInPackages = createImportSourceRule({+ description: 'Disallow app-shell imports from workspace packages',+ applies: (file) => file.includes('/packages/'),+ check: (source) =>+ source.startsWith('@/') && `Workspace packages must not import app-shell alias '${source}'.`+})++const frameworkImportPrefixes = ['@vue/', '@tauri-apps/', '@/']++const noCoreFrameworkImports = createImportSourceRule({+ description: 'Keep @open-pencil/core framework-agnostic by disallowing Vue/Tauri/app imports',+ applies: (file) => file.includes('/packages/core/src/'),+ check: (source) =>+ (source === 'vue' ||+ isPackageOrSubpath(source, '@open-pencil/vue') ||+ frameworkImportPrefixes.some((prefix) => source.startsWith(prefix))) &&+ `@open-pencil/core must stay framework-agnostic; do not import '${source}'.`+})++export {+ noVueSelfPackageImports,+ noCrossPackageSourceImports,+ noDeepParentRelativeImports,+ noCoreParentRelativeImports,+ noMcpParentRelativeImports,+ noVueParentRelativeImports,+ noCliParentRelativeImports,+ noMcpCoreBarrelImports,+ noCliCoreBarrelImports,+ noScriptCoreBarrelImports,+ noCoreSelfPackageImports,+ noInlinePromptConstants,+ noAppVueCoreBarrelImports,+ noAppImportsInPackages,+ noCoreFrameworkImports+}diff --git a/tools/lint/src/rules/policy.ts b/tools/lint/src/rules/policy.tsnew file mode 100644index 000000000..3127cf92b--- /dev/null+++ b/tools/lint/src/rules/policy.ts@@ -0,0 +1,134 @@+import { normalizedFilename } from '#lint/support/context.ts'+import { createProgramFilenameRule } from '#lint/support/factories.ts'+import type { RuleDefinition } from '#lint/support/types.ts'+import type { TSESTree } from '@typescript-eslint/utils'++function isObjectKeyIdentifier(node: TSESTree.Identifier): boolean {+ const parent = node.parent+ return (+ (parent?.type === 'Property' || parent?.type === 'TSPropertySignature') &&+ parent.key === node &&+ !parent.computed &&+ (parent.type !== 'Property' || parent.value !== node)+ )+}++function isExternalMemberIdentifier(node: TSESTree.Identifier): boolean {+ const parent = node.parent+ return (+ parent?.type === 'MemberExpression' &&+ parent.property === node &&+ !parent.computed &&+ parent.object.type !== 'ThisExpression'+ )+}++function isIgnoredAcronymIdentifier(+ node: TSESTree.Identifier,+ ignoredImports: ReadonlySet<string>+): boolean {+ if (isObjectKeyIdentifier(node) || isExternalMemberIdentifier(node)) return true+ const parent = node.parent+ if (parent?.type === 'ImportSpecifier' && parent.imported === node) {+ return (+ parent.parent?.source?.type !== 'Literal' || ignoredImports.has(parent.parent.source.value)+ )+ }+ return parent?.type === 'ImportDefaultSpecifier' || parent?.type === 'ImportNamespaceSpecifier'+}++const noMixedCaseAcronymIdentifiers = {+ meta: {+ docs: {+ description: 'Require canonical uppercase casing for acronyms in first-party identifiers'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.includes('/tools/lint/')) return {}+ const canonicalAcronym =+ /(?:Acp|Ai|Api|Cli|Cors|Css|Html|Ime|Json|Jsx|Mcp|Pdf|Png|Rgb|Rpc|Rtl|Svg|Ui|Url|Uri|Xml)/g+ const ignoredImports = new Set([+ '@agentclientprotocol/sdk',+ '@tauri-apps/plugin-clipboard-manager',+ '@tauri-apps/plugin-opener',+ '@vueuse/core',+ 'culori',+ 'reka-ui'+ ])+ const upstreamIdentifiers = new Set([+ 'convertToHsb',+ 'convertToHsl',+ 'convertToRgb',+ 'formatCss',+ 'formatRgb',+ 'McpServer',+ 'ndJsonStream',+ 'openUrl',+ 'useObjectUrl',+ 'useUrlSearchParams',+ 'writeHtml'+ ])++ return {+ Identifier(node) {+ if (upstreamIdentifiers.has(node.name)) return+ const mixedCaseAcronym = [...node.name.matchAll(canonicalAcronym)].find((match) => {+ const end = (match.index ?? 0) + match[0].length+ return end === node.name.length || /[A-Z0-9_$]/.test(node.name[end] ?? '')+ })+ if (!mixedCaseAcronym) return+ if (isIgnoredAcronymIdentifier(node, ignoredImports)) return+ context.report({+ node,+ message: `Use canonical uppercase acronym casing in "${node.name}".`+ })+ }+ }+ }+} satisfies RuleDefinition++const noFlatKiwiModules = createProgramFilenameRule({+ description: 'Disallow flat top-level Kiwi modules — group code under Kiwi subdomains',+ check(file) {+ const marker = '/packages/core/src/kiwi/'+ const start = file.indexOf(marker)+ if (start === -1) return false++ const relativePath = file.slice(start + marker.length)+ if (relativePath.includes('/') || relativePath === 'index.ts') return false++ return 'Move Kiwi modules under binary/, fig/, node-change/, instance-overrides/, or kiwi-schema/ instead of adding flat top-level files.'+ }+})++const noConditionalObjectSpreads = {+ meta: {+ docs: {+ description: 'Require explicit branches instead of complex conditional object spreads'+ }+ },+ create(context) {+ return {+ SpreadElement(node) {+ if (node.parent?.type !== 'ObjectExpression') return+ if (node.argument?.type !== 'ConditionalExpression') return+ const branchSizes = [node.argument.consequent, node.argument.alternate]+ .filter((branch) => branch.type === 'ObjectExpression')+ .map((branch) => branch.properties.length)+ const conditionalSpreadCount = node.parent.properties.filter(+ (property) =>+ property.type === 'SpreadElement' && property.argument.type === 'ConditionalExpression'+ ).length+ if (conditionalSpreadCount < 2 && branchSizes.every((size) => size < 2)) return+ context.report({+ node,+ message:+ 'Extract conditional object construction into an explicit branch or named domain projection.'+ })+ }+ }+ }+} satisfies RuleDefinition++export { noMixedCaseAcronymIdentifiers, noFlatKiwiModules, noConditionalObjectSpreads }diff --git a/tools/lint/src/rules/runtime.ts b/tools/lint/src/rules/runtime.tsnew file mode 100644index 000000000..e347ea29e--- /dev/null+++ b/tools/lint/src/rules/runtime.ts@@ -0,0 +1,409 @@+import { normalizedFilename } from '#lint/support/context.ts'+import type { RuleDefinition } from '#lint/support/types.ts'+import type { TSESTree } from '@typescript-eslint/utils'++function isUnknownTypeAnnotation(typeAnnotation: unknown): boolean {+ return (+ typeAnnotation !== null &&+ typeof typeAnnotation === 'object' &&+ 'type' in typeAnnotation &&+ typeAnnotation.type === 'TSUnknownKeyword'+ )+}++const noDirectStorageAccess = {+ meta: {+ docs: {+ description:+ 'Disallow direct localStorage/sessionStorage access outside dedicated storage modules'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ const allowedFiles = [+ '/src/app/ai/chat/storage.ts',+ '/src/app/cache/index.ts',+ '/src/app/settings/credentials/storage.ts',+ '/src/app/shell/layout-storage.ts',+ '/packages/vue/src/i18n/locale.ts'+ ]+ if (allowedFiles.some((suffix) => file.endsWith(suffix))) return {}++ function reportStorage(node: TSESTree.Identifier, name: string) {+ context.report({+ node,+ message: `Use a dedicated storage module instead of direct ${name} access.`+ })+ }++ return {+ Identifier(node) {+ if (node.name !== 'localStorage' && node.name !== 'sessionStorage') return+ reportStorage(node, node.name)+ }+ }+ }+} satisfies RuleDefinition++function nestedAsType(node: { expression: unknown }): unknown {+ const expression = node.expression+ return expression && typeof expression === 'object' && 'typeAnnotation' in expression+ ? expression.typeAnnotation+ : null+}++const noBroadDoubleCast = {+ meta: {+ docs: {+ description: 'Disallow broad `as unknown as` casts outside vendored code'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.includes('/packages/core/src/kiwi/kiwi-schema/')) return {}++ return {+ TSAsExpression(node) {+ if (isUnknownTypeAnnotation(nestedAsType(node))) {+ context.report({+ node,+ message: 'Avoid `as unknown as ...`; model the value with a precise type or helper.'+ })+ }+ }+ }+ }+} satisfies RuleDefinition++function isRecordStringUnknownType(typeAnnotation: TSESTree.TypeNode): boolean {+ if (typeAnnotation?.type !== 'TSTypeReference') return false+ if (typeAnnotation.typeName?.type !== 'Identifier' || typeAnnotation.typeName.name !== 'Record') {+ return false+ }+ const parameters = typeAnnotation.typeArguments?.params ?? []+ return parameters[0]?.type === 'TSStringKeyword' && parameters[1]?.type === 'TSUnknownKeyword'+}++const noUnknownRecordDoubleCast = {+ meta: {+ docs: {+ description: 'Disallow `as unknown as Record<string, unknown>` broad object casts'+ }+ },+ create(context) {+ return {+ TSAsExpression(node) {+ if (!isUnknownTypeAnnotation(nestedAsType(node))) return+ if (!isRecordStringUnknownType(node.typeAnnotation)) return+ context.report({+ node,+ message:+ 'Avoid `as unknown as Record<string, unknown>`; use a precise type or direct public API.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noFunctionType = {+ meta: {+ docs: {+ description: 'Disallow the broad Function type; use an explicit callable signature'+ }+ },+ create(context) {+ return {+ TSTypeReference(node) {+ if (node.typeName?.type !== 'Identifier' || node.typeName.name !== 'Function') return+ context.report({+ node,+ message: 'Use an explicit function signature instead of the broad Function type.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noReflectDeleteGlobalThisOutsideTests = {+ meta: {+ docs: {+ description: 'Disallow Reflect.deleteProperty(globalThis, ...) outside tests'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.includes('/tests/')) return {}++ return {+ CallExpression(node) {+ if (node.callee?.type !== 'MemberExpression') return+ if (node.callee.object?.type !== 'Identifier' || node.callee.object.name !== 'Reflect')+ return+ if (+ node.callee.property?.type !== 'Identifier' ||+ node.callee.property.name !== 'deleteProperty'+ )+ return+ const firstArg = node.arguments?.[0]+ if (firstArg?.type !== 'Identifier' || firstArg.name !== 'globalThis') return+ context.report({+ node,+ message:+ 'Do not mutate globalThis outside tests; isolate platform state behind a boundary.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noTsSuppressionComments = {+ meta: {+ docs: {+ description: 'Disallow TypeScript suppression comments; fix types instead'+ }+ },+ create(context) {+ return {+ Program() {+ const comments = context.sourceCode.getAllComments?.() ?? []+ for (const comment of comments) {+ if (!/@ts-(?:ignore|expect-error|nocheck|check)\b/.test(comment.value)) continue+ context.report({+ node: comment,+ message:+ 'Do not use TypeScript suppression comments; fix the type or add a typed helper.'+ })+ }+ }+ }+ }+} satisfies RuleDefinition++const noCoreBrowserGlobals = {+ meta: {+ docs: {+ description:+ 'Disallow direct browser globals in core outside explicit platform boundary modules'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.includes('/packages/core/src/')) return {}++ const allowedFiles = [+ '/packages/core/src/constants.ts',+ '/packages/core/src/editor/create.ts',+ '/packages/core/src/canvas/renderer.ts',+ '/packages/core/src/text/fonts.ts',+ '/packages/core/src/profiler/render-profiler.ts',+ '/packages/core/src/figma-api/index.ts'+ ]+ if (allowedFiles.some((suffix) => file.endsWith(suffix))) return {}++ return {+ Identifier(node) {+ if (node.name !== 'window' && node.name !== 'document' && node.name !== 'navigator') return+ context.report({+ node,+ message: `Do not use browser global '${node.name}' in core; route it through a platform boundary.`+ })+ }+ }+ }+} satisfies RuleDefinition++const noDirectGraphEmitterSubscriptions = {+ meta: {+ docs: {+ description: 'Disallow direct graph.emitter.on subscriptions outside SceneGraph helpers'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.endsWith('/packages/core/src/scene-graph/index.ts')) return {}++ return {+ CallExpression(node) {+ const callee = node.callee+ if (callee?.type !== 'MemberExpression') return+ if (callee.property?.type !== 'Identifier' || callee.property.name !== 'on') return+ const object = callee.object+ if (object?.type !== 'MemberExpression') return+ if (object.property?.type !== 'Identifier' || object.property.name !== 'emitter') return+ context.report({+ node,+ message: 'Use SceneGraph.onNodeEvents() instead of subscribing to graph.emitter directly.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noOnUnmountedInCompositionRoots = {+ meta: {+ docs: {+ description: 'Prefer tryOnScopeDispose over onUnmounted in composable roots'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ const applies =+ (file.includes('/src/app/') || file.includes('/packages/vue/src/')) &&+ /\/(?:use|create)\.ts$/.test(file)+ if (!applies) return {}++ return {+ CallExpression(node) {+ if (node.callee?.type !== 'Identifier' || node.callee.name !== 'onUnmounted') return+ context.report({+ node,+ message:+ 'Use tryOnScopeDispose() for composable cleanup so callers outside component setup are handled safely.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noComposableStateWrappers = {+ meta: {+ docs: {+ description: 'Disallow create*ComposableState wrapper factories in app and Vue SDK code'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ const applies = file.includes('/src/app/') || file.includes('/packages/vue/src/')+ if (!applies) return {}++ return {+ FunctionDeclaration(node) {+ if (!node.id?.name || !/^create\w*ComposableState$/.test(node.id.name)) return+ context.report({+ node,+ message:+ 'Avoid wrapper-of-wrapper composable state factories; keep setup local or extract a cohesive domain helper.'+ })+ }+ }+ }+} satisfies RuleDefinition++const preferVueUseIntervals = {+ meta: {+ docs: {+ description: 'Prefer VueUse interval helpers over manual setInterval/clearInterval pairs'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ const applies = file.includes('/src/app/') || file.includes('/packages/vue/src/')+ if (!applies) return {}++ function intervalName(callee: TSESTree.Expression): string | null {+ if (callee?.type === 'Identifier') return callee.name+ if (callee?.type === 'MemberExpression' && callee.property?.type === 'Identifier') {+ return callee.property.name+ }+ return null+ }++ return {+ CallExpression(node) {+ const name = intervalName(node.callee)+ if (name !== 'setInterval' && name !== 'clearInterval') return+ context.report({+ node,+ message: 'Use useIntervalFn() from @vueuse/core instead of manual interval cleanup.'+ })+ }+ }+ }+} satisfies RuleDefinition++const preferVueUseTimeouts = {+ meta: {+ docs: {+ description: 'Prefer VueUse timeout helpers over manual timeout cleanup in composables'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ const applies =+ ((file.includes('/src/app/') || file.includes('/packages/vue/src/')) &&+ /\/(?:use|create)\.ts$/.test(file)) ||+ file.endsWith('/src/app/shell/toast/action.ts')+ if (!applies) return {}++ return {+ CallExpression(node) {+ if (node.callee?.type !== 'Identifier' || node.callee.name !== 'clearTimeout') return+ context.report({+ node,+ message:+ 'Use useTimeoutFn() from @vueuse/core instead of manual timeout cleanup in composables.'+ })+ }+ }+ }+} satisfies RuleDefinition++const maxCompositionRootLines = {+ meta: {+ docs: {+ description:+ 'Keep composition roots small; extract domain helpers before they become cleanup projects'+ },+ schema: [+ {+ type: 'object',+ properties: {+ max: { type: 'number' }+ },+ additionalProperties: false+ }+ ]+ },+ create(context) {+ const file = normalizedFilename(context)+ const applies =+ (file.includes('/src/app/') || file.includes('/packages/vue/src/')) &&+ /\/(?:use|create)\.ts$/.test(file)+ if (!applies) return {}++ const options = context.options[0]+ const max =+ options && typeof options === 'object' && 'max' in options && typeof options.max === 'number'+ ? options.max+ : 260++ return {+ Program(node) {+ const source = context.sourceCode.getText()+ const normalized = source.endsWith('\n') ? source.slice(0, -1) : source+ const lineCount = normalized.split('\n').length+ if (lineCount <= max) return+ context.report({+ node,+ message: `Composition root is ${lineCount} lines; extract helpers before exceeding ${max} lines.`+ })+ }+ }+ }+} satisfies RuleDefinition++export {+ noDirectStorageAccess,+ noBroadDoubleCast,+ noUnknownRecordDoubleCast,+ noFunctionType,+ noReflectDeleteGlobalThisOutsideTests,+ noTsSuppressionComments,+ noCoreBrowserGlobals,+ noDirectGraphEmitterSubscriptions,+ noOnUnmountedInCompositionRoots,+ noComposableStateWrappers,+ preferVueUseIntervals,+ preferVueUseTimeouts,+ maxCompositionRootLines+}diff --git a/tools/lint/src/rules/structure.ts b/tools/lint/src/rules/structure.tsnew file mode 100644index 000000000..fda807ff9--- /dev/null+++ b/tools/lint/src/rules/structure.ts@@ -0,0 +1,375 @@+import { existsSync } from 'node:fs'++import { normalizedFilename, staticPropertyName } from '#lint/support/context.ts'+import { createProgramFilenameRule } from '#lint/support/factories.ts'+import type { RuleDefinition } from '#lint/support/types.ts'+import type { TSESTree } from '@typescript-eslint/utils'++function isPascalCaseName(name: string): boolean {+ return /^[A-Z][A-Za-z0-9]*$/.test(name)+}++function isKebabOrLowercaseName(name: string): boolean {+ return /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(name)+}++const vueComponentFilePascalCase = {+ meta: {+ docs: {+ description: 'Require Vue component files to use PascalCase names'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue')) return {}++ return {+ Program(node) {+ const basename =+ file+ .split('/')+ .at(-1)+ ?.replace(/\.vue$/, '') ?? ''+ if (isPascalCaseName(basename)) return+ context.report({+ node,+ message: 'Vue component files must use PascalCase names.'+ })+ }+ }+ }+} satisfies RuleDefinition++const componentNamespaceCasing = {+ meta: {+ docs: {+ description: 'Require component namespace folders to use the project casing convention'+ }+ },+ create(context) {+ const file = normalizedFilename(context)++ return {+ Program(node) {+ const primitiveMatch = file.match(/\/packages\/vue\/src\/primitives\/([^/]+)/)+ if (primitiveMatch && !isPascalCaseName(primitiveMatch[1])) {+ context.report({+ node,+ message: `Vue primitive namespace folder '${primitiveMatch[1]}' must use PascalCase.`+ })+ return+ }++ const componentMatch = file.match(/\/src\/components\/(.+)$/)+ if (!componentMatch) return++ const parts = componentMatch[1].split('/')+ const first = parts[0]+ const second = parts[1]++ if (parts.length > 1 && !isPascalCaseName(first) && !isKebabOrLowercaseName(first)) {+ context.report({+ node,+ message: `Component namespace folder '${first}' must use PascalCase or kebab-case.`+ })+ return+ }++ if (+ parts.length > 2 &&+ (first === 'chat' || first === 'properties') &&+ second !== undefined &&+ !isPascalCaseName(second) &&+ !isKebabOrLowercaseName(second)+ ) {+ context.report({+ node,+ message: `Nested component namespace folder '${first}/${second}' must use PascalCase or kebab-case.`+ })+ }+ }+ }+ }+} satisfies RuleDefinition++const nonComponentSourceDirectoriesKebabCase = {+ meta: {+ docs: {+ description: 'Require non-component source directories to use lowercase or kebab-case names'+ }+ },+ create(context) {+ const file = normalizedFilename(context)++ const roots = [+ '/src/app/',+ '/packages/core/src/',+ '/packages/cli/src/',+ '/packages/mcp/src/',+ '/packages/vue/src/canvas/',+ '/packages/vue/src/controls/',+ '/packages/vue/src/document/',+ '/packages/vue/src/editor/',+ '/packages/vue/src/i18n/',+ '/packages/vue/src/internal/',+ '/packages/vue/src/shared/',+ '/packages/vue/src/variables/'+ ]++ const root = roots+ .filter((candidate) => file.includes(candidate))+ .sort((left, right) => right.length - left.length)[0]+ if (!root) return {}++ return {+ Program(node) {+ const relativePath = file.slice(file.indexOf(root) + root.length)+ const directories = relativePath.split('/').slice(0, -1)+ const invalid = directories.find((part) => !isKebabOrLowercaseName(part))+ if (!invalid) return+ context.report({+ node,+ message: `Non-component source directory '${invalid}' must use lowercase or kebab-case.`+ })+ }+ }+ }+} satisfies RuleDefinition++const noComponentRootSiblingFolder = {+ meta: {+ docs: {+ description: 'Disallow multi-file component roots beside their namespace folder'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ const match = file.match(/\/src\/components\/(?:chat\/|properties\/)?([A-Z][A-Za-z0-9]*)\.vue$/)+ if (!match) return {}++ return {+ Program(node) {+ const dir = file.replace(/\.vue$/, '')+ if (!existsSync(dir)) return+ context.report({+ node,+ message: `Move '${match[1]}.vue' inside its '${match[1]}/' component namespace folder.`+ })+ }+ }+ }+} satisfies RuleDefinition++const noUselessPassThroughWrappers = {+ meta: {+ docs: {+ description:+ 'Disallow functions that only return another function call with the same arguments'+ }+ },+ create(context) {+ function paramNames(params: readonly TSESTree.Parameter[]): string[] | null {+ const names: string[] = []+ for (const param of params ?? []) {+ if (param.type !== 'Identifier') return null+ names.push(param.name)+ }+ return names+ }++ function returnedCall(+ body: TSESTree.BlockStatement | TSESTree.Expression+ ): TSESTree.CallExpression | null {+ if (!body) return null+ if (body.type === 'CallExpression') return body+ if (body.type !== 'BlockStatement') return null+ const statements = body.body?.filter((statement) => statement.type !== 'EmptyStatement') ?? []+ if (statements.length !== 1) return null+ const statement = statements[0]+ if (statement.type !== 'ReturnStatement') return null+ return statement.argument?.type === 'CallExpression' ? statement.argument : null+ }++ function calleeName(callee: TSESTree.CallExpression['callee']): string | null {+ return callee?.type === 'Identifier' ? callee.name : null+ }++ function isSameArgumentForwarding(+ args: readonly TSESTree.CallExpressionArgument[],+ params: readonly string[]+ ): boolean {+ if (args?.length !== params.length) return false+ return args.every((arg, index) => arg.type === 'Identifier' && arg.name === params[index])+ }++ function check(+ node: TSESTree.Node,+ name: string,+ params: readonly TSESTree.Parameter[],+ body: TSESTree.BlockStatement | TSESTree.Expression+ ) {+ const names = paramNames(params)+ if (!names) return+ const call = returnedCall(body)+ if (!call || !isSameArgumentForwarding(call.arguments, names)) return+ const target = calleeName(call.callee)+ if (!target || target === name) return+ context.report({+ node,+ message: `Remove pass-through wrapper '${name}'. Call '${target}' directly or give the wrapper real domain logic.`+ })+ }++ return {+ FunctionDeclaration(node) {+ if (!node.id?.name) return+ check(node, node.id.name, node.params, node.body)+ },+ VariableDeclarator(node) {+ if (node.id?.type !== 'Identifier') return+ const init = node.init+ if (+ !init ||+ (init.type !== 'ArrowFunctionExpression' && init.type !== 'FunctionExpression')+ )+ return+ check(node, node.id.name, init.params, init.body)+ }+ }+ }+} satisfies RuleDefinition++const noFunctionAliasImports = {+ meta: {+ docs: {+ description: 'Disallow import aliases ending in Fn for facade delegation'+ }+ },+ create(context) {+ return {+ ImportSpecifier(node) {+ if (!node.imported || !node.local) return+ if (node.imported.type !== 'Identifier' || node.local.type !== 'Identifier') return+ if (node.imported.name === node.local.name) return+ if (!node.local.name.endsWith('Fn')) return+ context.report({+ node,+ message:+ 'Avoid aliasing imports as *Fn. Use a namespace import or give the exported helper a clearer domain name.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noDirectOpenPencilBrowserStore = {+ meta: {+ docs: {+ description: 'Disallow direct window.openPencil.store access'+ }+ },+ create(context) {+ function isOpenPencilMember(node: TSESTree.Expression): boolean {+ return (+ node?.type === 'MemberExpression' &&+ staticPropertyName(node.property) === 'openPencil' &&+ ((node.object?.type === 'Identifier' && node.object.name === 'window') ||+ (node.object?.type === 'Identifier' && node.object.name === 'globalThis'))+ )+ }++ return {+ MemberExpression(node) {+ if (staticPropertyName(node.property) !== 'store') return+ if (!isOpenPencilMember(node.object)) return+ context.report({+ node,+ message:+ 'Use window.openPencil.getStore() instead of accessing window.openPencil.store directly.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noDirectOpenPencilWindowInternals = {+ meta: {+ docs: {+ description: 'Disallow direct access to private OpenPencil window internals'+ }+ },+ create(context) {+ return {+ MemberExpression(node) {+ const name = staticPropertyName(node.property)+ if (!name?.startsWith('__OPEN_PENCIL')) return+ context.report({+ node,+ message:+ 'Do not access window.__OPEN_PENCIL* directly. Use src/app/browser-bridge.ts or tests/helpers/store.ts instead.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noBunGlobalsInCli = {+ meta: { docs: { description: 'Disallow Bun globals in Node-compatible CLI source' } },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.includes('/packages/cli/src/')) return {}+ return {+ MemberExpression(node) {+ if (node.object?.type !== 'Identifier' || node.object.name !== 'Bun') return+ context.report({+ node,+ message: 'Use Node-compatible APIs in CLI source instead of Bun globals.'+ })+ }+ }+ }+} satisfies RuleDefinition+const noTopLevelPrefixedTestFiles = createProgramFilenameRule({+ description: 'Disallow top-level test files that encode domains as filename prefixes',+ check(file) {+ const match = file.match(/\/tests\/(engine|e2e)\/([^/]+-[^/]+\.(?:test|spec)\.ts)$/)+ if (!match) return false+ return `Move '${match[2]}' under a domain folder instead of encoding the domain as a filename prefix.`+ }+})++const noSiblingDomainPrefixedFiles = createProgramFilenameRule({+ description: 'Disallow files that repeat an existing sibling domain folder in the filename',+ check(file) {+ const match = file.match(/^(.*\/)([^/]+?)(?:\.test|\.spec)?\.(?:ts|tsx|vue)$/)+ if (!match) return false++ const [, dir, name] = match+ const parts = name.split('-')+ if (parts.length < 2) return false++ const prefix = parts[0]+ const suffix = parts.at(-1)+ let domain: string | null = null+ if (existsSync(`${dir}${prefix}`)) domain = prefix+ else if (suffix && existsSync(`${dir}${suffix}`)) domain = suffix+ if (!domain) return false++ const filename = file.slice(dir.length)+ return `Move '${filename}' under the existing '${domain}/' folder instead of repeating the domain in the filename.`+ }+})++export {+ vueComponentFilePascalCase,+ componentNamespaceCasing,+ nonComponentSourceDirectoriesKebabCase,+ noComponentRootSiblingFolder,+ noUselessPassThroughWrappers,+ noFunctionAliasImports,+ noDirectOpenPencilBrowserStore,+ noDirectOpenPencilWindowInternals,+ noBunGlobalsInCli,+ noTopLevelPrefixedTestFiles,+ noSiblingDomainPrefixedFiles+}diff --git a/tools/lint/src/rules/typescript.ts b/tools/lint/src/rules/typescript.tsnew file mode 100644index 000000000..27d208207--- /dev/null+++ b/tools/lint/src/rules/typescript.ts@@ -0,0 +1,252 @@+import type { RuleDefinition } from '#lint/support/types.ts'+import type { TSESTree } from '@typescript-eslint/utils'++type TypeNode = TSESTree.TypeNode++function typeParameterNodes(node: TSESTree.TSTypeReference): TypeNode[] {+ return node.typeArguments?.params ?? []+}++function isRecordStringUnknownType(node: TypeNode | null | undefined): boolean {+ if (node?.type !== 'TSTypeReference') return false+ if (node.typeName?.type !== 'Identifier' || node.typeName.name !== 'Record') return false+ const params = typeParameterNodes(node)+ return params[0]?.type === 'TSStringKeyword' && params[1]?.type === 'TSUnknownKeyword'+}++function hasASTChild(+ node: unknown,+ predicate: (node: TypeNode) => boolean,+ seen = new WeakSet<object>()+): boolean {+ if (!node || typeof node !== 'object') return false+ if (seen.has(node)) return false+ seen.add(node)+ if (predicate(node as TypeNode)) return true++ for (const [key, value] of Object.entries(node)) {+ if (key === 'parent' || key === 'range' || key === 'loc') continue+ if (Array.isArray(value)) {+ if (value.some((child) => hasASTChild(child, predicate, seen))) return true+ } else if (value && typeof value === 'object' && hasASTChild(value, predicate, seen)) {+ return true+ }+ }+ return false+}++function containsRecordStringUnknownType(node: TypeNode | null | undefined): boolean {+ if (isRecordStringUnknownType(node)) return true+ if (node?.type === 'TSArrayType') return isRecordStringUnknownType(node.elementType)+ if (node?.type === 'TSUnionType')+ return node.types?.some(containsRecordStringUnknownType) ?? false+ return false+}++function isUnknownArrayType(node: TypeNode | null | undefined): boolean {+ return node?.type === 'TSArrayType' && node.elementType?.type === 'TSUnknownKeyword'+}++function hasInlineUnknownArrayProperty(node: TypeNode): boolean {+ if (node?.type !== 'TSTypeLiteral') return false+ return (node.members ?? []).some((member) => {+ if (member.type !== 'TSPropertySignature') return false+ const typeNode = member.typeAnnotation?.typeAnnotation+ return isUnknownArrayType(typeNode)+ })+}++function containsInlineUnknownObjectType(node: TypeNode): boolean {+ return hasASTChild(node, hasInlineUnknownArrayProperty)+}++const noBroadUnknownTypeAssertions = {+ meta: {+ docs: {+ description:+ 'Disallow broad unknown object type assertions. Add a named domain type or a type guard instead.'+ }+ },+ create(context) {+ function check(node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion) {+ if (containsRecordStringUnknownType(node.typeAnnotation)) {+ context.report({+ node,+ message:+ 'Do not cast to Record<string, unknown>. Add a named domain type or a type guard.'+ })+ return+ }+ if (containsInlineUnknownObjectType(node.typeAnnotation)) {+ context.report({+ node,+ message: 'Do not cast to an inline unknown object shape. Add a named domain type.'+ })+ }+ }++ return {+ TSAsExpression: check,+ TSTypeAssertion: check+ }+ }+} satisfies RuleDefinition++function typeNameText(node: TSESTree.EntityName | null | undefined): string {+ if (!node) return 'unknown'+ if (node.type === 'Identifier') return node.name+ if (node.type === 'TSQualifiedName')+ return `${typeNameText(node.left)}.${typeNameText(node.right)}`+ return node.type+}++function parameterType(parameter: TSESTree.Parameter): string {+ const value = parameter.type === 'TSParameterProperty' ? parameter.parameter : parameter+ return canonicalType('typeAnnotation' in value ? value.typeAnnotation?.typeAnnotation : null)+}++function canonicalType(node: TypeNode | null | undefined): string {+ if (!node) return 'unknown'+ switch (node.type) {+ case 'TSStringKeyword':+ return 'string'+ case 'TSNumberKeyword':+ return 'number'+ case 'TSBooleanKeyword':+ return 'boolean'+ case 'TSUnknownKeyword':+ return 'unknown'+ case 'TSNullKeyword':+ return 'null'+ case 'TSUndefinedKeyword':+ return 'undefined'+ case 'TSLiteralType':+ return `literal:${'value' in node.literal ? node.literal.value : node.literal.type}`+ case 'TSArrayType':+ return `array<${canonicalType(node.elementType)}>`+ case 'TSTypeReference': {+ const params = typeParameterNodes(node).map(canonicalType).join(',')+ return `ref:${typeNameText(node.typeName)}<${params}>`+ }+ case 'TSUnionType':+ return `union<${node.types.map(canonicalType).sort().join('|')}>`+ case 'TSTypeLiteral':+ return `object{${canonicalMembers(node.members)}}`+ case 'TSFunctionType': {+ const parameters = node.params.map(parameterType).join(',')+ return `function<${parameters}=>${canonicalType(node.returnType?.typeAnnotation)}>`+ }+ default:+ return node.type+ }+}++function propertyKeyName(key: TSESTree.PropertyName): string | null {+ if (key?.type === 'Identifier') return key.name+ if (key?.type === 'Literal') return String(key.value)+ return null+}++function canonicalMember(member: TSESTree.TypeElement): string | null {+ if (member.type === 'TSIndexSignature') {+ const parameter = member.parameters?.[0]+ const param = parameter?.type === 'TSParameterProperty' ? parameter.parameter : parameter+ const keyType = param && 'typeAnnotation' in param ? param.typeAnnotation?.typeAnnotation : null+ return `index:${canonicalType(keyType)}:${canonicalType(member.typeAnnotation?.typeAnnotation)}`+ }+ if (member.type !== 'TSPropertySignature') return null+ const name = propertyKeyName(member.key)+ if (!name) return null+ const optional = member.optional ? '?' : ''+ return `prop:${name}${optional}:${canonicalType(member.typeAnnotation?.typeAnnotation)}`+}++function canonicalMembers(members: readonly TSESTree.TypeElement[] | undefined): string {+ return (members ?? []).map(canonicalMember).filter(Boolean).sort().join(';')+}++function namedTypeShape(+ node: TSESTree.TSInterfaceDeclaration | TSESTree.TSTypeAliasDeclaration+): string | null {+ if (node.type === 'TSInterfaceDeclaration') return canonicalMembers(node.body?.body)+ if (node.type === 'TSTypeAliasDeclaration' && node.typeAnnotation?.type === 'TSTypeLiteral') {+ return canonicalMembers(node.typeAnnotation.members)+ }+ return null+}++const noDuplicateTypeShapes = {+ meta: {+ docs: {+ description: 'Disallow duplicate local object type/interface shapes in one file'+ }+ },+ create(context) {+ const seen = new Map()+ return {+ 'TSInterfaceDeclaration, TSTypeAliasDeclaration'(node) {+ const shape = namedTypeShape(node)+ if (!shape) return+ const memberCount = shape ? shape.split(';').filter(Boolean).length : 0+ if (memberCount < 2) return+ const first = seen.get(shape)+ if (!first) {+ seen.set(shape, node)+ return+ }+ context.report({+ node,+ message:+ 'Duplicate object type shape. Reuse the existing named type instead of redeclaring the same members.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noLocalJsonObjectAliases = {+ meta: {+ docs: {+ description: 'Disallow local JsonObject aliases — import the shared type instead'+ }+ },+ create(context) {+ return {+ TSTypeAliasDeclaration(node) {+ if (node.id?.name !== 'JsonObject') return+ if (!isRecordStringUnknownType(node.typeAnnotation)) return+ context.report({+ node,+ message:+ 'Import JsonObject from @open-pencil/scene-graph/primitives instead of declaring a local alias.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noImportTypeAnnotations = {+ meta: {+ docs: {+ description: 'Disallow inline import() type annotations — use top-level import type instead'+ }+ },+ create(context) {+ return {+ TSImportType(node) {+ context.report({+ node,+ message:+ 'Use a top-level import type instead of an inline import() type annotation. Dynamic imports are only for runtime lazy loading.'+ })+ }+ }+ }+} satisfies RuleDefinition++export {+ noBroadUnknownTypeAssertions,+ noDuplicateTypeShapes,+ noLocalJsonObjectAliases,+ noImportTypeAnnotations+}diff --git a/tools/lint/src/rules/vue/browser.ts b/tools/lint/src/rules/vue/browser.tsnew file mode 100644index 000000000..c3973b5da--- /dev/null+++ b/tools/lint/src/rules/vue/browser.ts@@ -0,0 +1,102 @@+import { normalizedFilename, staticPropertyName } from '#lint/support/context.ts'+import type { RuleDefinition } from '#lint/support/types.ts'+import type { TSESTree } from '@typescript-eslint/utils'++const noBrowserSideEffectsInVue = {+ meta: {+ docs: {+ description:+ 'Disallow direct browser side effects in Vue components — use VueUse, refs, or app services'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue')) return {}++ function objectName(object: TSESTree.Expression): string | null {+ return object?.type === 'Identifier' ? object.name : null+ }++ return {+ CallExpression(node) {+ const callee = node.callee+ if (callee?.type !== 'MemberExpression') return+ const object = objectName(callee.object)+ const property = staticPropertyName(callee.property)++ if (+ (object === 'window' || object === 'document') &&+ (property === 'addEventListener' || property === 'removeEventListener')+ ) {+ context.report({+ node,+ message:+ 'Use VueUse useEventListener() instead of direct browser event listeners in Vue components.'+ })+ return+ }++ if (object === 'document' && property === 'createElement') {+ context.report({+ node,+ message:+ 'Do not create DOM elements directly in Vue components. Use template refs, components, or an app service.'+ })+ }+ },+ MemberExpression(node) {+ const directStorage = objectName(node.object)+ let globalStorage: string | null = null+ if (+ node.object.type === 'MemberExpression' &&+ (objectName(node.object.object) === 'window' ||+ objectName(node.object.object) === 'globalThis')+ ) {+ globalStorage = staticPropertyName(node.object.property)+ }+ const storage = directStorage ?? globalStorage+ if (storage !== 'localStorage' && storage !== 'sessionStorage') return+ context.report({+ node,+ message:+ 'Do not access localStorage/sessionStorage directly in Vue components. Use VueUse storage helpers or an app service.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noDocumentQuerySelectorInVue = {+ meta: {+ docs: {+ description:+ 'Disallow document.querySelector in Vue components — use template refs or composables'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue')) return {}++ return {+ CallExpression(node) {+ const callee = node.callee+ if (callee?.type !== 'MemberExpression') return+ if (callee.object?.type !== 'Identifier' || callee.object.name !== 'document') return+ if (callee.property?.type !== 'Identifier') return+ if (+ callee.property.name !== 'querySelector' &&+ callee.property.name !== 'querySelectorAll'+ ) {+ return+ }+ context.report({+ node,+ message:+ 'Do not query the document from Vue components. Use template refs, component APIs, or a composable.'+ })+ }+ }+ }+} satisfies RuleDefinition++export { noBrowserSideEffectsInVue, noDocumentQuerySelectorInVue }diff --git a/tools/lint/src/rules/vue/index.ts b/tools/lint/src/rules/vue/index.tsnew file mode 100644index 000000000..7d065905a--- /dev/null+++ b/tools/lint/src/rules/vue/index.ts@@ -0,0 +1,17 @@+export { noBrowserSideEffectsInVue, noDocumentQuerySelectorInVue } from './browser.ts'+export { noLargePropertySectionComponents } from './size.ts'+export {+ noDynamicDataTestIdInVue,+ noGeneratedTestIdLiterals,+ noInvalidTestIdAttributes,+ noRawTestIdSelectorsInTests,+ noRawTestIdStringProps,+ noTestIdHelperBindInVue+} from './test-ids.ts'+export {+ noHardcodedTipLabelsInVue,+ noNativeTitleAttributesInVue,+ noRawSvgInAppVueTemplates,+ noUiHelperCallsInVueTemplates,+ noVueStyleBlocks+} from './template.ts'diff --git a/tools/lint/src/rules/vue/size.ts b/tools/lint/src/rules/vue/size.tsnew file mode 100644index 000000000..d83a6844c--- /dev/null+++ b/tools/lint/src/rules/vue/size.ts@@ -0,0 +1,34 @@+import { normalizedFilename } from '#lint/support/context.ts'+import type { RuleDefinition } from '#lint/support/types.ts'+import { sourceLineCount } from '#lint/support/vue.ts'++const PROPERTY_SECTION_LINE_ALLOWLIST = new Set([+ '/src/components/properties/LayoutSection/SizeControls.vue'+])++const noLargePropertySectionComponents = {+ meta: {+ docs: {+ description: 'Disallow oversized property-section Vue components'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue') || !file.includes('/src/components/properties/')) return {}+ if ([...PROPERTY_SECTION_LINE_ALLOWLIST].some((suffix) => file.endsWith(suffix))) return {}++ return {+ Program(node) {+ const lineCount = sourceLineCount(context.sourceCode.getText())+ if (lineCount <= 250) return+ context.report({+ node,+ message:+ 'Split property-section components over 250 lines into focused controls or document an explicit allowlist.'+ })+ }+ }+ }+} satisfies RuleDefinition++export { noLargePropertySectionComponents }diff --git a/tools/lint/src/rules/vue/template.ts b/tools/lint/src/rules/vue/template.tsnew file mode 100644index 000000000..85f14dc7e--- /dev/null+++ b/tools/lint/src/rules/vue/template.ts@@ -0,0 +1,175 @@+import { normalizedFilename } from '#lint/support/context.ts'+import type { RuleDefinition } from '#lint/support/types.ts'+import {+ VUE_ELEMENT_NODE,+ hasUIHelperCall,+ isBoundStringLiteral,+ isStaticVueAttribute,+ isVueBindDirective,+ isVueSourceFile,+ vueSfcDescriptor,+ vueTemplateAst,+ walkVueTemplateAst+} from '#lint/support/vue.ts'+import { ElementTypes } from '@vue/compiler-core'++const noVueStyleBlocks = {+ meta: {+ docs: {+ description: 'Disallow Vue component <style> blocks — use Tailwind utilities or global tokens'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!isVueSourceFile(file)) return {}++ return {+ Program(node) {+ const descriptor = vueSfcDescriptor(context.sourceCode.getText(), file)+ if (descriptor.styles.length === 0) return+ context.report({+ node,+ message:+ 'Vue components must not use <style> blocks. Use Tailwind utilities or global app.css tokens.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noNativeTitleAttributesInVue = {+ meta: {+ docs: {+ description: 'Disallow native title attributes in Vue components — use Tip/Reka tooltip'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!isVueSourceFile(file)) return {}++ return {+ Program(node) {+ const template = vueTemplateAst(context.sourceCode.getText(), file)+ if (!template) return+ let hasTitleAttribute = false+ walkVueTemplateAst(template, (templateNode) => {+ if (hasTitleAttribute) return+ if (+ templateNode.type === VUE_ELEMENT_NODE &&+ templateNode.tagType === ElementTypes.ELEMENT &&+ templateNode.props.some(+ (prop) => isStaticVueAttribute(prop, 'title') || isVueBindDirective(prop, 'title')+ )+ ) {+ hasTitleAttribute = true+ }+ })+ if (!hasTitleAttribute) return+ context.report({+ node,+ message: 'Use the shared tooltip UI instead of native title attributes.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noHardcodedTipLabelsInVue = {+ meta: {+ docs: {+ description: 'Disallow hardcoded Tip labels — use localized i18n messages'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!isVueSourceFile(file)) return {}++ return {+ Program(node) {+ const template = vueTemplateAst(context.sourceCode.getText(), file)+ if (!template) return+ let hasHardcodedTipLabel = false+ walkVueTemplateAst(template, (templateNode) => {+ if (hasHardcodedTipLabel) return+ if (templateNode.type !== VUE_ELEMENT_NODE || templateNode.tag !== 'Tip') return+ hasHardcodedTipLabel = templateNode.props?.some(+ (prop) => isStaticVueAttribute(prop, 'label') || isBoundStringLiteral(prop, 'label')+ )+ })+ if (!hasHardcodedTipLabel) return+ context.report({+ node,+ message: 'Use a localized binding for Tip labels, not a hardcoded string.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noRawSvgInAppVueTemplates = {+ meta: {+ docs: {+ description: 'Disallow raw SVG in app Vue templates — use Iconify/unplugin icons'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!isVueSourceFile(file)) return {}++ return {+ Program(node) {+ const template = vueTemplateAst(context.sourceCode.getText(), file)+ if (!template) return+ let hasRawSvg = false+ walkVueTemplateAst(template, (templateNode) => {+ if (templateNode.type === VUE_ELEMENT_NODE && templateNode.tag === 'svg') {+ hasRawSvg = true+ }+ })+ if (!hasRawSvg) return+ context.report({+ node,+ message: 'Use Iconify/unplugin icon components instead of raw <svg> in app templates.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noUiHelperCallsInVueTemplates = {+ meta: {+ docs: {+ description: 'Disallow use*UI() helper calls inside Vue templates'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue') || !file.includes('/src/components/')) return {}++ return {+ Program(node) {+ const template = vueTemplateAst(context.sourceCode.getText(), file)+ if (!template) return+ let hasTemplateUiHelperCall = false+ walkVueTemplateAst(template, (templateNode) => {+ if (!hasTemplateUiHelperCall && hasUIHelperCall(templateNode)) {+ hasTemplateUiHelperCall = true+ }+ })+ if (!hasTemplateUiHelperCall) return+ context.report({+ node,+ message: 'Hoist use*UI() calls out of templates or hide them inside shared UI components.'+ })+ }+ }+ }+} satisfies RuleDefinition++export {+ noHardcodedTipLabelsInVue,+ noNativeTitleAttributesInVue,+ noRawSvgInAppVueTemplates,+ noUiHelperCallsInVueTemplates,+ noVueStyleBlocks+}diff --git a/tools/lint/src/rules/vue/test-ids.ts b/tools/lint/src/rules/vue/test-ids.tsnew file mode 100644index 000000000..f57d457e5--- /dev/null+++ b/tools/lint/src/rules/vue/test-ids.ts@@ -0,0 +1,259 @@+import { normalizedFilename } from '#lint/support/context.ts'+import type { RuleDefinition } from '#lint/support/types.ts'+import type { VueTemplateNode } from '#lint/support/vue.ts'+import {+ VUE_DIRECTIVE_NODE,+ hasExpressionCall,+ isStaticVueAttribute,+ isVueBindDirective,+ vueTemplateAst,+ walkVueTemplateAst+} from '#lint/support/vue.ts'+import type { TSESTree } from '@typescript-eslint/utils'++const TEST_ID_FORMAT = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/++const noRawTestIdStringProps = {+ meta: {+ docs: {+ description:+ 'Disallow test-id component props — use data-test-id attrs or internal semantic ids'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue')) return {}++ function isTestIdKey(key: TSESTree.PropertyName): boolean {+ if (key?.type !== 'Identifier') return false+ return key.name === 'testId' || key.name.endsWith('TestId')+ }++ return {+ TSPropertySignature(node) {+ if (!isTestIdKey(node.key)) return+ context.report({+ node,+ message:+ 'Do not expose test-id component props. Let callers pass data-test-id attrs or derive internal ids from semantic component state.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noDynamicDataTestIdInVue = {+ meta: {+ docs: {+ description: 'Disallow dynamic :data-test-id in Vue components — use v-test-id'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue')) return {}++ return {+ Program(node) {+ const template = vueTemplateAst(context.sourceCode.getText(), file)+ if (!template) return+ let hasDynamicDataTestId = false+ walkVueTemplateAst(template, (templateNode) => {+ if (hasDynamicDataTestId) return+ if (isVueBindDirective(templateNode, 'data-test-id')) hasDynamicDataTestId = true+ })+ if (!hasDynamicDataTestId) return+ context.report({+ node,+ message: 'Use v-test-id for dynamic/configurable test ids instead of :data-test-id.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noTestIdHelperBindInVue = {+ meta: {+ docs: {+ description: 'Prefer v-test-id over v-bind="testId(...)" in Vue templates'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue')) return {}++ return {+ Program(node) {+ const template = vueTemplateAst(context.sourceCode.getText(), file)+ if (!template) return+ let hasTestIdHelperBind = false+ walkVueTemplateAst(template, (templateNode) => {+ if (hasTestIdHelperBind) return+ if (templateNode.type !== VUE_DIRECTIVE_NODE || templateNode.name !== 'bind') return+ if (templateNode.arg) return+ hasTestIdHelperBind = hasExpressionCall(+ templateNode.exp,+ (name) => name === 'testId' || name === 'testIdAttr'+ )+ })+ if (!hasTestIdHelperBind) return+ context.report({+ node,+ message: 'Use v-test-id instead of v-bind="testId(...)" in Vue templates.'+ })+ }+ }+ }+} satisfies RuleDefinition++const noInvalidTestIdAttributes = {+ meta: {+ docs: {+ description: 'Enforce data-test-id spelling and kebab-case static test ids in Vue components'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.endsWith('.vue')) return {}++ return {+ Program(node) {+ const template = vueTemplateAst(context.sourceCode.getText(), file)+ if (!template) return+ let invalidId: string | null = null+ let hasInvalidSpelling = false+ walkVueTemplateAst(template, (templateNode) => {+ if (hasInvalidSpelling || invalidId !== null) return+ if (+ isStaticVueAttribute(templateNode, 'data-testid') ||+ isVueBindDirective(templateNode, 'data-testid') ||+ isStaticVueAttribute(templateNode, 'test-id') ||+ isVueBindDirective(templateNode, 'test-id')+ ) {+ hasInvalidSpelling = true+ return+ }+ const id = staticVueAttributeValue(templateNode, 'data-test-id')+ if (id === null) return+ if (!TEST_ID_FORMAT.test(id)) invalidId = id+ })+ if (hasInvalidSpelling) {+ context.report({+ node,+ message: 'Use data-test-id attrs instead of data-testid or test-id component props.'+ })+ return+ }+ if (invalidId === null) return+ context.report({+ node,+ message: `Static data-test-id values must be kebab-case. Invalid id: "${invalidId}".`+ })+ }+ }+ }+} satisfies RuleDefinition++const noRawTestIdSelectorsInTests = {+ meta: {+ docs: {+ description: 'Disallow raw data-test-id CSS selectors in Playwright tests — use getByTestId()'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (!file.includes('/tests/')) return {}++ return {+ CallExpression(node) {+ const callee = node.callee+ if (callee?.type !== 'MemberExpression') return+ if (callee.property?.type !== 'Identifier' || callee.property.name !== 'locator') return+ const firstArg = node.arguments?.[0]+ if (!firstArg) return++ const isRawTestIdSelector =+ (firstArg.type === 'Literal' &&+ typeof firstArg.value === 'string' &&+ firstArg.value.includes('[data-test-id')) ||+ (firstArg.type === 'TemplateLiteral' &&+ firstArg.quasis?.some((part) => part.value.raw.includes('[data-test-id')))++ if (!isRawTestIdSelector) return+ context.report({+ node,+ message: 'Use getByTestId() instead of raw [data-test-id] CSS selectors in tests.'+ })+ }+ }+ }+} satisfies RuleDefinition++function staticVueAttributeValue(node: VueTemplateNode, name: string): string | null {+ if (!isStaticVueAttribute(node, name)) return null+ return node.value?.content ?? ''+}++function isGeneratedTestIdLiteral(value: unknown): boolean {+ if (typeof value !== 'string') return false+ const toolbarValue = value.startsWith('mobile-toolbar-') ? value.slice('mobile-'.length) : value+ return (+ toolbarValue.startsWith('toolbar-tool-') ||+ toolbarValue.startsWith('toolbar-flyout-') ||+ toolbarValue.startsWith('toolbar-flyout-item-') ||+ value === 'variables-add-float' ||+ value === 'variables-add-string' ||+ value === 'variables-add-boolean' ||+ value.startsWith('acp-permission-option-')+ )+}++const noGeneratedTestIdLiterals = {+ meta: {+ docs: {+ description: 'Disallow hand-written generated test-id literals — use shared helper functions'+ }+ },+ create(context) {+ const file = normalizedFilename(context)+ if (file.endsWith('/packages/vue/src/testing/test-id.ts')) return {}+ if (file.endsWith('/tests/helpers/test-ids.ts')) return {}+ if (!file.includes('/src/') && !file.includes('/tests/')) return {}++ function report(node: TSESTree.Node) {+ context.report({+ node,+ message:+ 'Use shared generated test-id helpers instead of hand-written toolbar/variable/permission id literals.'+ })+ }++ return {+ Program(node) {+ if (!file.endsWith('.vue')) return+ const template = vueTemplateAst(context.sourceCode.getText(), file)+ if (!template) return+ let hasGeneratedTemplateId = false+ walkVueTemplateAst(template, (templateNode) => {+ if (hasGeneratedTemplateId || !isStaticVueAttribute(templateNode, 'data-test-id')) return+ hasGeneratedTemplateId = isGeneratedTestIdLiteral(templateNode.value?.content)+ })+ if (hasGeneratedTemplateId) report(node)+ },+ Literal(node) {+ if (isGeneratedTestIdLiteral(node.value)) report(node)+ },+ TemplateElement(node) {+ if (isGeneratedTestIdLiteral(node.value?.raw)) report(node)+ }+ }+ }+} satisfies RuleDefinition++export {+ noDynamicDataTestIdInVue,+ noGeneratedTestIdLiterals,+ noInvalidTestIdAttributes,+ noRawTestIdSelectorsInTests,+ noRawTestIdStringProps,+ noTestIdHelperBindInVue+}diff --git a/tools/lint/src/support/context.ts b/tools/lint/src/support/context.tsnew file mode 100644index 000000000..240323375--- /dev/null+++ b/tools/lint/src/support/context.ts@@ -0,0 +1,31 @@+import type { TSESTree } from '@typescript-eslint/utils'++export function normalizedPath(path: string): string {+ return path.replaceAll('\\', '/')+}++export interface FilenameContext {+ filename?: string+ physicalFilename?: string+ getFilename?: () => string+}++export function normalizedFilename(context: FilenameContext): string {+ return normalizedPath(+ context.physicalFilename ?? context.filename ?? context.getFilename?.() ?? ''+ )+}++export function staticPropertyName(+ property: TSESTree.Expression | TSESTree.PrivateIdentifier+): string | null {+ if (property.type === 'Identifier') return property.name+ if (property.type === 'Literal' && typeof property.value === 'string') return property.value+ return null+}++export function importSource(+ node: TSESTree.ImportDeclaration | TSESTree.ExportAllDeclaration | TSESTree.ExportNamedDeclaration+): string | null {+ return typeof node.source?.value === 'string' ? node.source.value : null+}diff --git a/tools/lint/src/support/factories.ts b/tools/lint/src/support/factories.tsnew file mode 100644index 000000000..1b40516f3--- /dev/null+++ b/tools/lint/src/support/factories.ts@@ -0,0 +1,61 @@+import { importSource, normalizedFilename } from '#lint/support/context.ts'+import type { RuleDefinition, RuleListener } from '#lint/support/types.ts'+import type { TSESTree } from '@typescript-eslint/utils'++interface ProgramFilenameRuleOptions {+ description: string+ check(file: string): string | false+}++interface ImportSourceRuleOptions {+ description: string+ applies?: (file: string) => boolean+ includeExports?: boolean+ check(source: string, file: string): string | false+}++type ImportSourceNode =+ | TSESTree.ImportDeclaration+ | TSESTree.ExportAllDeclaration+ | TSESTree.ExportNamedDeclaration++export function createProgramFilenameRule({+ description,+ check+}: ProgramFilenameRuleOptions): RuleDefinition {+ return {+ meta: { type: 'suggestion', docs: { description }, schema: [] },+ create(context) {+ const message = check(normalizedFilename(context))+ if (!message) return {}+ return { Program: (node) => context.report({ node, message }) }+ }+ }+}++export function createImportSourceRule({+ description,+ applies = () => true,+ includeExports = false,+ check+}: ImportSourceRuleOptions): RuleDefinition {+ return {+ meta: { type: 'problem', docs: { description }, schema: [] },+ create(context) {+ const file = normalizedFilename(context)+ if (!applies(file)) return {}+ const inspect = (node: ImportSourceNode) => {+ const source = importSource(node)+ if (!source) return+ const message = check(source, file)+ if (message) context.report({ node, message })+ }+ const visitors: RuleListener = { ImportDeclaration: inspect }+ if (includeExports) {+ visitors.ExportNamedDeclaration = inspect+ visitors.ExportAllDeclaration = inspect+ }+ return visitors+ }+ }+}diff --git a/tools/lint/src/support/types.ts b/tools/lint/src/support/types.tsnew file mode 100644index 000000000..bba6258ac--- /dev/null+++ b/tools/lint/src/support/types.ts@@ -0,0 +1,22 @@+import type { TSESLint, TSESTree } from '@typescript-eslint/utils'++export interface RuleContext {+ filename?: string+ physicalFilename?: string+ options: readonly unknown[]+ sourceCode: TSESLint.SourceCode+ getFilename?: () => string+ report(descriptor: { node: TSESTree.Node | TSESTree.Comment; message: string }): void+}++export type RuleListener = TSESLint.RuleListener++export interface RuleDefinition {+ meta: {+ docs: { description: string }+ schema?: readonly unknown[]+ type?: 'problem' | 'suggestion' | 'layout'+ [key: string]: unknown+ }+ create(context: RuleContext): RuleListener+}diff --git a/tools/lint/src/support/vue.ts b/tools/lint/src/support/vue.tsnew file mode 100644index 000000000..77d779e2e--- /dev/null+++ b/tools/lint/src/support/vue.ts@@ -0,0 +1,160 @@+import type {+ AttributeNode,+ DirectiveNode,+ RootNode,+ SimpleExpressionNode,+ TemplateChildNode+} from '@vue/compiler-core'+import { parse as parseVueSfc } from 'vue/compiler-sfc'++export type VueTemplateNode =+ | RootNode+ | TemplateChildNode+ | AttributeNode+ | DirectiveNode+ | SimpleExpressionNode++function vueSfcDescriptor(source: string, filename: string) {+ return parseVueSfc(source, { filename }).descriptor+}++function vueTemplateAst(source: string, filename: string): RootNode | null {+ return vueSfcDescriptor(source, filename).template?.ast ?? null+}++function isVueSourceFile(file: string): boolean {+ return (+ file.endsWith('.vue') &&+ (file.startsWith('src/') ||+ file.includes('/src/') ||+ file.startsWith('packages/vue/src/') ||+ file.includes('/packages/vue/src/'))+ )+}++function sourceLineCount(source: string): number {+ const normalized = source.endsWith('\n') ? source.slice(0, -1) : source+ return normalized.split('\n').length+}++const VUE_ELEMENT_NODE = 1+const VUE_SIMPLE_EXPRESSION_NODE = 4+const VUE_INTERPOLATION_NODE = 5+const VUE_ATTRIBUTE_NODE = 6+const VUE_DIRECTIVE_NODE = 7++function walkVueTemplateAst(node: VueTemplateNode, visitor: (node: VueTemplateNode) => void): void {+ visitor(node)+ if ('props' in node) {+ for (const prop of node.props ?? []) walkVueTemplateAst(prop, visitor)+ }+ if ('children' in node) {+ for (const child of node.children ?? []) {+ if (typeof child !== 'string' && typeof child !== 'symbol') {+ walkVueTemplateAst(child, visitor)+ }+ }+ }+ if (node.type === VUE_INTERPOLATION_NODE && node.content) {+ walkVueTemplateAst(node.content, visitor)+ }+ if (node.type === VUE_DIRECTIVE_NODE) {+ if (node.arg && typeof node.arg !== 'string' && typeof node.arg !== 'symbol') {+ walkVueTemplateAst(node.arg, visitor)+ }+ if (node.exp) walkVueTemplateAst(node.exp, visitor)+ }+}++interface ExpressionAstNode {+ type?: string+ callee?: ExpressionAstNode+ name?: string+ loc?: unknown+ [key: string]: unknown+}++function walkExpressionAst(+ node: ExpressionAstNode | null | undefined,+ visitor: (node: ExpressionAstNode) => void+): void {+ if (!node || typeof node !== 'object') return+ visitor(node)+ for (const value of Object.values(node)) {+ if (!value || value === node.loc) continue+ if (Array.isArray(value)) {+ for (const item of value) walkExpressionAst(item as ExpressionAstNode, visitor)+ continue+ }+ if (typeof value === 'object') walkExpressionAst(value as ExpressionAstNode, visitor)+ }+}++function isUIHelperName(name: string): boolean {+ const prefix = 'use'+ const suffix = 'UI'+ if (!name.startsWith(prefix) || !name.endsWith(suffix)) return false+ const firstDomainChar = name.at(prefix.length)+ return firstDomainChar !== undefined && firstDomainChar === firstDomainChar.toUpperCase()+}++function hasExpressionCall(+ expression: VueTemplateNode | null | undefined,+ predicate: (name: string) => boolean+): boolean {+ if (expression?.type !== VUE_SIMPLE_EXPRESSION_NODE || !expression.ast) return false+ let found = false+ walkExpressionAst(expression.ast as ExpressionAstNode, (node) => {+ if (found || node.type !== 'CallExpression') return+ if (node.callee?.type === 'Identifier' && node.callee.name && predicate(node.callee.name)) {+ found = true+ }+ })+ return found+}++function hasUIHelperCall(expression: VueTemplateNode): boolean {+ return hasExpressionCall(expression, isUIHelperName)+}++function isStaticVueAttribute(node: VueTemplateNode, name: string): node is AttributeNode {+ return node.type === VUE_ATTRIBUTE_NODE && node.name === name+}++function isVueBindDirective(node: VueTemplateNode, name: string): node is DirectiveNode {+ return (+ node.type === VUE_DIRECTIVE_NODE &&+ node.name === 'bind' &&+ node.arg?.type === VUE_SIMPLE_EXPRESSION_NODE &&+ node.arg.content === name+ )+}++function isBoundStringLiteral(node: VueTemplateNode, name: string): boolean {+ if (!isVueBindDirective(node, name)) return false+ const expression = node.exp+ if (expression?.type !== VUE_SIMPLE_EXPRESSION_NODE) return false+ const ast = expression.ast as ExpressionAstNode | undefined+ if (!ast) return false+ if (ast.type === 'StringLiteral' || (ast.type === 'Literal' && typeof ast.value === 'string')) {+ return true+ }+ return (+ ast.type === 'TemplateLiteral' && Array.isArray(ast.expressions) && ast.expressions.length === 0+ )+}++export {+ VUE_DIRECTIVE_NODE,+ VUE_ELEMENT_NODE,+ hasExpressionCall,+ hasUIHelperCall,+ isBoundStringLiteral,+ isStaticVueAttribute,+ isVueBindDirective,+ isVueSourceFile,+ sourceLineCount,+ vueSfcDescriptor,+ vueTemplateAst,+ walkVueTemplateAst+}diff --git a/tools/lint/tests/plugin.test.ts b/tools/lint/tests/plugin.test.tsnew file mode 100644index 000000000..d32a2d9c3--- /dev/null+++ b/tools/lint/tests/plugin.test.ts@@ -0,0 +1,202 @@+import { afterEach, describe, expect, test } from 'bun:test'+import { mkdir, mkdtemp, rm, writeFile } from 'node:fs/promises'+import { tmpdir } from 'node:os'+import { dirname, join, resolve } from 'node:path'++import lintPlugin from '#lint/plugin.ts'+import { normalizedFilename } from '#lint/support/context.ts'++interface Diagnostic {+ code: string+ filename: string+ message: string+}++interface LintResult {+ diagnostics: Diagnostic[]+}++const temporaryDirectories: string[] = []+const pluginPath = resolve(import.meta.dir, '../../../lint/plugin.js')+const oxlintPath = resolve(import.meta.dir, '../../../node_modules/.bin/oxlint')++async function lint(+ source: string,+ rules: Record<string, string>,+ relativePath = 'fixture.ts'+): Promise<Diagnostic[]> {+ const directory = await mkdtemp(join(tmpdir(), 'open-pencil-lint-'))+ temporaryDirectories.push(directory)+ const sourcePath = join(directory, relativePath)+ const configPath = join(directory, 'oxlint.json')+ await mkdir(dirname(sourcePath), { recursive: true })+ await writeFile(sourcePath, source)+ await writeFile(+ configPath,+ JSON.stringify({+ plugins: ['typescript', 'vue'],+ jsPlugins: [pluginPath],+ rules+ })+ )++ const process = Bun.spawn([oxlintPath, '-c', configPath, '--format', 'json', sourcePath], {+ stdout: 'pipe',+ stderr: 'pipe'+ })+ const [output, errorOutput] = await Promise.all([+ new Response(process.stdout).text(),+ new Response(process.stderr).text()+ ])+ const exitCode = await process.exited+ try {+ return (JSON.parse(output) as LintResult).diagnostics+ } catch {+ throw new Error(`oxlint exited ${exitCode} without JSON output.\nstderr: ${errorOutput}`)+ }+}++async function runRule(ruleName: string, source: string, filename: string): Promise<number> {+ const plugin = lintPlugin+ let reports = 0+ const visitors = plugin.rules[ruleName].create({+ filename,+ physicalFilename: filename,+ options: [],+ report: () => {+ reports += 1+ },+ sourceCode: {+ getText: () => source+ }+ })+ visitors.Program?.({ type: 'Program' })+ return reports+}++function ruleDiagnostics(diagnostics: Diagnostic[], rule: string): Diagnostic[] {+ return diagnostics.filter((diagnostic) => diagnostic.code === `open-pencil(${rule})`)+}++afterEach(async () => {+ await Promise.all(+ temporaryDirectories.splice(0).map((directory) => rm(directory, { recursive: true }))+ )+})++describe('no-conditional-object-spreads', () => {+ const rule = 'no-conditional-object-spreads'+ const rules = { [`open-pencil/${rule}`]: 'error' }++ test('accepts a simple one-property projection', async () => {+ const diagnostics = await lint(+ 'export const result = { ...(enabled ? { value: 1 } : {}) }',+ rules+ )+ expect(ruleDiagnostics(diagnostics, rule)).toHaveLength(0)+ })++ test('reports a multi-property conditional projection', async () => {+ const diagnostics = await lint(+ 'export const result = { ...(enabled ? { value: 1, label: "yes" } : {}) }',+ rules+ )+ expect(ruleDiagnostics(diagnostics, rule)).toHaveLength(1)+ })++ test('reports multiple conditional projections in one object', async () => {+ const diagnostics = await lint(+ 'export const result = { ...(first ? { a: 1 } : {}), ...(second ? { b: 2 } : {}) }',+ rules+ )+ expect(ruleDiagnostics(diagnostics, rule)).toHaveLength(2)+ })+})++describe('AST-backed rules', () => {+ test('recognizes Record<string, unknown> from the TypeScript AST', async () => {+ const rule = 'no-unknown-record-double-cast'+ const diagnostics = await lint(+ 'export const result = value as unknown as Record< string, unknown >',+ { [`open-pencil/${rule}`]: 'error' }+ )+ expect(ruleDiagnostics(diagnostics, rule)).toHaveLength(1)+ })++ test('keeps distinct callback signatures out of duplicate type diagnostics', async () => {+ const rule = 'no-duplicate-type-shapes'+ const diagnostics = await lint(+ [+ 'interface First { handler: (value: string) => number; enabled: boolean }',+ 'interface Second { handler: (value: number) => number; enabled: boolean }'+ ].join('\n'),+ { [`open-pencil/${rule}`]: 'error' }+ )+ expect(ruleDiagnostics(diagnostics, rule)).toHaveLength(0)+ })++ test('recognizes native title attributes from the Vue template AST', async () => {+ const rule = 'no-native-title-attributes-in-vue'+ const reports = await runRule(+ rule,+ '<template><button title="Save">Save</button></template>',+ '/repo/src/components/SaveButton.vue'+ )+ expect(reports).toBe(1)+ })++ test('finds raw SVG elements with v-if directives', async () => {+ const reports = await runRule(+ 'no-raw-svg-in-app-vue-templates',+ '<template><svg v-if="shown" /></template>',+ '/repo/src/components/ConditionalIcon.vue'+ )+ expect(reports).toBe(1)+ })++ test('does not treat a Vue component title prop as a native title attribute', async () => {+ const reports = await runRule(+ 'no-native-title-attributes-in-vue',+ '<template><Dialog title="Settings" /></template>',+ '/repo/src/components/SettingsDialog.vue'+ )+ expect(reports).toBe(0)+ })++ test('reports a hardcoded Vue tooltip label', async () => {+ const reports = await runRule(+ 'no-hardcoded-tip-labels-in-vue',+ '<template><Tip label="Save" /></template>',+ '/repo/src/components/SaveButton.vue'+ )+ expect(reports).toBe(1)+ })++ test('accepts a localized Vue tooltip binding', async () => {+ const rule = 'no-hardcoded-tip-labels-in-vue'+ const reports = await runRule(+ rule,+ '<template><Tip :label="messages.save" /></template>',+ '/repo/src/components/SaveButton.vue'+ )+ expect(reports).toBe(0)+ })+})++describe('path support', () => {+ test('prefers and normalizes the physical filename', () => {+ const context = {+ filename: 'virtual.ts',+ physicalFilename: String.raw`C:\repo\src\physical.ts`+ }+ expect(normalizedFilename(context)).toBe('C:/repo/src/physical.ts')+ })+})++describe('plugin entrypoint', () => {+ test('loads all custom rules through the compatibility entrypoint', async () => {+ const module = (await import(pluginPath)) as { default: typeof lintPlugin }+ expect(Object.keys(module.default.rules)).toContain('no-conditional-object-spreads')+ expect(Object.keys(module.default.rules).length).toBeGreaterThan(60)+ })+})diff --git a/tools/lint/tsconfig.json b/tools/lint/tsconfig.jsonnew file mode 100644index 000000000..ff0223de9--- /dev/null+++ b/tools/lint/tsconfig.json@@ -0,0 +1,11 @@+{+ "extends": "../../tsconfig.json",+ "compilerOptions": {+ "types": ["node"],+ "noEmit": true,+ "paths": {+ "#lint/*": ["./src/*"]+ }+ },+ "include": ["src/**/*.ts"]+}