xiaohongshu
xiaohongshu
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.
Full skill instructions
This skill provides safe patterns for fixing ESLint errors without breaking code.
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
@typescript-eslint/no-unused-vars)_This is the SAFEST fix - silences the error without changing logic:
// BEFORE (error)
const unusedVar = someValue
// AFTER (no error)
const _unusedVar = someValue
// BEFORE
const handleClick = (event: MouseEvent) => {
// doesn't use event
}
// AFTER
const handleClick = (_event: MouseEvent) => {
// doesn't use event
}
// BEFORE
const { unusedProp, usedProp } = options
// AFTER
const { unusedProp: _unusedProp, usedProp } = options
// BEFORE
import { SomeType, UsedType } from '@/types'
// AFTER
import type { SomeType as _SomeType, UsedType } from '@/types'
// BEFORE
import { ref, watch, computed } from 'vue' // watch never used
// AFTER
import { ref, computed } from 'vue'
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
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:
'', 0, false, null)() => []() => ({})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 />
@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']
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.
]
}
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: '^_'
}]
}
}
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
| 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 |
Fix errors in this order (highest impact first):
{}withDefaults()_ or remove# 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
<template> section before prefixingbreak is inside the {} braces() => [] not []See lint-cleanup-guide.md for complete documentation.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience