eslint
ESLint - pluggable JavaScript/TypeScript linter USE WHEN: user mentions "ESLint", "JavaScript linting", ".eslintrc", asks about "eslint config", "linting rules", "eslint plugins", "flat config" DO NOT USE FOR: Biome - use `eslint-biome` skill, TypeScript-specific - use `typescript-eslint` skill, code quality principles - use `quality-common`
What this skill does
# ESLint - Quick Reference
## When to Use This Skill
- Configure linting for JavaScript/TypeScript projects
- Create custom rules
- Integrate with Prettier and other tools
## When NOT to Use This Skill
- **ESLint 9 flat config + Biome** - Use `eslint-biome` skill for modern setup
- **TypeScript-specific rules** - Use `typescript-eslint` skill
- **Code quality principles** - Use `quality-common` for SOLID/Clean Code
- **SonarQube integration** - Use `sonarqube` skill
> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `eslint` for comprehensive documentation.
## Basic Setup
```bash
npm install -D eslint @eslint/js
npx eslint --init
```
## Flat Config (ESLint 9+)
### eslint.config.js
```javascript
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
export default [
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/explicit-function-return-type': 'warn',
},
},
{
ignores: ['dist/', 'node_modules/', '*.config.js'],
},
];
```
### With Prettier
```javascript
import eslintConfigPrettier from 'eslint-config-prettier';
export default [
js.configs.recommended,
...tseslint.configs.recommended,
eslintConfigPrettier, // Must be last
];
```
## Legacy Config (.eslintrc)
```json
{
"root": true,
"env": { "browser": true, "es2021": true, "node": true },
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"rules": {
"no-console": "warn",
"@typescript-eslint/no-explicit-any": "error"
}
}
```
## CLI Usage
```bash
# Lint files
npx eslint src/
# Fix auto-fixable issues
npx eslint src/ --fix
# Check specific files
npx eslint "src/**/*.{ts,tsx}"
```
## Anti-Patterns
| Anti-Pattern | Why It's Bad | Correct Approach |
|--------------|--------------|------------------|
| Using legacy .eslintrc in new projects | Deprecated in ESLint 9 | Use flat config (eslint.config.mjs) |
| No TypeScript type checking | Misses type-aware issues | Use `recommendedTypeChecked` preset |
| Disabling rules with comments everywhere | Code smell, defeats purpose | Fix the issue or adjust rule config |
| Not caching in CI | Slow linting | Use `--cache` flag |
| Conflicting Prettier rules | Formatting wars | Use `eslint-config-prettier` |
| Ignoring warnings | Accumulate tech debt | Treat warnings as errors in CI |
## Quick Troubleshooting
| Issue | Likely Cause | Solution |
|-------|--------------|----------|
| "Failed to load config" error | Wrong config format | Check eslint.config.mjs syntax |
| Type-aware rules not working | Missing parserOptions | Add `projectService: true` to config |
| Linting very slow | No caching, type checking all files | Enable cache, limit type checking to TS files |
| Rules from plugin not found | Plugin not in flat config format | Check plugin compatibility with ESLint 9 |
| Prettier conflicts | Both formatting same code | Add `eslint-config-prettier` last |
| File not being linted | In ignores array | Check `ignores` in config |
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.