{"library":"prettier-plugin-shorten-imports","title":"prettier-plugin-shorten-imports","description":"Prettier plugin that rewrites local import and export specifiers to the shortest path depth based on tsconfig.json or jsconfig.json paths mappings. Version 0.0.3, released early 2023, with no further updates since. Supports .js, .jsx, .ts, .tsx, and .vue files, preserving file extensions and normalizing to POSIX separators. It compares relative paths and path aliases, keeping the shortest depth, and skips specifiers resolving to node_modules or outside the project root. Differentiators: integrates with Prettier formatting, avoids long relative paths, respects existing TypeScript/JavaScript path aliases, and merges paths from extended tsconfig chains.","language":"javascript","status":"active","last_verified":"Mon Apr 27","install":{"commands":["npm install prettier-plugin-shorten-imports"],"cli":null},"imports":["import plugin from 'prettier-plugin-shorten-imports'","plugins: ['prettier-plugin-shorten-imports']","prettier --plugin=prettier-plugin-shorten-imports --write 'src/**/*.ts'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"npm install --save-dev prettier prettier-plugin-shorten-imports typescript\necho '{\n  \"compilerOptions\": {\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"@app/*\": [\"src/*\"]\n    }\n  }\n}' > tsconfig.json\nmkdir -p src/utils\necho 'export const formatName = (name: string) => name.toUpperCase();' > src/utils/format.ts\necho \"import { formatName } from '../../utils/format';\" > src/index.ts\nnpx prettier --plugin=prettier-plugin-shorten-imports --write src/index.ts\ncat src/index.ts","lang":"typescript","description":"Set up a tsconfig alias, create a file with a long relative import, and run Prettier to shorten it.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}