{ "$schema": "./node_modules/oxlint/configuration_schema.json", "plugins": ["typescript", "react", "react-hooks", "react-perf", "unicorn"], "categories": { "correctness": "error" }, "rules": { "no-fallthrough": "error", "eslint/no-useless-call": "error", "oxc/no-accumulating-spread": "error", "react/jsx-no-duplicate-props": "error", "react/jsx-no-undef": "error", "react/no-children-prop": "error", "react/no-danger-with-children": "error", "react/no-direct-mutation-state": "error", "react/no-find-dom-node": "error", "react/no-render-return-value": "error", "react/no-string-refs": "error", "react/no-unescaped-entities": "error", "react/require-render-return": "error", "react/error-boundaries": "error", "react/globals": "error", "react/immutability": "off", "react/incompatible-library": "off", "react/preserve-manual-memoization": "off", "react/purity": "error", "react/refs": "off", "react/set-state-in-effect": "off", "react/set-state-in-render": "error", "react/static-components": "error", "react/use-memo": "error", "react/void-use-memo": "error", "react/no-deriving-state-in-effects": "error", "react/jsx-curly-brace-presence": [ "error", { "props": "never", "children": "never", "propElementValues": "always" } ], "react/jsx-filename-extension": ["error", { "extensions": [".tsx", ".jsx"] }], "react/jsx-fragments": "error", "react/jsx-key": "error", "react/jsx-no-constructed-context-values": "error", "react/jsx-no-target-blank": "error", "react/jsx-no-useless-fragment": ["error", { "allowExpressions": true }], "react/jsx-pascal-case": "error", "react/no-object-type-as-default-prop": "error", "react/no-unstable-nested-components": ["warn", { "allowAsProps": true }], "react/self-closing-comp": "error", "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "warn", "typescript/array-type": "error", "typescript/consistent-generic-constructors": "error", "typescript/consistent-indexed-object-style": "error", "typescript/consistent-type-assertions": "error", "typescript/consistent-type-definitions": ["error", "type"], "typescript/consistent-type-imports": "error", "typescript/no-explicit-any": ["error", { "ignoreRestArgs": true }], "typescript/no-confusing-non-null-assertion": "error", "typescript/no-import-type-side-effects": "error", "typescript/no-unnecessary-boolean-literal-compare": "error", "typescript/no-unnecessary-template-expression": "error", "typescript/no-unsafe-function-type": "warn", "typescript/prefer-function-type": "error", "typescript/prefer-includes": "error", "typescript/prefer-optional-chain": "error", "typescript/prefer-ts-expect-error": "error", "typescript/switch-exhaustiveness-check": [ "error", { "allowDefaultCaseForExhaustiveSwitch": false } ], "curly": "error", "no-unneeded-ternary": "error", "no-else-return": "error", "prefer-exponentiation-operator": "error", "prefer-object-has-own": "error", "no-restricted-imports": [ "error", { "paths": [ { "name": "@linear/sdk", "allowTypeImports": true, "message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/linear-sdk.ts." } ] } ], "no-useless-return": "error", "prefer-template": "error", "unicorn/consistent-empty-array-spread": "error", "unicorn/consistent-existence-index-check": "error", "unicorn/empty-brace-spaces": "error", "unicorn/error-message": "error", "unicorn/no-array-fill-with-reference-type": "warn", "unicorn/no-array-reverse": "error", "unicorn/no-instanceof-builtins": "error", "unicorn/no-typeof-undefined": "error", "unicorn/no-unnecessary-array-splice-count": "error", "unicorn/no-useless-promise-resolve-reject": "error", "unicorn/no-zero-fractions": "error", "unicorn/prefer-array-find": "error", "unicorn/prefer-array-flat-map": "warn", "unicorn/prefer-array-index-of": "error", "unicorn/prefer-at": "error", "unicorn/prefer-date-now": "error", "unicorn/prefer-includes": "error", "unicorn/prefer-import-meta-properties": "error", "unicorn/prefer-math-min-max": "error", "unicorn/prefer-negative-index": "error", "unicorn/prefer-node-protocol": "error", "unicorn/prefer-number-properties": "error", "unicorn/prefer-object-from-entries": "error", "unicorn/prefer-regexp-test": "warn", "unicorn/prefer-ternary": "error", "unicorn/throw-new-error": "error" }, "overrides": [ { "files": ["**/*.{js,cjs,mjs,jsx,ts,tsx,mts,cts}"], "excludeFiles": [ "**/*.{test,spec}.{js,cjs,mjs,jsx,ts,tsx,mts,cts}", "**/__tests__/**", "src/renderer/src/runtime/web-runtime-browser-creation-placement-test-rig.ts" ], "rules": { "no-restricted-imports": [ "error", { "paths": [ { "name": "@linear/sdk", "allowTypeImports": true, "message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/linear-sdk.ts." }, { "name": "ssh2", "allowTypeImports": true, "message": "Value-importing ssh2 hoists it into the eager main-process require block and blocks startup (#35731). Use `import type` plus loadSsh2() from src/main/ssh/ssh2-module-load.ts." } ], "patterns": [ { "regex": "(?i)(?:^|[/\\\\])(?:web-session-tabs-sync-test-harness|web-runtime-browser-creation-placement-test-rig)(?:\\.[cm]?[jt]sx?)?(?:[?#].*)?$", "message": "This module is unit-test support. Import the production web-session owner instead." }, { "regex": "\\.fixture(?:\\.tsx?)?(?:[?#].*)?$", "message": "Component fixtures are dev-only and load through the fixture explorer's import.meta.glob; importing one would ship it in a production bundle." } ] } ] } }, { "files": ["src/renderer/src/**/*.{ts,tsx}"], "rules": { "no-restricted-properties": [ "error", { "property": "randomUUID", "message": "crypto.randomUUID is missing in non-secure contexts (Remote Web over plain HTTP), which white-screens the app. Use createBrowserUuid() from '@/lib/browser-uuid'." } ] } }, { "files": ["src/shared/**/*.ts"], "rules": { "no-restricted-properties": [ "error", { "property": "randomUUID", "message": "src/shared is compiled into the web bundle, where crypto.randomUUID is missing in non-secure contexts (Remote Web over plain HTTP). Use createNonSecureContextUuid() from './non-secure-context-uuid', or import randomUUID from 'node:crypto' in main-only code." } ] } }, { "files": ["**/*.test.*", "**/*.spec.*", "**/*-benchmark.*"], "rules": { "react/globals": "off" } }, { "files": ["**/*.ts", "**/*.mts", "**/*.cts"], "rules": { "max-lines": ["error", { "max": 300, "skipBlankLines": true, "skipComments": true }] } }, { "files": ["**/*.tsx"], "rules": { "max-lines": ["error", { "max": 400, "skipBlankLines": true, "skipComments": true }] } }, { "files": ["**/*.mjs"], "rules": { "max-lines": ["error", { "max": 600, "skipBlankLines": true, "skipComments": true }] } }, { "files": [ "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx", "**/*.test.mts", "**/*.test.cts", "**/*.spec.mts", "**/*.spec.cts" ], "rules": { "max-lines": ["error", { "max": 800, "skipBlankLines": true, "skipComments": true }] } }, { "files": [ "src/main/runtime/rpc/dispatcher.ts", "src/main/plugins/plugin-runtime-rpc.ts", "src/main/plugins/plugin-runtime-binding.ts" ], "rules": { "no-restricted-imports": [ "error", { "paths": [ { "name": "@linear/sdk", "allowTypeImports": true, "message": "Value-importing @linear/sdk hoists its ~2.6MB CJS bundle into the eager top-level require block and defeats the lazy loader. Use `import type` plus loadLinearSdk() from src/main/linear/linear-sdk.ts." }, { "name": "ssh2", "allowTypeImports": true, "message": "Value-importing ssh2 hoists it into the eager main-process require block and blocks startup (#35731). Use `import type` plus loadSsh2() from src/main/ssh/ssh2-module-load.ts." } ], "patterns": [ { "group": ["**/rpc-method-registry"], "allowTypeImports": true, "message": "The registry imports every RPC method (~3.4k modules); take the method list as a parameter so importers stay light." } ] } ] } } ], "ignorePatterns": [ "src/main/acp/generated/acp-protocol.generated.ts", "src/shared/rpc-contract/rpc-params-catalog.generated.ts", "src/cli/bundled-skill-guides.ts", "resources/plugins/declarative/*.mjs", "**/node_modules", "**/dist", "**/out", "cloud/**", ".github/actions/cloud-sql-rollout-lease/**", "tests/e2e/.cross-version-checkouts" ] }