From 9a24163c713af76fc76a9391778cc1666fffb31e Mon Sep 17 00:00:00 2001 From: Ehab Kahwati Date: Fri, 23 Oct 2026 13:52:53 -0700 Subject: [PATCH] docs(code-style): match import organization to eslint config Since #8362 the import-x/order rule keeps all type-only imports in one group between internal and relative imports, but the docs still said they go at the end of each section. Update the list and the example to match what ESLint actually enforces. --- docs/code-style.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/code-style.md b/docs/code-style.md index 0d97135f30fff..3ce70a3ee451f 100644 --- a/docs/code-style.md +++ b/docs/code-style.md @@ -197,21 +197,29 @@ The repository includes a `.vscode` directory with recommended settings that wil ### Import Organization -Organize imports in this order: +Import order is enforced by the `import-x/order` rule in [`eslint.config.js`](../eslint.config.js), so `pnpm lint:fix` will sort your imports for you. Imports are grouped in this order, with an empty line between groups and alphabetical order within each group: 1. Node.js built-in modules -2. External library imports (Including `@node-core/*`) -3. Relative imports (`./*`, `../*`, `#specifier/`) -4. Type-only imports at the end of each given section +2. External library imports (Including `@node-core/*` and `#platform/*`) +3. Internal imports using subpath specifiers (`#site/*`, `#ui/*`) +4. Type-only imports, all together in one group no matter where they are imported from +5. Relative imports (`./*`, `../*`) +6. Relative CSS imports (`./*.css`, `../*.css`) ```tsx import { readFile } from 'node:fs/promises'; import { SomeComponent } from '@node-core/ui-components/Common/SomeComponent'; +import { useTranslations } from 'next-intl'; + +import { BASE_URL } from '#site/next.constants.mjs'; + +import type { MyComponentProps } from './types'; import type { FC } from 'react'; import { myHook } from '../hooks/myHook'; -import type { MyComponentProps } from './types'; + +import styles from './index.module.css'; ``` ## Documentation Standards