xiaohongshu
xiaohongshu
lint-fixer
Expert assistant for analyzing and fixing linting and formatting issues in the KR92 Bible Voice project using Biome and TypeScript. Use when fixing lint errors, resolving TypeScript issues, applying code formatting, or reviewing code quality.
Full skill instructions
The project uses Biome for linting and formatting:
npx @biomejs/biome lint . # Check for lint issues
npx @biomejs/biome lint . --write # Auto-fix safe issues
npx @biomejs/biome format . # Format code
npx @biomejs/biome check --write . # Lint + format
npx tsc --noEmit # Type checking
npm run typecheck # Same as above
Issue: String concatenation should use template literals
Before:
alert('Error: ' + err.message);
const url = baseUrl + '/' + endpoint;
After:
alert(`Error: ${err.message}`);
const url = `${baseUrl}/${endpoint}`;
Issue: Variables that are never reassigned should use const
Before:
let value = 10;
let result = calculate();
After:
const value = 10;
const result = calculate();
Issue: Variables declared but never used
Fix:
// Remove if truly unused
// const unused = value;
// Or prefix with _ if intentionally unused
const _intentionallyUnused = value;
Issue: Console statements in production code
Fix:
// Remove or conditionally include
if (process.env.NODE_ENV === 'development') {
console.log('Debug info');
}
// Or use proper logging
logger.debug('Debug info');
Issue: Using any type instead of specific types
Before:
function process(data: any) {
return data.value;
}
After:
interface Data {
value: string;
}
function process(data: Data) {
return data.value;
}
// Or use unknown for truly dynamic data
function process(data: unknown) {
if (isData(data)) {
return data.value;
}
}
Issue: Using ! non-null assertion
Before:
const element = document.getElementById('app')!;
After:
const element = document.getElementById('app');
if (!element) {
throw new Error('Element not found');
}
User: "Fix all safe linting issues"
Assistant:
# Run Biome with auto-fix
npx @biomejs/biome check --write .
# Review changes
git diff
# If changes look good, commit
git add .
git commit -m "fix: apply Biome auto-fixes"
User: "Fix the template literal warnings"
Assistant: I'll fix the string concatenation issues. Looking at the error:
// public/embed-test.html:413
alert('Audion toisto epäonnistui: ' + err.message);
Let me fix this:
// Replace with template literal
alert(`Audion toisto epäonnistui: ${err.message}`);
For batch fixing similar issues, I can use Find & Replace pattern:
'([^']*?)'\s*\+\s*([^;]+)`$1${$2}`User: "I have TypeScript errors in my component"
Assistant: Let me check the TypeScript errors:
npx tsc --noEmit 2>&1 | head -20
Common fixes:
Missing type annotations:
// Before
const handleClick = (e) => {
console.log(e);
};
// After
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
console.log(e);
};
Implicit any:
// Before
const data = await response.json();
// After
interface ApiResponse {
success: boolean;
data: any; // Define proper type
}
const data: ApiResponse = await response.json();
User: "Convert all let to const where possible"
Assistant:
# First, let Biome auto-fix
npx @biomejs/biome check --write .
# For remaining cases, manual review needed
# Search for: let (\w+) =
# Review each case to ensure variable isn't reassigned
User: "Remove or fix console.log statements"
Assistant:
Strategy:
// Development only
if (import.meta.env.DEV) {
console.log('Debug:', data);
}
// Remove debug logs
// console.log('Testing'); // ❌ Remove
// Keep error logs
console.error('Failed to load:', error); // ✅ Keep
// Better: Use proper error handling
try {
await operation();
} catch (error) {
console.error('Operation failed:', error);
toast({
title: "Error",
description: error.message,
variant: "destructive"
});
}
The project likely has a biome.json config file:
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": ["node_modules", "dist", ".next", "build"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"useTemplate": "error",
"useConst": "error"
},
"suspicious": {
"noExplicitAny": "warn",
"noConsole": "warn"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "always"
}
}
}
# Run lint check
npx @biomejs/biome lint .
# Count issues by severity
npx @biomejs/biome lint . 2>&1 | grep -c "error"
npx @biomejs/biome lint . 2>&1 | grep -c "warn"
# Let Biome fix what it can
npx @biomejs/biome check --write .
# Check what changed
git diff --stat
# Run lint again to see remaining issues
npx @biomejs/biome lint . > lint-report.txt
# Fix manually by priority:
# 1. Errors first
# 2. Then warnings
# 3. Then infos
# Run full check
npx @biomejs/biome check .
npx tsc --noEmit
# If clean, commit
git add .
git commit -m "fix: resolve linting issues"
// Common issues:
// - Missing type annotations for props
// - Unused imports
// - Console.log statements
// - Non-null assertions
// Fix template:
interface Props {
data: DataType;
onUpdate: (value: string) => void;
}
export const Component = ({ data, onUpdate }: Props) => {
// No console.log here
return <div>...</div>;
};
// Common issues:
// - Any types in request/response
// - Missing error handling types
// - String concatenation
// Fix template:
interface RequestBody {
field: string;
}
interface ResponseData {
success: boolean;
data: ResultType;
}
serve(async (req: Request) => {
try {
const body: RequestBody = await req.json();
// ...
return new Response(
JSON.stringify({ success: true, data }),
{ headers: corsHeaders }
);
} catch (error) {
return new Response(
JSON.stringify({
success: false,
error: error instanceof Error ? error.message : 'Unknown error'
}),
{ status: 500, headers: corsHeaders }
);
}
});
// Often can ignore some rules
// Add to biome.json:
{
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "off" // OK in tests
}
}
}
}
// biome-ignore lint/style/useTemplate: Legacy code, will refactor later
const message = 'Error: ' + error;
// biome-ignore lint/suspicious/noExplicitAny: Third-party types
const data: any = externalLibrary.getData();
/* biome-ignore lint/style/useTemplate: Multiple concatenations in this file */
Your GitHub Actions already runs these checks:
# .github/workflows/ci.yml
- name: Lint
run: |
if npx -y @biomejs/biome --version > /dev/null 2>&1; then
npx @biomejs/biome lint .
npx @biomejs/biome format . --check
fi
- name: TypeScript
run: npm run typecheck --if-present || npx tsc --noEmit
| Issue Type | Command to Fix | Manual Review? |
|---|---|---|
| Template literals | --write | No |
| Const declarations | --write | No |
| Formatting | --write | No |
| Unused variables | --write | Yes - verify not needed |
| Any types | Manual | Yes - add proper types |
| Console statements | Manual | Yes - keep errors only |
| Non-null assertions | Manual | Yes - add null checks |
Docs/04-DEV-WORKFLOW.md for CI/CD detailsxiaohongshu
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