xiaohongshu
xiaohongshu
eslint-flat-config
ESLint 9.x flat configuration patterns. Use when setting up ESLint with TypeScript.
Full skill instructions
This skill covers ESLint 9.x flat configuration for TypeScript projects.
Use this skill when:
FLAT CONFIG IS THE FUTURE - ESLint 9.x uses flat config (eslint.config.ts) by default.
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import type { Linter } from 'eslint';
const config: Linter.Config[] = [
// Ignore patterns
{
ignores: ['dist/**', 'node_modules/**', 'coverage/**'],
},
// Base JavaScript rules
js.configs.recommended,
// TypeScript strict rules
...tseslint.configs.strictTypeChecked,
// Custom rules for TypeScript files
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// Type safety
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unsafe-assignment': 'error',
'@typescript-eslint/no-unsafe-member-access': 'error',
'@typescript-eslint/no-unsafe-call': 'error',
'@typescript-eslint/no-unsafe-return': 'error',
'@typescript-eslint/no-unsafe-argument': 'error',
// Code quality
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
// Strict boolean expressions
'@typescript-eslint/strict-boolean-expressions': 'error',
// No floating promises
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
},
},
];
export default config;
npm install -D eslint @eslint/js typescript-eslint
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix ."
}
}
// @typescript-eslint/no-explicit-any: 'error'
// ❌ Bad
function process(data: any) { }
// ✅ Good
function process(data: unknown) { }
// @typescript-eslint/explicit-function-return-type: 'error'
// ❌ Bad
function add(a: number, b: number) {
return a + b;
}
// ✅ Good
function add(a: number, b: number): number {
return a + b;
}
// @typescript-eslint/strict-boolean-expressions: 'error'
// ❌ Bad
if (value) { }
// ✅ Good
if (value !== undefined && value !== null) { }
if (typeof value === 'string' && value.length > 0) { }
// @typescript-eslint/no-floating-promises: 'error'
// ❌ Bad - Promise ignored
fetchData();
// ✅ Good - Promise handled
await fetchData();
// or
fetchData().catch(handleError);
// or
void fetchData(); // Explicitly ignored
// @typescript-eslint/no-misused-promises: 'error'
// ❌ Bad - async function in non-async context
const handlers = {
onClick: async () => { }, // Error in some contexts
};
// ✅ Good - wrap in non-async handler
const handlers = {
onClick: () => {
void handleClick();
},
};
npm install -D eslint-config-prettier
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
const config = [
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
prettier, // Must be last to override other formatting rules
{
// Custom rules...
},
];
export default config;
const config = [
// All TypeScript files
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'error',
},
},
// Test files - relaxed rules
{
files: ['**/*.test.ts', '**/*.test.tsx', '**/__tests__/**'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
},
},
// Config files - CommonJS allowed
{
files: ['*.config.js', '*.config.cjs'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
];
{
rules: {
'@typescript-eslint/naming-convention': [
'error',
// Variables: camelCase
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
},
// Types: PascalCase
{
selector: 'typeLike',
format: ['PascalCase'],
},
// Interfaces: PascalCase, no I prefix
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: false,
},
},
// Private members: underscore prefix
{
selector: 'memberLike',
modifiers: ['private'],
format: ['camelCase'],
leadingUnderscore: 'require',
},
],
},
}
npm install -D eslint-plugin-import
import importPlugin from 'eslint-plugin-import';
const config = [
{
plugins: {
import: importPlugin,
},
rules: {
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
],
'newlines-between': 'always',
alphabetize: { order: 'asc' },
},
],
'import/no-duplicates': 'error',
},
},
];
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-explicit-any": "error"
}
}
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
export default [
js.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
'@typescript-eslint/no-explicit-any': 'error',
},
},
];
// Ensure tsconfigRootDir is set
{
languageOptions: {
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: import.meta.dirname,
},
},
}
# Ensure all plugins are installed
npm install -D @eslint/js typescript-eslint
// Check ignores pattern
{
ignores: ['dist/**', 'node_modules/**'],
}
// Ensure files pattern includes your files
{
files: ['**/*.ts', '**/*.tsx'],
}
{
"eslint.useFlatConfig": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
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