Add local CodeFactor parity lint tooling

Merged
UN
4mo ago
+1226-18

Summary

  • Adds pnpm lint as a local CodeFactor parity gate: ESLint maintainability rules, jscpd duplicate reporting, and the existing static quality profile.
  • Wires pnpm lint into the CI static gate and locks the new dev tooling.
  • Documents the lint workflow and release gate mapping, regenerates CHANGELOG.md with pm-changelog, and closes the CodeFactor parity/complexity/duplication PM items.

Verification

  • pm test pm-6sqo --run --progress
  • pnpm lint
  • node scripts/run-tests.mjs test -- tests/integration/ci-workflow-contract.spec.ts tests/integration/release-automation-contract.spec.ts tests/integration/release-readiness-runtime.spec.ts
  • pnpm typecheck
  • pnpm quality:static
  • pnpm contracts:check
  • pnpm security:scan
  • pnpm audit --audit-level moderate
  • pnpm changelog:pm:check
  • node scripts/run-tests.mjs coverage -> 256 files, 5133 tests, 100/100/100/100
  • npm pack --dry-run --silent
  • node dist/cli.js package doctor --project --detail deep --json
  • pm health --check-only --summary --json
  • node scripts/release/sentry-telemetry-gate.mjs --json --telemetry-mode best-effort
  • Manual isolated temp smoke in /tmp/tmp.ExXdcpRd86 with todos package doctor
  • Strict warning-free isolated temp smoke in /tmp/tmp.vRdXivNLZS with item temp-codefactor-lint-zbd9

Notes

  • jscpd currently reports the known 30-clone / 0.34% baseline and fails above the configured 0.35 threshold, so current main passes while new duplication regresses locally and in CI.
  • GitHub issue #374 remains an external RELEASE_PAT environment blocker; no code-side fix is pending in this branch.

Summary by Sourcery

Introduce a unified local lint command that mirrors CodeFactor maintainability, complexity, and duplication gates and wire it into the documented and automated release workflow.

New Features:

  • Add a top-level pnpm lint script that runs ESLint maintainability rules, duplication checks, and the existing static quality gate in a single command.

Enhancements:

  • Configure ESLint (including unicorn and TypeScript support) and jscpd to align local linting with CodeFactor’s maintainability and duplication signals.
  • Extend testing and release-readiness contracts to validate the presence and shape of the new lint script in package.json.
  • Record CodeFactor-driven complexity and duplication remediation, and the new parity tooling, in the changelog and internal PM artifacts.

Build:

  • Add eslint, eslint-plugin-unicorn, typescript-eslint, jscpd, and shared ESLint/jscpd config to the development toolchain.

CI:

  • Integrate pnpm lint into the main CI static gate so CodeFactor-aligned linting runs on every pipeline.

Documentation:

  • Document the lint workflow in TESTING and RELEASING guides, clarifying how the new lint command maps to CodeFactor parity and existing static quality gates.

Tests:

  • Update CI and release automation integration tests to assert that the new lint command is present and enforced in the workflow.

Chores:

  • Track and close CodeFactor parity, complexity, and duplication chores via updated PM task and history files.

Summary by cubic

Adds a local CodeFactor-parity lint gate with pnpm lint and fixes a Windows atomic write flake by retrying transient rename errors. Aligns jscpd/ESLint generated-directory ignores and updates release docs to reflect the actual static quality gate.

  • New Features

    • Adds pnpm lint composed of lint:eslint, lint:duplicates (jscpd), and lint:codefactor (delegates to quality:static).
    • Adds eslint.config.mjs with CodeFactor-like rules and .jscpd.json (threshold 0.35); mirrors ESLint generated-directory ignores in jscpd.
    • Updates CI to run pnpm lint (replaces quality:static step); updates docs and tests for the new workflow and clarifies the release static gate scope.
  • Bug Fixes

    • Retries transient EPERM/EBUSY on Windows during fs.rename in writeFileAtomic with bounded backoff; adds unit tests. Addresses the Windows regression tracked in pm-2kkl.