{"library":"prettier-plugin-sort-imports","title":"prettier-plugin-sort-imports","description":"A Prettier plugin that sorts import statements by line length or alphabetically. Currently at version 1.8.11 with monthly releases. It automatically loads into Prettier, sorting by line length by default. Differentiates itself from alternatives by offering line-length sorting (not just alphabetical) and import-type grouping (NPM vs local, type vs value). Requires TypeScript >4.0.0 as a peer dependency. Supports both Prettier 2 and 3 with separate entry points.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install prettier-plugin-sort-imports"],"cli":null},"imports":["auto-loaded by Prettier; no explicit import needed","sortingMethod: 'lineLength' or 'alphabetical' in Prettier config","importTypeOrder: ['NPMPackages', 'localImports']"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// Install: npm install --save-dev prettier prettier-plugin-sort-imports\n// prettier.config.js\nmodule.exports = {\n  sortingMethod: 'lineLength',\n  importTypeOrder: ['NPMPackages', 'localImports'],\n  plugins: ['./node_modules/prettier-plugin-sort-imports/dist/index.js'],\n};\n\n// Before\nimport z from 'zoo';\nimport a from './local';\nimport b from 'bar';\nimport type { C } from './types';\n\n// After formatting with Prettier\nimport b from 'bar';\nimport z from 'zoo';\nimport a from './local';\nimport type { C } from './types';","lang":"javascript","description":"Demonstrates installation, configuration with import type ordering and line-length sorting, and the resulting import order change.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}