John Reilly
Read post

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

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.

    #javascript#nodejs#typescript
Mar 16•4m read time•From johnnyreilly.com
Post cover image
Table of contents
First a warning ​Node.js subpaths only ​Block alternatives with no-restricted-imports ​Keep import groups predictable with perfectionist/sort-imports ​Does this work with TypeScript? ​Is this actually a good idea? ​Conclusion ​
5.8K Impressions
John Reilly's image
John Reilly

Johnny Reilly is a software engineer, blogger, and technology enthusiast known for his insights into...

23 Followers

•

278 Upvotes

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard