一键导入
mav-bp-linting
// Linting conventions for applications. Covers linter selection, rule configuration, auto-formatting, CI integration, and project linting guidance. Applied when writing or reviewing code, or configuring developer tooling.
// Linting conventions for applications. Covers linter selection, rule configuration, auto-formatting, CI integration, and project linting guidance. Applied when writing or reviewing code, or configuring developer tooling.
[HINT] 下载包含 SKILL.md 和所有相关文件的完整技能目录
| name | mav-bp-linting |
| description | Linting conventions for applications. Covers linter selection, rule configuration, auto-formatting, CI integration, and project linting guidance. Applied when writing or reviewing code, or configuring developer tooling. |
| disable-model-invocation | false |
Ensure code quality is enforced automatically through static analysis and formatting. Linting catches bugs, prevents style drift, and reduces code review friction.
digraph tools {
rankdir=LR;
"Linter" [shape=box style=filled fillcolor="#ccddff" label="Linter\n(ESLint, Ruff, etc.)"];
"Formatter" [shape=box style=filled fillcolor="#ccffcc" label="Formatter\n(Prettier, Ruff fmt, etc.)"];
"Linter" -> "Formatter" [style=invis];
}
| Concern | Tool type | What it does | Examples |
|---|---|---|---|
| Linting | Static analyser | Catches bugs, enforces best practices, flags anti-patterns | ESLint, Ruff, Clippy, golangci-lint, RuboCop |
| Formatting | Code formatter | Enforces consistent whitespace, line length, quote style | Prettier, Ruff format, gofmt, rustfmt, Black |
Do not use linters for formatting — disable all style/formatting rules in the linter and delegate to the formatter. This eliminates conflicts between tools.
| Language | Linter | Formatter | Notes |
|---|---|---|---|
| TypeScript/JavaScript | ESLint | Prettier | Use flat config (eslint.config.js). Disable all ESLint formatting rules. |
| Python | Ruff | Ruff format | Ruff replaces both flake8/pylint and Black in a single tool |
| Rust | Clippy | rustfmt | Both ship with the Rust toolchain |
| Go | golangci-lint | gofmt | gofmt is non-negotiable in Go |
| Ruby | RuboCop | RuboCop | RuboCop handles both; separate configs for cops |
All enabled rules must be set to error, never warn. A warning-level rule is noise — developers learn to ignore it, and CI doesn't catch it.
errorStart from a well-maintained preset and override selectively:
@eslint/js recommended + typescript-eslint recommendedeslint-plugin-react-hooks (essential), eslint-plugin-jsx-a11y (if accessibility matters)Do not start from scratch. Presets encode community knowledge about what matters.
Acceptable reasons to disable a rule:
Unacceptable reasons:
Lint and format configs live at the project root:
eslint.config.js (flat config, not .eslintrc)prettier.config.js or .prettierrcruff.toml or pyproject.toml [tool.ruff].golangci.yml.eslintignore / .prettierignore or the config's ignore patternsDevelopers should have:
Include recommended editor settings in the project (e.g., .vscode/settings.json for VS Code).
Format staged files before commit to guarantee consistency:
lint-staged (JS/TS) or pre-commit (Python) to run only on changed files--no-verify) — if a hook is too slow, fix the hookCI is the final gate. It must:
Before applying these standards, load the project-specific linting implementation:
digraph lookup {
"docs/maverick/skills/linting/SKILL.md exists?" [shape=diamond];
"Read and use alongside these standards" [shape=box];
"Invoke upskill" [shape=box];
"Read generated skill" [shape=box];
"docs/maverick/skills/linting/SKILL.md exists?" -> "Read and use alongside these standards" [label="yes"];
"docs/maverick/skills/linting/SKILL.md exists?" -> "Invoke upskill" [label="no"];
"Invoke upskill" -> "Read generated skill";
"Read generated skill" -> "Read and use alongside these standards";
}
docs/maverick/skills/linting/SKILL.mddo-upskill skill with:
eslint|prettier|ruff|lint-staged|formatOnSave|"lint":|"format":eslint.config.*, .eslintrc*, .prettierrc*, prettier.config.*, ruff.toml, .golangci.yml, .stylelintrc*| Pattern | Issue | Fix |
|---|---|---|
| No linter config in project | No automated quality checks | Add linter + formatter with recommended presets |
| Warnings in linter config | Warnings are ignored | Change to errors or disable |
| Formatting rules in linter | Conflicts with formatter | Disable formatting rules, use a dedicated formatter |
| Many inline disables without comments | Suppressed issues without justification | Require explanation or fix the violations |
| No CI lint step | Lint issues merge to main | Add lint + format check to CI pipeline |
| Lint config uses legacy format | Maintenance burden | Migrate to current format (e.g., ESLint flat config) |
| No pre-commit formatting | Style inconsistency across commits | Add lint-staged or equivalent |
| Linter running on generated/vendor code | False positives, slow runs | Update ignore patterns |