mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
Collapse duplicate CI spend while keeping each gate's existence reason: - quality.yml: TIA __RUN_ALL__ defers full unit to fast-unit 4-shard (#6781); path filters via classify-pr-changes; docs-gates split; draft skip - ci.yml: wire docs/i18n/code path filters; ESLint JSON artifact for quality-gate; drop advisory typecheck:noimplicit; float actions/cache@v6 - TIA parity: memory/usage/combo/serial; **/*.test.mjs any depth; electron/bin no longer force unit __RUN_ALL__ - check:complexity-ratchets: one ESLint walk, ruleId-isolated baselines + cache - check:api-docs-refs + lib/apiRoutes: shared API route inventory - husky pre-push: intentionally light (gates live in pre-commit); CLAUDE.md + QUALITY_GATES.md docs synced - collect-metrics / lint:json: path.resolve cache path; Windows-safe eslint bin - env-doc allowlist for ESLINT_RESULTS_JSON / COMPLEXITY_ESLINT_REPORT - release-green --full-ci expects check:api-docs-refs (not docs-symbols alone) Tests: select-impacted, classify-pr-changes, api-routes lib, complexity-rule-count, validate-release-green. Reconciled after #6781 (fast-unit 2→4 shards) per maintainer request on #6716. Co-authored-by: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com>
77 lines
2.0 KiB
JavaScript
77 lines
2.0 KiB
JavaScript
// eslint.complexity-ratchets.config.mjs
|
|
// STANDALONE flat config for BOTH complexity ratchets in ONE ESLint walk:
|
|
// - ESLint core: complexity + max-lines-per-function (src, open-sse, electron, bin)
|
|
// - sonarjs/cognitive-complexity (src, open-sse only)
|
|
//
|
|
// Existence reason: two independent baselines (complexity-baseline.json +
|
|
// quality-baseline metrics.cognitiveComplexity) must stay isolatable from the
|
|
// main lint warning budget — but they do NOT need two cold tree walks.
|
|
//
|
|
// Counts are taken by ruleId in the check scripts (never file.errorCount), so
|
|
// cognitive violations cannot inflate the cyclomatic/max-lines ratchet.
|
|
import tseslint from "typescript-eslint";
|
|
import sonarjs from "eslint-plugin-sonarjs";
|
|
|
|
const SHARED_LANGUAGE = {
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: "module",
|
|
ecmaFeatures: { jsx: true },
|
|
},
|
|
};
|
|
|
|
const SHARED_LINTER = {
|
|
noInlineConfig: true,
|
|
reportUnusedDisableDirectives: "off",
|
|
};
|
|
|
|
const SHARED_IGNORES = {
|
|
ignores: [
|
|
"**/*.test.ts",
|
|
"**/*.test.tsx",
|
|
"**/__tests__/**",
|
|
"**/*.d.ts",
|
|
"node_modules/**",
|
|
"electron/node_modules/**",
|
|
"electron/dist-electron/**",
|
|
".next/**",
|
|
".build/**",
|
|
"dist/**",
|
|
"coverage/**",
|
|
],
|
|
};
|
|
|
|
/** @type {import("eslint").Linter.Config[]} */
|
|
const config = [
|
|
{
|
|
files: [
|
|
"src/**/*.{ts,tsx}",
|
|
"open-sse/**/*.{ts,tsx}",
|
|
"electron/**/*.{ts,tsx}",
|
|
"bin/**/*.{ts,tsx}",
|
|
],
|
|
languageOptions: SHARED_LANGUAGE,
|
|
linterOptions: SHARED_LINTER,
|
|
rules: {
|
|
complexity: ["error", 15],
|
|
"max-lines-per-function": [
|
|
"error",
|
|
{ max: 80, skipBlankLines: true, skipComments: true },
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ["src/**/*.{ts,tsx}", "open-sse/**/*.{ts,tsx}"],
|
|
languageOptions: SHARED_LANGUAGE,
|
|
plugins: { sonarjs },
|
|
linterOptions: SHARED_LINTER,
|
|
rules: {
|
|
"sonarjs/cognitive-complexity": ["error", 15],
|
|
},
|
|
},
|
|
SHARED_IGNORES,
|
|
];
|
|
|
|
export default config;
|