Lint Cleanup

VerifiedSafe

Fix ESLint errors safely. Prefix unused vars with `_`, fix case declarations, add default props, verify builds. Use for easier refactoring and faster AI editing.

Sby Skills Guide Bot
DevelopmentIntermediate
7/24/2026
Claude CodeCursorWindsurfCopilotCodex
#eslint#lint-cleanup#typescript#vue#code-quality

Recommended for

Automated summary

Provides a step-by-step workflow for resolving common ESLint errors in TypeScript and Vue codebases while preserving behavior.

Strengths

  • Starts with a baseline lint, build, and Git check before making changes.
  • Covers safe fixes for unused variables, case declarations, Vue default props, boolean shorthand, and empty object types.
  • Recommends verifying builds after each cleanup batch to catch regressions early.
  • Includes grep commands to locate files with specific lint errors.

Limitations

  • The pasted SKILL.md is truncated at the empty object type section, so that fix is not fully documented.
  • Focuses on a limited set of common rules, not a complete ESLint or framework-agnostic cleanup strategy.
  • Assumes npm scripts and a project setup where lint and build commands are available.
When to use it

Use it when a TypeScript or Vue project has a manageable set of ESLint errors and you want to clean them up without changing application logic.

When not to use it

Avoid it when the codebase has a failing build or uncommitted changes that could make it hard to distinguish lint fixes from pre-existing breakage.

Security analysis

Safe
Quality score78/100

The skill only provides guidance for fixing ESLint errors and running local verification commands (npm run lint/build, git status, grep). No network calls, no secret handling, no destructive commands, no obfuscated payloads, and no attempts to disable safety controls. The only minor consideration is editing ESLint config ignores, which is a normal refactoring action, not a security risk.

Findings
  • •Runs npm/git commands and writes lint output to /tmp/lint-output.txt — legitimate local dev operations, no exfiltration
  • •Advises modifying eslint.config.js ignores, which could silently suppress real lint errors if misapplied
How this analysis is made

Examples

Fix unused variables safely
Run npm run lint, identify @typescript-eslint/no-unused-vars errors, and fix them by prefixing unused variables or parameters with `_` or removing unused imports. Verify `npm run build` after each batch.
Resolve case declaration errors
Find all no-case-declarations ESLint errors in this TypeScript project and wrap the relevant `case` blocks in braces. Run lint and build afterward to confirm nothing broke.
Add Vue default props
Fix vue/require-default-prop errors in my Vue 3 `<script setup>` components using `withDefaults()` and factory functions for arrays and objects. Verify the build after the changes.

name: Lint Cleanup description: FIX ESLint errors safely without breaking code. Prefix unused variables with _, fix no-case-declarations, add default props, and verify builds after each batch. Use when lint cleanup is needed for easier refactoring & faster Claude Code editing.

Safe Lint Cleanup

Instructions

This skill provides safe patterns for fixing ESLint errors without breaking code.

Pre-Flight Checklist

BEFORE starting any lint cleanup:

# 1. Get baseline count
npm run lint 2>&1 | tail -5

# 2. Save full output for reference
npm run lint 2>&1 > /tmp/lint-output.txt

# 3. Verify build works
npm run build

# 4. Check git status (ensure clean state)
git status

Error Categories & Fixes

1. Unused Variables (@typescript-eslint/no-unused-vars)

Pattern 1: Prefix Unused Variables with _

This is the SAFEST fix - silences the error without changing logic:

// BEFORE (error)
const unusedVar = someValue

// AFTER (no error)
const _unusedVar = someValue

Pattern 2: Prefix Unused Function Parameters

// BEFORE
const handleClick = (event: MouseEvent) => {
  // doesn't use event
}

// AFTER
const handleClick = (_event: MouseEvent) => {
  // doesn't use event
}

Pattern 3: Destructuring with Rename

// BEFORE
const { unusedProp, usedProp } = options

// AFTER
const { unusedProp: _unusedProp, usedProp } = options

Pattern 4: Unused Type Imports

// BEFORE
import { SomeType, UsedType } from '@/types'

// AFTER
import type { SomeType as _SomeType, UsedType } from '@/types'

Pattern 5: Remove Completely Unused Imports

// BEFORE
import { ref, watch, computed } from 'vue'  // watch never used

// AFTER
import { ref, computed } from 'vue'

2. Case Declarations (no-case-declarations)

Error: Unexpected lexical declaration in case block

Cause: Using const, let, or class directly in a case block without braces.

Fix: Wrap case block contents in {} to create block scope.

// BEFORE (error)
switch (type) {
  case 'foo':
    const value = computeValue()  // ERROR!
    doSomething(value)
    break
  case 'bar':
    const other = computeOther()  // ERROR!
    doOther(other)
    break
}

// AFTER (fixed)
switch (type) {
  case 'foo': {
    const value = computeValue()
    doSomething(value)
    break
  }
  case 'bar': {
    const other = computeOther()
    doOther(other)
    break
  }
}

Quick find pattern:

# Find files with case declarations errors
npm run lint 2>&1 | grep "no-case-declarations" -B1 | grep -E "^/" | sort -u

3. Vue Default Props (vue/require-default-prop)

Error: Prop 'X' requires default value to be set

Cause: Optional props without default values in Vue 3 <script setup>.

Fix: Use withDefaults() to provide default values.

<!-- BEFORE (error) -->
<script setup lang="ts">
interface Props {
  title?: string
  count?: number
  items?: string[]
}
const props = defineProps<Props>()
</script>

<!-- AFTER (fixed) -->
<script setup lang="ts">
interface Props {
  title?: string
  count?: number
  items?: string[]
}
const props = withDefaults(defineProps<Props>(), {
  title: '',
  count: 0,
  items: () => []  // Use factory for arrays/objects
})
</script>

Default value rules:

  • Primitives: Use direct value ('', 0, false, null)
  • Arrays: Use factory function () => []
  • Objects: Use factory function () => ({})

4. Boolean Shorthand (vue/prefer-true-attribute-shorthand)

Error: Boolean attribute should be written in shorthand form

Cause: Using :prop="true" instead of just prop.

<!-- BEFORE (error) -->
<MyComponent :is-active="true" :show-header="true" />

<!-- AFTER (fixed) -->
<MyComponent is-active show-header />

5. Empty Object Types (@typescript-eslint/no-empty-object-type)

Error: The {} type is not recommended

Cause: Using {} as a type in TypeScript (especially in .d.ts files).

Fix: Use object or Record<string, never> instead, OR exclude .d.ts files:

// In eslint.config.js ignores:
ignores: ['**/*.d.ts']

6. ESLint Config Alignment

Problem: Files excluded from tsconfig.json but not from ESLint cause parsing errors.

Fix: Keep ESLint ignores aligned with tsconfig excludes:

// eslint.config.js
{
  ignores: [
    'node_modules/**',
    'dist/**',
    '**/*.d.ts',
    // Match tsconfig.json exclude patterns:
    'src/stories/**',
    'src/composables/adapters/**',
    'src/sync/**',
    'src/utils/emojiDetection.ts',
    'src/utils/logger.ts',
    // etc.
  ]
}

ESLint Config for Underscore Pattern

CRITICAL: The underscore pattern must be configured for BOTH .ts AND .vue files:

// eslint.config.js

// For TypeScript files
{
  files: ['**/*.ts', '**/*.tsx'],
  rules: {
    '@typescript-eslint/no-unused-vars': ['error', {
      argsIgnorePattern: '^_',
      varsIgnorePattern: '^_',
      caughtErrorsIgnorePattern: '^_'
    }]
  }
}

// For Vue files - MUST BE SEPARATE!
{
  files: ['**/*.vue'],
  rules: {
    '@typescript-eslint/no-unused-vars': ['error', {
      argsIgnorePattern: '^_',
      varsIgnorePattern: '^_',
      caughtErrorsIgnorePattern: '^_'
    }]
  }
}

Verification Process

After every batch of fixes:

# 1. Run build
npm run build 2>&1 | tail -10

# 2. Check new lint count
npm run lint 2>&1 | tail -5

# 3. Calculate progress
# (baseline - current) / baseline * 100 = % fixed

Files to Be Careful With

| File Type | Reason | |-----------|--------| | Vue components with templates | Variables might be used in template | | Store files | Exported functions might appear unused | | Composables | Returned values might appear unused | | Test files | May have intentional unused vars | | .d.ts files | Type declarations may use special patterns |


Error Priority Order

Fix errors in this order (highest impact first):

  1. Parsing errors - ESLint ignores alignment with tsconfig
  2. no-case-declarations - Structural fixes, wrap in {}
  3. require-default-prop - Add withDefaults()
  4. no-unused-vars - Prefix with _ or remove
  5. prefer-true-attribute-shorthand - Simple template fixes
  6. no-explicit-any - Requires proper typing (lower priority)

Quick Reference Commands

# Get current lint count
npm run lint 2>&1 | tail -5

# Save full output
npm run lint 2>&1 > /tmp/lint-output.txt

# Find files with specific error
npm run lint 2>&1 | grep "ERROR_NAME" -B1 | grep -E "^/" | sort -u

# Count specific error type
grep "ERROR_NAME" /tmp/lint-output.txt | wc -l

# Check specific file errors
cat /tmp/lint-output.txt | grep -A20 "YourFile.vue$" | head -25

# Run --fix for auto-fixable errors (safe)
npm run lint -- --fix

# Find case declarations by file
awk '/^\/home.*\.(vue|ts)$/ { file=$0 } /no-case-declarations/ { print file }' /tmp/lint-output.txt | sort -u

Common Gotchas

  1. Multiple Matches: Add more surrounding context to make match unique
  2. Variable Used in Template: Check <template> section before prefixing
  3. Exported but Appears Unused: Don't prefix exports - used externally
  4. Store/Composable Return Values: Check if values are returned for consumers
  5. Case Block Fallthrough: Ensure break is inside the {} braces
  6. Factory Functions for Props: Arrays/objects need () => [] not []

See lint-cleanup-guide.md for complete documentation.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/lint-cleanup-mryiqi6a/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/lint-cleanup-mryiqi6a' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/lint-cleanup-mryiqi6a/download' --output '.skill-downloads/lint-cleanup-mryiqi6a/SKILL.md.part' && mv '.skill-downloads/lint-cleanup-mryiqi6a/SKILL.md.part' '.skill-downloads/lint-cleanup-mryiqi6a/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/lint-cleanup-mryiqi6a/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills