openpencil/oxlint.json

139 lines
4.5 KiB
JSON

{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "import", "unicorn", "vue"],
"jsPlugins": ["./lint/plugin.js"],
"env": {
"browser": true,
"es2024": true
},
"rules": {
"no-unused-vars": "warn",
"no-console": "off",
"no-restricted-imports": ["error", {
"paths": [
{ "name": "@/types", "message": "Import types directly from @open-pencil/core." }
],
"patterns": [{
"group": ["@/engine/*"],
"message": "Import from @open-pencil/core unless the module adds platform-specific logic.",
"allowImportNames": ["loadFont", "listFamilies", "preloadFonts"]
}]
}],
"no-empty-function": "error",
"max-lines": ["warn", { "max": 600 }],
"complexity": ["error", { "max": 20 }],
"typescript/no-explicit-any": "warn",
"typescript/no-non-null-assertion": "warn",
"typescript/no-floating-promises": "error",
"typescript/no-misused-promises": "error",
"typescript/consistent-type-imports": "error",
"typescript/consistent-return": "error",
"typescript/no-unnecessary-condition": "error",
"typescript/no-unnecessary-type-assertion": "error",
"typescript/no-unnecessary-type-parameters": "error",
"typescript/no-unnecessary-boolean-literal-compare": "error",
"typescript/no-unnecessary-template-expression": "error",
"typescript/no-unnecessary-type-arguments": "error",
"typescript/prefer-optional-chain": "error",
"typescript/prefer-for-of": "error",
"import/no-cycle": "error",
"import/no-self-import": "error",
"import/no-duplicates": "error",
"import/no-mutable-exports": "error",
"unicorn/no-instanceof-array": "error",
"unicorn/no-typeof-undefined": "error",
"unicorn/no-nested-ternary": "error",
"unicorn/no-useless-fallback-in-spread": "error",
"unicorn/no-length-as-slice-end": "error",
"unicorn/no-unnecessary-await": "error",
"unicorn/prefer-string-starts-ends-with": "error",
"unicorn/consistent-existence-index-check": "error",
"vue/no-arrow-functions-in-watch": "error",
"vue/no-deprecated-destroyed-lifecycle": "error",
"vue/no-export-in-script-setup": "error",
"vue/no-lifecycle-after-await": "error",
"vue/no-import-compiler-macros": "error",
"vue/prefer-import-from-vue": "error",
"vue/valid-define-emits": "error",
"vue/valid-define-props": "error",
"vue/no-required-prop-with-default": "error",
"vue/no-multiple-slot-args": "error",
"vue/define-emits-declaration": "error",
"vue/define-props-destructuring": "error",
"vue/require-typed-ref": "error",
"open-pencil/no-inline-named-types": ["error", {
"Vector": "x:number,y:number",
"Color": "a:number,b:number,g:number,r:number",
"GUID": "localID:number,sessionID:number",
"Rect": "height:number,width:number,x:number,y:number",
"Matrix": "m00:number,m01:number,m02:number,m10:number,m11:number,m12:number"
}],
"open-pencil/no-structuredclone-scene-arrays": "error",
"open-pencil/no-math-random": "error",
"open-pencil/no-hand-rolled-color": "error",
"open-pencil/no-raw-console-format": "off",
"open-pencil/no-silent-catch": "error"
},
"overrides": [
{
"files": ["**/*.test.ts", "**/*.test.tsx"],
"rules": {
"typescript/no-explicit-any": "off",
"typescript/no-non-null-assertion": "off",
"open-pencil/no-silent-catch": "off"
}
},
{
"files": ["**/tools/ai-adapter.ts"],
"rules": {
"typescript/no-explicit-any": "off"
}
},
{
"files": ["**/render/render-jsx.ts"],
"rules": {
"typescript/no-implied-eval": "off"
}
},
{
"files": ["**/kiwi/kiwi-schema/**"],
"rules": {
"typescript/no-explicit-any": "off",
"typescript/no-non-null-assertion": "off",
"typescript/no-implied-eval": "off",
"typescript/prefer-for-of": "off",
"typescript/prefer-optional-chain": "off",
"typescript/consistent-type-imports": "off",
"typescript/no-unnecessary-condition": "off",
"import/no-mutable-exports": "off",
"complexity": "off"
}
},
{
"files": [
"src/stores/editor.ts",
"src/composables/use-canvas-input.ts",
"src/demo.ts"
],
"rules": {
"max-lines": "off"
}
},
{
"files": ["packages/cli/src/commands/**"],
"rules": {
"open-pencil/no-raw-console-format": "error"
}
}
],
"ignorePatterns": ["node_modules", "dist", "desktop", "*.config.*"]
}