linting
Guide for linting and formatting TypeScript with ESLint, typescript-eslint, Biome, and Prettier. Use when configuring flat-config ESLint, choosing…
от vinnie357★ 30 звёзд на GitHub
Установить linting в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
TypeScript Linting and Formatting
ESLint + typescript-eslint for type-aware linting, Biome as a fast all-in-one alternative, Prettier for formatting, and CI wiring.
ESLint with typescript-eslint
Setup
npm install -D eslint @eslint/js typescript typescript-eslint
ESLint 9+ uses flat config (eslint.config.js / .mjs) — a plain array of config objects, not the older .eslintrc cascading-file format. npm init @eslint/config@latest scaffolds one interactively; the shape by hand:
// eslint.config.mjs
import js from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
js.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
{
rules: {
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
},
},
);
@eslint/js exports { meta, configs } — js.configs.recommended, not js.recommended or js.default. Running js.recommended directly fails at config-load time (Unexpected undefined config) since it resolves to undefined.
Preset selection
typescript-eslint ships three stacked preset tiers — pick a floor, don't cherry-pick individual rules out of a higher tier without understanding what the lower tier already covers:
| Preset | What it adds |
|---|---|
recommended |
Rules that catch common bugs and mistakes with minimal false positives — the floor for any TypeScript project |
strict |
A superset of recommended with more opinionated rules that catch bugs recommended deliberately leaves out to avoid false positives |
stylistic |
Consistency rules with no bug-catching intent — naming conventions, member ordering; layered on top of either of the above, never a substitute |
Default to recommended + stylistic for most projects; reach for strict when the codebase can absorb its stricter defaults (banning // @ts-ignore without a description, disallowing certain type assertions) without a large one-off migration. This mirrors the workspace's general strictness posture (/core:security, /core:tdd CI-strictness discipline) — start strict on new code, treat loosening as the exception that needs a reason.
Type-aware rules
Some typescript-eslint rules (no-floating-promises, no-unsafe-assignment, await-thenable) require the TypeScript type checker, not just the parser — they need parserOptions.project (or projectService: true in newer configs) pointed at a tsconfig.json:
export default tseslint.config(
...tseslint.configs.strictTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
);
Type-aware linting is slower than syntax-only linting — it invokes the compiler. Scope it to source files (exclude generated output and config files) rather than running it over the whole repo, and expect it to dominate lint wall-clock time on a large codebase.
Biome
Biome is a single Rust-implemented binary that combines a linter, a formatter, and import organization — the case for reaching for it instead of ESLint+Prettier is speed and zero-config startup, at the cost of a smaller (though fast-growing) rule set and plugin ecosystem compared to ESLint's.
Setup
npm install -D -E @biomejs/biome
npx @biomejs/biome init
The -E flag pins the exact installed version — Biome's formatting output can shift between versions, so an unpinned range risks a CI failure from a formatter update alone, not a real style violation.
Commands
npx biome format --write . # formatting only
npx biome lint --write . # linting, with safe autofixes
npx biome check --write . # format + lint + import organization together
npx biome ci . # non-mutating check, exit-code gate for CI
Choosing Biome over ESLint+Prettier
Reach for Biome when starting a new project and the team values one fast tool over ESLint's larger rule/plugin ecosystem. Don't migrate an existing ESLint config with custom plugins or shareable configs to Biome as a drive-by — Biome's rule set doesn't map 1:1 to typescript-eslint's, and a migration is its own reviewed change with a real rule-parity check, not a mechanical swap.
Prettier Integration
If linting with ESLint (not Biome), keep Prettier as the formatter and ESLint focused on code-quality rules — don't run Prettier as an ESLint rule via eslint-plugin-prettier. Running formatting through the lint pipeline is slower than running Prettier directly and produces editor squiggles for pure formatting differences that autofix on save anyway.
Use eslint-config-prettier instead, which disables the ESLint stylistic rules that would otherwise conflict with Prettier's own formatting decisions:
import prettierConfig from "eslint-config-prettier";
export default tseslint.config(
// ...other configs
prettierConfig, // last — turns
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/rule-catalog.md
FAQ
Что делает скилл linting?
Guide for linting and formatting TypeScript with ESLint, typescript-eslint, Biome, and Prettier. Use when configuring flat-config ESLint, choosing typescript-eslint's strict or recommended presets, evaluating Biome as an ESLint/Prettier replacement, wiring pre-commit lint hooks, or adding lint/format to CI.
Как установить скилл linting?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл linting запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…