| name | prettier-eslint-editorconfig |
| description | Resolve formatter/linter/EditorConfig hierarchy, avoid tool fights, and run a reliable format-then-lint fix pipeline. Use when prettier, eslint, editorconfig, 格式化, format-on-save conflicts, eslint-config-prettier, or CI format checks fail.
|
Prettier, ESLint, And EditorConfig
Use When
| Situation | Direction |
|---|
| Prettier / format-on-save / CI format check | This skill (primary) |
| ESLint vs Prettier rule collisions | This skill |
| EditorConfig (charset, indent, EOL, final newline) | This skill |
| “Don’t fight the tools” / ownership of concerns | This skill |
TS any, strictness, semantic import rules | typescript-style-and-eslint |
| Broader maintainability, tests, security | Baseline: code-quality-standards |
Triggers: prettier, eslint, editorconfig, 格式化, format pipeline, lint-staged, eslint --fix.
Repo Config First
Never impose personal formatter prefs. Discover and obey:
- EditorConfig —
.editorconfig (indent, EOL, charset, final newline, trim)
- Prettier —
.prettierrc*, prettier.config.*, package prettier, .prettierignore
- ESLint — flat/legacy; note
eslint-config-prettier / eslint-plugin-prettier
- Globs — Prettier plugins and ESLint overrides per path
- Automation — package scripts, lint-staged, husky, CI format/lint jobs
For pure presentation when tools disagree: repo Prettier wins for languages it formats; EditorConfig fills editor defaults and non-Prettier files; ESLint should not re-assert formatting if Prettier is adopted. If configs are missing, match neighboring files. Do not add a full tool stack unless asked.
Tool Hierarchy (Do Not Fight Tools)
| Concern | Owner | Examples |
|---|
| Indent, quotes, semis, width, trailing commas | Prettier | printWidth, singleQuote |
| Charset, EOL, final newline, basic indent defaults | EditorConfig | end_of_line, indent_size |
| Correctness, bugs, TS safety | ESLint | no-unused-vars, no-floating-promises |
| Import sorting | Repo choice | One of: ESLint plugin or Prettier plugin |
| Typechecking | tsc / vue-tsc | Not ESLint alone |
Anti-patterns
- ESLint stylistic rules (
indent, quotes, semi, max-len) while Prettier formats the same files
eslint --fix and Prettier in orders that undo each other
- Mixed tabs/spaces or CRLF/LF in the same package
- Hand-reformatting huge unrelated diffs
- Checking in caches/settings that contradict repo config
Integration (good)
- Prettier + eslint-config-prettier — Prettier formats; ESLint drops conflicting style rules.
eslint-plugin-prettier only if already present — do not add by default.
- EditorConfig aligned with Prettier (
indent_size == tabWidth, consistent EOL).
- Single import sorter — not two mechanisms fighting.
Workflow (Fix Pipeline)
Prefer repository scripts. Safe default order:
- Read configs — EditorConfig → Prettier → ESLint → CI commands.
- Change behavior first — format only files needed for the task.
- Format — Prettier on touched paths (
npm run format / equivalent).
- Lint fix — ESLint
--fix for non-format auto-fixes.
- Typecheck — if the package defines it.
- Re-format if a codemod/ESLint rewrite changed structure.
- Verify as CI does (
prettier --check, eslint).
prettier --write path/to/file.ts
eslint path/to/file.ts --fix
npm run format && npm run lint && npm run typecheck
lint-staged / CI: format + lint staged files in pre-commit; full check in CI. Fail on prettier --check (or equivalent)—do not rely on review-only fixes.
Good / Bad Examples
Bad — two owners of quotes/semis:
ESLint: quotes double, semi required
Prettier: singleQuote true, semi false
→ save-loop / CI thrash
Good: Prettier is the style source; eslint-config-prettier last (or flat equiv).
Bad pipeline: eslint --fix then Prettier undoes import/layout every run.
Good pipeline: one sorter; Prettier write → ESLint fix with no stylistic overlap.
Bad: reformat entire monorepo to tabs while .editorconfig/Prettier specify 2 spaces.
Good: touch feature files only; run package format script; leave unrelated packages alone.
Bad: /* eslint-disable */ whole file because tools disagree.
Good: fix ownership with eslint-config-prettier; reserve disable for true exceptions.
Routing
| Need | Skill |
|---|
| Prettier / EditorConfig / format pipeline / hierarchy | This skill (primary) |
TS strictness, any ban, semantic imports | typescript-style-and-eslint |
| Implementation quality beyond format/lint | code-quality-standards (always baseline) |
| “Only make it pretty” | This skill; still honor code-quality-standards contracts |
Route formatting fights here; TypeScript correctness style to typescript-style-and-eslint; always keep code-quality-standards for behavior, errors, tests, and security.
Checklist