Skip to content

docs(code-style): match import organization to eslint config - #9238

Open
Devehab wants to merge 1 commit into
nodejs:mainfrom
Devehab:fix/9225-import-order-docs
Open

Devehab wants to merge 1 commit into
nodejs:mainfrom
Devehab:fix/9225-import-order-docs

Conversation

@Devehab

@Devehab Devehab commented Oct 27, 2026

Copy link
Copy Markdown

Description

The Import Organization section in docs/code-style.md says type-only imports go at the end of each section, but since #8362 the import-x/order rule puts all of them in one group, between internal (#site/*) imports and relative ones. So the example in the docs actually fails lint.

I updated the list and the example to match what ESLint enforces, added the #site/* and CSS groups to the example since they're part of the order too, and mentioned that pnpm lint:fix sorts imports for you. Two details I checked against real files: #platform/* sorts with the external imports, and only relative CSS imports get pinned after the relative group (CSS imported through #ui/* stays with the internal imports).

Validation

  • I dropped the old docs example into a real file under apps/site/components/ and ran ESLint with the site config: 3 import-x/order errors. The new example passes with none.
  • I took the same imports laid out the old way (types at the end of each section) and ran eslint --fix on them. The result comes out in the same order as the new example.
  • pnpm format runs clean with no changes.

Related Issues

Fixes #9225

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

I didn't run pnpm test or pnpm build since this only changes a markdown file in docs/.

Since nodejs#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.
@Devehab
Devehab requested review from a team as code owners October 27, 2026 02:33
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nodejs-org Ready Ready Preview Oct 27, 2026 2:34am UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 9a24163c Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESLint import-x/order config doesn't match documented import organization

1 participant