---
title: "Only Node.js subpaths with no-restricted-imports and perfectionist/sort-imports"
url: https://daily.dev/posts/only-node-js-subpaths-with-no-restricted-imports-and-perfectionist-sort-imports-bqovdflgq
source_url: https://johnnyreilly.com/only-node-subpaths-with-no-restricted-imports-and-perfectionist-sort-imports
type: article
source: "John Reilly"
published: 2026-03-16T17:43:23.043Z
updated: 2026-03-16T17:43:42.516Z
tags: ["javascript", "nodejs", "typescript"]
reading_time: 4
upvotes: 2
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Only Node.js subpaths with no-restricted-imports and perfectionist/sort-imports

**[John Reilly](https://daily.dev/sources/johnnyreilly)** · 4 min read · 2 upvotes · 0 comments

## Summary

A walkthrough of enforcing Node.js subpath imports as the sole import style in a codebase. It covers setting up subpath mappings in package.json for TypeScript and runtime resolution, using ESLint's no-restricted-imports rule to block relative and alias-style imports, and using the perfectionist/sort-imports rule to keep import groups consistently ordered. The author acknowledges the approach is opinionated and may not suit every team.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://johnnyreilly.com/only-node-subpaths-with-no-restricted-imports-and-perfectionist-sort-imports>

## Similar posts on daily.dev

- [Automatic Import Sorting with ESLint and simple-import-sort](https://daily.dev/posts/automatic-import-sorting-with-eslint-and-simple-import-sort-ren0cfi9e) · Atomic Spin · 0 upvotes · 0 comments
- [ESLint v9.37.0 released](https://daily.dev/posts/eslint-v9-37-0-released-d12isqfub) · ESLint · 2 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#nodejs](https://daily.dev/tags/nodejs), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/only-node-js-subpaths-with-no-restricted-imports-and-perfectionist-sort-imports-bqovdflgq)
