跳到正文
cccskills
免费在 GitHub 公开

lint

Linting and code quality workflow for Software Metrics Machine. Covers ESLint 9.x flat config, Prettier formatting, lint-staged (auto-fix on commit), per-workspace configs, TypeScript strict mode, and all lint commands. USE FOR: lint, eslint, prettier, format, code style, linting, lint fix, auto-fix, check style, code quality, lint-staged, typecheck, type-check, tsc noEmit. DO NOT USE FOR: writing tests (use tdd skill), building (use build commands), commit hooks setup.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(1)

  • SKILL.md5.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Lint Skill — Software Metrics Machine

Tooling Stack

ToolVersionRole
ESLint9.xFlat config (eslint.config.mjs)
Prettier—Formatting (.prettierrc.json)
lint-staged—Auto-fix staged files on commit
TypeScript6.xtsc --noEmit for type checking

Commands

pnpm lint                          # ESLint across all workspaces (via turbo)
pnpm typecheck                     # tsc --noEmit across all workspaces (via turbo)
pnpm --filter @smmachine/core lint # single workspace
pnpm --filter @smmachine/cli lint
pnpm run lint -- --fix <path>      # fix specific file

ESLint Configuration (Root — eslint.config.mjs)

Config objects:

  1. Global ignores: dist/**, node_modules/**, .next/**
  2. Main config (**/src/**/*.ts, ignores *.d.ts):
    • Parser: @typescript-eslint/parser with project: true
    • Rules:
      • @typescript-eslint/no-explicit-any: error
      • @typescript-eslint/no-unused-vars: error (prefix with _ to ignore: _unusedParam)
      • @typescript-eslint/explicit-function-return-type: warn
      • @typescript-eslint/no-floating-promises: error
      • prettier/prettier: error
      • no-console: warn (allows console.warn, console.error)
  3. Test config (**/__tests__/**/*.ts, **/*.test.ts, **/*.config.ts):
    • Same base rules but no-explicit-any: off
    • No project: true (avoids parser issues with test files)

Per-Workspace Configs

Each workspace has its own eslint.config.mjs:

WorkspaceConfig
packages/coreWorkspace-specific
packages/utilsWorkspace-specific
apps/cliCLI-specific
apps/restImports root config
apps/webappUses eslint-config-next (core-web-vitals + typescript)
RootPrimary shared config

Prettier (.prettierrc.json)

{
  "semi": true,
  "singleQuote": true,
  "trailingComma": "es5",
  "printWidth": 100,
  "tabWidth": 2,
  "arrowParens": "always",
  "endOfLine": "lf"
}

lint-staged (.lintstagedrc.json)

Auto-fix runs on every commit via husky/lint-staged:

PatternAction
*.{ts,tsx}eslint --fix + prettier --write
*.{json,md}prettier --write

Mandatory Pre-Change Checks

Before submitting any change, verify:

pnpm lint          # must pass (zero errors AND zero warnings)
pnpm typecheck     # must pass
pnpm build         # must pass
pnpm test          # must pass

This is enforced by the developer agent as the mandatory build verification step.

Lint is a hard gate: if pnpm lint reports any errors OR warnings, you MUST resolve every one of them before considering the task complete. Treat warnings with the same severity as errors. When the lint output includes fixable issues, run pnpm --filter <workspace> exec eslint . --fix to auto-fix them, then re-run pnpm lint to confirm there are zero issues remaining. If auto-fix cannot resolve an issue, edit the source manually until pnpm lint is clean.

After fixing lint issues, you MUST verify that your changes haven't broken anything:

  1. Build affected workspaces: run pnpm build to confirm all packages compile. If type errors surface from return type annotations or import changes, fix them before proceeding. Pay special attention to return types you added — ReturnType<typeof ...> patterns referencing this inside class method signatures will fail, and Array<T> vs CleanedMetricSamples<T> (from cleanMetricSamples) are distinct types. Use the actual return type from the called function, not a guess.

  2. Run tests for affected packages: run pnpm test to confirm no regressions. For isolated verification, use pnpm --filter <workspace> test.

TypeScript Strict Mode

  • strict: true in all tsconfig.json files
  • noUncheckedIndexedAccess: true in some workspaces
  • Type checking via tsc --noEmit (not part of the build step)
  • Type errors fail CI

Guidelines

  • Never use as any or @ts-ignore unless absolutely necessary and commented
  • Use @typescript-eslint/no-explicit-any: error — prefer unknown with proper narrowing
  • Use @typescript-eslint/no-floating-promises: error — always await or .catch() promises
  • Warnings are NOT tolerated — resolve all warnings and errors before completing any task
  • Errors block the pipeline
  • Running pnpm lint --filter <workspace> lints only a specific workspace
  • Rule disabling is prohibited: never use eslint-disable comments, eslint-disable-next-line, or modify any .eslint.config.mjs to weaken or disable rules. Fix the underlying issue instead. When a parameter from an interface is legitimately unused, use void paramName; in the function body rather than renaming it with an _ prefix or suppressing the rule.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Acceptance testing workflow for the Software Metrics Machine CLI e2e suite. Use when writing, extending, debugging, or reviewing bashunit acceptance tests under apps/cli/e2e, including command help checks, cached fixture flows, GitHub MSW-backed flows, local git repository fixtures, SMM_STORE_DATA_AT workspaces, and pnpm run test:cli:acceptance. USE FOR: CLI acceptance tests, e2e tests, bashunit, apps/cli/e2e, command smoke tests, persisted CLI output tests. DO NOT USE FOR: unit tests or Vitest tests (use tdd skill), linting (use lint skill), webapp browser tests.

中文简介正在准备中。当前显示原文说明。

Side-Projects-4-Fun/software-metrics-machine152026年10月18日 更新

tdd

免费

Test-Driven Development workflow for Software Metrics Machine. Covers test frameworks (Vitest 4.x for CLI/REST/core/utils, Jest 30.x for webapp), test patterns (describe/it, builder pattern, mocks via vi.fn), test commands, coverage requirements, and the Red-Green-Refactor cycle. USE FOR: write tests, run tests, test this, add tests, testing, coverage, TDD, test-driven development, vitest, jest, test pattern, test convention. DO NOT USE FOR: linting (use lint skill), building (use build commands directly), debugging production issues.

中文简介正在准备中。当前显示原文说明。

Side-Projects-4-Fun/software-metrics-machine152026年10月18日 更新

VitePress documentation workflow for Software Metrics Machine docs under docs/vitepress. Use when creating, updating, reviewing, or restyling SMM documentation pages, especially feature docs that must keep CLI terminal examples and dashboard views/screenshots in sync. Covers Markdown style, VitePress tabs, command examples, dashboard screenshots, sidebar links, and docs validation. USE FOR: docs/vitepress, VitePress docs, documentation style, CLI docs, dashboard docs, screenshots, feature pages. DO NOT USE FOR: application code changes unless needed to verify documented behavior.

中文简介正在准备中。当前显示原文说明。

Side-Projects-4-Fun/software-metrics-machine152026年10月18日 更新

查看 Side-Projects-4-Fun 的全部技能

报告此技能的问题