Merge-friendly import formatting (one-per-line, alphabetical). Auto-loads when writing TypeScript/JavaScript imports to minimize merge conflicts in parallel development. Enforces consistent grouping and sorting.
Import formatting and ordering rules to minimize merge conflicts when multiple developers or parallel agents modify the same file.
When importing multiple items from a module, put EACH import on its own line:
// CORRECT - merge-friendly (each on separate line)
import {
alpha,
beta,
gamma,
} from 'some-module';
// WRONG - causes merge conflicts
import { alpha, beta, gamma } from 'some-module';
This is enforced by Prettier with printWidth: 80. With one-per-line, Git can merge imports from parallel changes without conflicts.
import fs from 'fs', import path from 'path')import React from 'react', import express from 'express')import { util } from '@/utils')import { Parent } from '../Parent')import { Sibling } from './Sibling')import { thing } from './index')import type { MyType } from './types')// Node.js built-ins
import fs from 'fs';
import path from 'path';
// External packages
import express from 'express';
import React from 'react';
// Internal aliases
import { config } from '@/config';
import { logger } from '@/utils';
// Parent imports
import { BaseService } from '../BaseService';
// Sibling imports (one per line when multiple)
import {
helperA,
helperB,
helperC,
} from './helpers';
import { utils } from './utils';
// Type imports (one per line when multiple)
import type { Config } from '@/types';
import type {
Request,
Response,
} from 'express';
Sort named exports alphabetically, one per line when multiple:
// CORRECT
export {
alpha,
beta,
gamma,
};
// WRONG
export { gamma, alpha, beta };
Sorted, one-per-line imports reduce merge conflicts because:
These rules are enforced by:
printWidth: 80: Forces line wrapping for multiple importsRun eslint --fix && prettier --write before committing.
// .eslintrc.js or eslint.config.js
module.exports = {
plugins: ['simple-import-sort'],
rules: {
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
},
};
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all"
}
When re-exporting from index files, follow the same one-per-line rule:
// CORRECT
export {
ComponentA,
ComponentB,
ComponentC,
} from './components';
export type {
TypeA,
TypeB,
} from './types';
// WRONG
export { ComponentA, ComponentB, ComponentC } from './components';
Dynamic imports follow the same alphabetical ordering when multiple exist:
// Alphabetical order by module path
const moduleA = await import('./moduleA');
const moduleB = await import('./moduleB');
const utils = await import('./utils');
npx skills add jpoutrin/typescript-import-style下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer