import { HOST_BOUNDARY_DOCUMENTS } from "./shared/configs/taxonomy.config.ts"; import { defineGovlabConfig } from "@govlab/quality/config"; import { relativePath } from "@ssot/paths"; import { LOCAL_SEVERITIES, LOCAL_STYLELINT_SEVERITIES } from "./shared/generated/rule-index.generated.ts"; const TOOL_RUNNERS = [ `${relativePath("govlab.docs")}/core/adapters/vcs.adapter.ts`, `${relativePath("govlab.quality")}/core/adapters/dependency.adapter.ts`, `${relativePath("govlab.quality")}/core/lifecycle/invocation.lifecycle.ts`, `${relativePath("govlab.stats")}/core/adapters/vcs.adapter.ts`, `${relativePath("app.deploy")}/core/probes/vcs.probe.ts`, ]; export default defineGovlabConfig({ docs: { boundaryDocs: [...HOST_BOUNDARY_DOCUMENTS], harness: { adapter: "adapter-project-binding.md", agentDir: "agents/", profiles: [ { keys: ["name", "description"], prefix: "agents/", requireFrontmatter: true, requireTitle: false }, { keys: ["name", "description"], prefix: "skills/", requireFrontmatter: true, requireTitle: false }, { keys: ["name", "description"], prefix: "commands/", requireFrontmatter: true, requireTitle: false }, { keys: ["name", "description", "type"], prefix: "adapter-project-binding.md", requireFrontmatter: true, requireTitle: false, }, { keys: [], prefix: "", requireFrontmatter: false, requireTitle: true }, ], root: ".claude/", runtimeRoots: [ `${relativePath("claude")}/cache/`, `${relativePath("govlabHost.reports")}/`, `${relativePath("thirdParty")}/`, "node_modules/.cache/", ], }, hostTokens: [], ignore: [ relativePath("thirdParty"), relativePath("drafts"), relativePath("scratch"), relativePath("methodology"), relativePath("app.public").split("/").at(-1) ?? "", ], members: [ "project", "web", "deploy", "content", "social", "scripts", "testing", "paths", "govlab", "claude", "server", ], }, eslint: { buildScripts: { files: ["**/scripts/**/*.ts"], relax: ["debug-print"] }, env: ["node", "esnext", "browser"], exclusions: [ { eslintFiles: TOOL_RUNNERS, rules: ["sonarjs/no-os-command-from-path"], vitePath: TOOL_RUNNERS.join(",") }, ], globals: {}, ignores: ["**/*.d.ts", "**/*.config.ts"], rules: { "@typescript-eslint/dot-notation": "off", "@typescript-eslint/naming-convention": [ "error", { format: ["camelCase"], leadingUnderscore: "allow", selector: "default", trailingUnderscore: "allow" }, { format: ["camelCase", "PascalCase"], selector: "import" }, { format: ["camelCase", "UPPER_CASE"], leadingUnderscore: "allow", selector: "variable", trailingUnderscore: "allow", }, { format: ["PascalCase"], selector: "typeLike" }, { format: ["camelCase", "snake_case", "UPPER_CASE"], leadingUnderscore: "allow", selector: ["objectLiteralProperty", "typeProperty"], }, { format: null, modifiers: ["requiresQuotes"], selector: ["objectLiteralProperty", "typeProperty"] }, ], "@typescript-eslint/method-signature-style": "off", "@typescript-eslint/no-unnecessary-type-parameters": "off", "@typescript-eslint/prefer-readonly-parameter-types": "off", "@typescript-eslint/require-await": "off", "dot-notation": "off", "govlab/no-concrete-dependency": "off", "govlab/no-bitwise-outside-flags": "off", "govlab/require-central-config": "off", "govlab-deps/no-redundant-type-shim": "error", "govlab-deps/no-undeclared-dependency": "error", "govlab-write/no-raw-file-write": [ "error", { modules: ["text.persistence.ts"], writers: ["writeCanonicalJson", "writeCanonicalText", "writeVerbatim"], }, ], "govlab-local/no-fail-open-guard": "error", "govlab-quality/require-signal-guard": "error", "govlab-test/no-test-without-subject": "error", "jsonc/key-name-casing": "off", "no-bitwise": "off", "@typescript-eslint/class-methods-use-this": "off", "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/max-params": "off", "@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-magic-numbers": "off", "@typescript-eslint/no-use-before-define": "off", complexity: "off", "max-depth": "off", "max-lines": "off", "max-lines-per-function": "off", "max-statements": "off", "no-continue": "off", "no-undefined": "off", "no-use-before-define": "off", "no-void": "off", "sonarjs/arrow-function-convention": ["error", { requireParameterParentheses: true }], "@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }], "@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }], "unused-imports/no-unused-vars": [ "error", { argsIgnorePattern: "^_", ignoreRestSiblings: true, varsIgnorePattern: "^_" }, ], "no-console": ["error", { allow: ["warn", "error"] }], "sonarjs/file-header": "off", "sonarjs/max-union-size": ["error", { threshold: 4 }], "sonarjs/no-duplicate-string": ["error", { threshold: 5 }], "sonarjs/no-implicit-dependencies": "off", "sonarjs/shorthand-property-grouping": "off", "sonarjs/void-use": "off", ...LOCAL_SEVERITIES, "local/no-inline-style-write": ["error", { modules: ["style.registry.ts"] }], "local/no-raw-dom": [ "error", { modules: ["element.factory.ts", "document.adapter.ts", "diagram.adapter.ts"] }, ], "local/require-component": ["error", { factories: ["createElement"] }], }, tests: { files: ["**/*.test.ts", "**/*.fixture.ts"], relax: ["file-length", "long-function", "cyclomatic-complexity", "deep-nesting", "too-many-params"], }, }, htmlhint: { rules: { "alt-require": true, "attr-lowercase": true, "attr-no-duplication": true, "attr-unsafe-chars": true, "attr-value-double-quotes": true, "attr-value-not-empty": true, "doctype-first": true, "doctype-html5": true, "head-script-disabled": true, "href-abs-or-rel": false, "id-class-ad-disabled": true, "id-class-value": false, "id-unique": true, "inline-script-disabled": true, "inline-style-disabled": true, "space-tab-mixed-disabled": "space4", "spec-char-escape": true, "src-not-empty": true, "style-disabled": true, "tag-pair": true, "tag-self-close": false, "tagname-lowercase": true, "title-require": true, }, }, jscpd: { format: ["typescript", "javascript", "css", "html"], ignore: ["**/*.test.ts", "**/_index.generated.ts"], minLines: 5, minTokens: 50, threshold: 0, }, knip: { ignore: ["**/*.test.ts"], ignoreBinaries: ["jiti"], ignoreDependencies: ["stylelint-*", "eslint-*", "@govlab/*", "vitest", "prettier"], paths: { "#host/*": [`./${relativePath("app.member")}/*`] }, }, oxlint: { categories: { correctness: "error", nursery: "error", pedantic: "error", perf: "error", restriction: "error", style: "error", suspicious: "error", }, env: { browser: true, builtin: true, esnext: true, node: true }, ignorePatterns: ["**/*.d.ts", "**/*.generated.*", "**/*.config.ts"], plugins: ["typescript", "oxc", "unicorn"], reportOnly: ["unicorn/prefer-set-has"], rules: { "eslint/func-style": "off", "eslint/id-length": "off", "eslint/max-depth": "off", "eslint/max-lines": "off", "eslint/max-lines-per-function": "off", "eslint/max-params": "off", "eslint/max-statements": "off", "eslint/class-methods-use-this": "off", "eslint/no-bitwise": "off", "eslint/no-console": "off", "eslint/no-continue": "off", "eslint/no-duplicate-imports": "off", "eslint/no-empty-function": "off", "eslint/no-use-before-define": "off", "eslint/no-magic-numbers": "off", "eslint/no-nested-ternary": "off", "eslint/no-plusplus": "off", "eslint/no-ternary": "off", "eslint/no-undefined": "off", "eslint/no-void": "off", "eslint/radix": "off", "eslint/require-await": "off", "eslint/sort-imports": "off", "eslint/sort-keys": "off", "oxc/no-async-await": "off", "oxc/no-async-endpoint-handlers": "off", "oxc/no-map-spread": "off", "oxc/no-optional-chaining": "off", "oxc/no-rest-spread-properties": "off", "typescript/dot-notation": "off", "typescript/explicit-function-return-type": [ "error", { allowExpressions: true, allowHigherOrderFunctions: true, allowTypedFunctionExpressions: true }, ], "typescript/method-signature-style": "off", "unicorn/prefer-code-point": "off", "typescript/no-floating-promises": [ "error", { allowForKnownSafeCalls: [ { from: "package", name: "test", package: "node:test" }, { from: "package", name: "it", package: "node:test" }, { from: "package", name: "describe", package: "node:test" }, { from: "package", name: "before", package: "node:test" }, { from: "package", name: "after", package: "node:test" }, { from: "package", name: "beforeEach", package: "node:test" }, { from: "package", name: "afterEach", package: "node:test" }, ], }, ], "typescript/no-unnecessary-type-parameters": "off", "typescript/prefer-readonly-parameter-types": "off", "typescript/require-await": "off", "unicorn/import-style": "off", "unicorn/no-array-callback-reference": "off", "unicorn/no-array-for-each": "off", "unicorn/no-array-reduce": "off", "unicorn/no-array-reverse": "off", "unicorn/no-array-sort": "off", "unicorn/no-await-expression-member": "off", "unicorn/no-null": "off", "unicorn/no-useless-spread": "off", "unicorn/no-process-exit": "off", "unicorn/prefer-add-event-listener": "off", "unicorn/prefer-global-this": "off", "unicorn/prefer-math-trunc": "off", "unicorn/prefer-modern-math-apis": "off", "unicorn/prefer-native-coercion-functions": "off", "unicorn/prefer-query-selector": "off", "unicorn/prefer-top-level-await": "off", "unicorn/require-post-message-target-origin": "off", }, }, prettier: { base: { arrowParens: "always", bracketSpacing: true, endOfLine: "lf", overrides: [ { files: "*.ts", options: { parser: "typescript" } }, { files: "*.css", options: { parser: "css" } }, ], printWidth: 120, semi: true, singleQuote: false, tabWidth: 4, trailingComma: "all", }, ignore: ["*.log", ".DS_Store", "Thumbs.db"], }, projectOrganization: { ignore: [`**/${relativePath("moduleInfo.root")}/**`], jsonChunks: [] }, qualityEngine: { root: `${relativePath("app.member")}/` }, qualityMaster: { concerns: { "css-class-naming": String.raw`^[a-z][a-z0-9\-]*(?:__[a-z0-9\-]+)?(?:--[a-z0-9\-]+)?$`, "css-custom-property-naming": "^[a-z][a-z0-9-]*$", "css-duplicate-custom-property": true, "css-font-duplicate": true, "css-hex-length": "short", "css-important": true, "css-keyframes-naming": "^[a-z][a-z0-9-]*$", "css-property-vendor-prefix": true, "css-qualifying-type": true, "css-url-quotes": "always", "css-value-vendor-prefix": true, "cognitive-complexity": 20, "cyclomatic-complexity": 12, "declaration-grouping": false, "deep-nesting": 3, "file-length": 200, "identifier-length": false, "line-length": 120, "long-function": 25, "number-precision": 3, "selector-id-budget": 0, "selector-type-budget": 2, spacing: 4, "ternary-conditional": false, "too-many-params": 4, }, ecosystems: ["typescript", "json"], exclude: [ "**/node_modules/**", "**/dist/**", "**/build/**", "**/.cache/**", "**/coverage/**", `**/${relativePath("moduleInfo.root")}/**`, "**/*.generated.*", "**/__fixtures__/**", "**/fixtures/**", "**/testdata/**", "**/.git/**", "**/.vscode/**", "**/logs/**", `**/${relativePath("builds.root")}/**`, `**/${relativePath("thirdParty")}/**`, `**/${relativePath("drafts")}/**`, `**/${relativePath("methodology")}/**`, "**/.quality-reports/**", `${relativePath("govlabHost.reports")}/**`, "**/_experimental*/**", "**/target/**", "**/_build/**", "**/deps/**", "**/.vite/**", "**/.registry/**", "**/.nyc_output/**", "**/out/**", "**/tmp/**", ], toolExclude: { "american-spelling": [ `${relativePath("govlabHost.root")}/shared/manifests/writing.word.manifest.ts`, `${relativePath("codebase.testing.rules")}/codemods/analyzers/word.analyzer.test.ts`, `${relativePath("codebase.testing.app")}/core/normalizers/word.normalizer.test.ts`, `${relativePath("codebase.testing.app")}/core/matchers/vocabulary.matcher.test.ts`, `${relativePath("codebase.testing.build")}/core/converters/vocabulary.fixture.ts`, `${relativePath("codebase.testing.build")}/core/converters/search.converter.test.ts`, `${relativePath("govlab.quality.catalog.data")}/**`, ], comments: [`**/${relativePath("docArch")}/**`, `${relativePath("govlab.quality.catalog")}/**`], }, }, stylelint: { base: { extends: ["stylelint-config-standard"], ignoreFiles: [], overrides: [ { files: ["**/*.tokens.css"], rules: { "declaration-property-value-disallowed-list": null, "govlab/no-css-magic-number": null, "scale-unlimited/declaration-strict-value": null, }, }, ], plugins: [ "stylelint-declaration-strict-value", "stylelint-order", "stylelint-no-unsupported-browser-features", ], }, exclude: [], rules: { ...LOCAL_STYLELINT_SEVERITIES, "declaration-property-value-disallowed-list": { "/^(?!--).*/": [ "/#[0-9A-Fa-f]+/", String.raw`/rgb\(/`, String.raw`/hsl\(/`, String.raw`/\d+(px|em|rem|%)\b/`, ], }, "order/properties-alphabetical-order": true, "plugin/no-unsupported-browser-features": null, "scale-unlimited/declaration-strict-value": [ [ "/color$/", "fill", "stroke", "padding", "padding-block", "padding-inline", "padding-top", "padding-right", "padding-bottom", "padding-left", "margin", "margin-block", "margin-inline", "margin-top", "margin-right", "margin-bottom", "margin-left", "gap", "row-gap", "column-gap", "font-family", "font-size", "font-weight", "letter-spacing", "border", "border-width", "border-radius", "background", "background-color", "background-image", "outline", "outline-width", "outline-offset", "top", "right", "bottom", "left", "inset", "width", "min-width", "max-width", "height", "min-height", "max-height", "inline-size", "block-size", "z-index", "opacity", "transform", "transition-duration", "transition-delay", "transition-timing-function", "animation-duration", "animation-delay", "animation-timing-function", "box-shadow", "text-shadow", ], { disableFix: true, ignoreFunctions: true, ignoreValues: [ "inherit", "transparent", "currentColor", "currentcolor", "initial", "unset", "none", "auto", "solid", "dashed", "dotted", "0", "1", "1em", "0.01ms", "fit-content", "max-content", "min-content", "/%$/", "/vw$/", "/vh$/", "/dvw$/", "/dvh$/", "/dvb$/", ], ignoreVariables: true, }, ], }, }, });