apotheke
v0.1.6
Published
Prettier for imports — deterministic import organization as a Prettier plugin or CLI
Maintainers
Readme
Prettier for imports. You describe the groups your codebase actually has — apotheke sorts every import into them, the same way, in every file. Run it as a Prettier plugin or as a standalone CLI.
// Before
import { useQuery } from '@tanstack/react-query';
import { useMemo } from 'react';
import { createRoute } from '@tanstack/react-router';
import { tsr } from '../api/tsr';
import useLoggedUser from '../hooks/use-logged-user';
// After
// React
import { useMemo } from 'react';
// Hooks
import useLoggedUser from '../hooks/use-logged-user';
// Api
import { tsr } from '../api/tsr';
import { useQuery } from '@tanstack/react-query';
// Navigation
import { createRoute } from '@tanstack/react-router';Note where ../api/tsr and @tanstack/react-query landed: grouping is by
role in your app, not by whether a module is local or comes from
node_modules.
Getting started
pnpm add -D apothekeThe quick start goes from an empty config to organised imports in about two minutes.
Development
This repository is a pnpm workspace. The published package lives in
packages/apotheke, the documentation site in apps/docs.
pnpm install
pnpm build # build the package (required before format and dogfooding)
pnpm test # unit + e2e
pnpm docs:dev # run the documentation site locallyIssues and pull requests are welcome at github.com/mRaffaello/apotheke.
License
MIT © Marco Raffaello
