Skip to content
PluginStats

prettier-plugin-import-sections weekly downloads statistics

By pozib-hub · npm · Prettier plugins

Prettier plugin for automatic import sorting by sections (Api, Components, Constants, Helpers, Hooks, Types, Styles)

View on npm Fresh · Dec 6, 2026

prettier-plugin-import-sections has 6 recorded weekly downloads on npm, a decrease of 25.0% over the past 30 days, ranking #3203 of 3,247 tracked listings.

Weekly downloads
6
Official API · Dec 5, 2026
7-day growth
0.0%
0 weekly downloads
30-day growth
-25.0%
-2 weekly downloads
90-day growth
-96.1%
-146 weekly downloads
Rank
#3203
▼ 141 in 7 days

About prettier-plugin-import-sections

prettier-plugin-import-sections

Prettier-плагин для автоматической сортировки импортов по секциям.

Плагин переиспользуемый — не содержит проект-специфичных хардкодов. Все настройки проекта задаются через .prettierrc или внешний конфиг-файл.

Быстрый старт

1. Установка
npm install --save-dev commission-prettier-plugin-import-sections prettier
2. Подключение в .prettierrc
{
  "plugins": ["commission-prettier-plugin-import-sections"],
  "importSectionsConfig": {
    "componentHocs": ["typedMemo", "styled", "observer", "connect", "translate"],
    "constantPrefixes": ["INITIAL_", "DEFAULT_", "TIME_", "TOOLBAR_"],
    "constantSuffixes": ["_ROLES", "_ROUTES", "_COLUMNS", "_CONSTANTS", "_ALLOW_ROLES"],
    "componentSuffixes": ["Page", "Modal", "Table", "Form", "Provider", "Context", "Button", "Input", "Field", "Card", "Section", "List", "Component"],
    "helperFilenames": ["utils", "helpers", "util", "helper", "config", "setup"],
    "knownTypeNames": ["Dispatch", "SetStateAction", "ReactNode", "ReactElement"]
  }
}
2. Использование
# Prettier автоматически сортирует импорты при форматировании
npx prettier --write src/

# Или через npm-скрипт
npm run prettify

# CLI напрямую
npx sort-imports

# Dry-run (показать что изменится)
npx sort-imports --dry-run

# Конкретный файл
npx sort-imports src/uikit/Tooltip/Tooltip.tsx

Секции импортов

Импорты сортируются в следующем порядке:

//Api           — данные и запросы к бэкенду
//Components    — React-компоненты и UI-библиотеки
//Constants     — статические значения, конфиги
//Helpers       — утилиты и вспомогательные функции
//Hooks         — React-хуки, react-hook-form, react-router
//Types         — import type
//Styles        — classnames/bind + SCSS-модуль (всегда последние)
Пример
//Api
import { useFetchCalcRulesParams } from 'api/points/universal/calcRules';

//Components
import { Button } from '@beeline/design-system-react';
import { SearchField } from 'uikit/SearchField';

//Constants
import { Icons } from 'shared/constants/icons';

//Helpers
import { clearFalsyProps } from 'shared/helpers/clearFalsyProps/clearFalsyProps';

//Hooks
import { useCallback, useState } from 'react';
import { useForm } from 'react-hook-form';

//Types
import type { ITableRow } from './types';

//Styles
import 'react-datepicker/dist/react-datepicker.css';
import cn from 'classnames/bind';
import styles from './index.module.scss';
const cx = cn.bind(styles);

Конфигурация (importSectionsConfig)

Все проект-специфичные настройки задаются через importSectionsConfig в .prettierrc:

КлючТипОписание
sectionOrderstring[]Порядок секций (переупорядочивает дефолт)
sectionAliasesobjectПереименование секций ({"Api": "Backend"})
extraSectionsobjectДополнительные секции с path-based правилами
defaultSectionstringДефолтная секция если ничего не совпало
componentHocsstring[]HOC-обёртки компонентов (typedMemo, styled, observer...)
constantPrefixesstring[]Префиксы констант (INITIAL_, DEFAULT_, TIME_...)
constantSuffixesstring[]Суффиксы констант (_ROLES, _COLUMNS, _CONSTANTS...)
componentSuffixesstring[]Суффиксы компонентов (Page, Modal, Table, Form...)
helperFilenamesstring[]Имена файлов-утилит (utils, helpers, config...)
knownTypeNamesstring[]Дополнительные имена типов (merges с автодетектом)
projectAliasesobjectАлиасы проекта (перезаписывает автодетект из tsconfig)
apiPathsstring[]Пути для секции Api
helperPathsstring[]Пути для секции Helpers
componentPathsstring[]Пути для секции Components
constantsPathsstring[]Пути для секции Constants
uiLibrariesstring[]npm UI-библиотеки
helperLibrariesstring[]npm утилиты
Автодетект

Плагин автоматически определяет:

  • PROJECT_ALIASES — из tsconfig.json compilerOptions.paths + сканирование src/
  • API_PATHS, HELPER_PATHS, COMPONENT_PATHS, CONSTANTS_PATHS — по структуре src/ директорий
  • UI_LIBRARIES, HELPER_LIBRARIES — из package.json dependencies (react-* → UI, остальные → helpers)
  • KNOWN_TYPE_NAMES — из @types/react, react-query, react-hook-form

Если значение задано в importSectionsConfig, оно merges с автодетектом (для knownTypeNames) или перезаписывает его (для остальных).

Конфигурируемые секции
Переименование секций
"sectionAliases": {
  "Api": "Backend",
  "Hooks": "React Hooks",
  "Styles": "CSS"
}

Результат:

//Backend
import { useFetchData } from 'api/points/data';

//React Hooks
import { useCallback } from 'react';

//CSS
import cn from 'classnames/bind';
Порядок секций
"sectionOrder": ["Hooks", "Api", "Components", "Constants", "Helpers", "Types"]
Дополнительные секции

Можно добавить свои секции с path-based правилами:

"extraSections": {
  "Redux": {
    "paths": ["store/", "redux/"],
    "comment": "Redux"
  },
  "i18n": {
    "paths": ["locales/", "i18n/"],
    "comment": "i18n"
  }
}

Импорты из указанных путей попадут в новую секцию.

Дефолтная секция
"defaultSection": "Other"

Импорты, которые не совпали ни с одним правилом, попадут в указанную секцию.

Внешний конфиг-файл

Можно вынести конфиг в отдельный файл:

// .prettierrc
{
  "plugins": ["commission-prettier-plugin-import-sections"],
  "importSectionsConfig": "./import-sections.config.json"
}
// import-sections.config.json
{
  "componentHocs": ["typedMemo", "styled"],
  "constantPrefixes": ["INITIAL_"]
}

Определение секции

Скрипт определяет секцию импорта по правилам (приоритет сверху вниз):

1. Явные указатели…

Description from the npm listing.

  • prettier
  • prettier-plugin
  • import-sorting
  • import-sections
  • import-order
  • code-formatting
  • react
  • typescript
  • eslint-plugin-import

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

prettier-plugin-import-sections weekly downloads on npm, last 90 days: 6 weekly downloads as of Dec 5, 2026, -96.1% over 90 days.prettier-plugin-import-sectionsWeekly downloads on npm · Last 90 days6downloads / week-96.1% over 90 days05101520Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
prettier-plugin-import-sections weekly downloads on npm, last 90 days: 6 weekly downloads as of Dec 5, 2026, -96.1% over 90 days.

7/30/90-day growth

prettier-plugin-import-sections weekly downloads growth on npm: 0.0% over 7 days, -25.0% over 30 days, -96.1% over 90 days.prettier-plugin-import-sectionsWeekly downloads growth on npm6downloads / week now7-day growth+0 weekly downloads0.0%30-day growth-2 weekly downloads-25.0%90-day growth-146 weekly downloads-96.1%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
prettier-plugin-import-sections weekly downloads growth on npm: 0.0% over 7 days, -25.0% over 30 days, -96.1% over 90 days.

Ranking history

prettier-plugin-import-sections npm ranking history: currently #3203 (by weekly downloads).prettier-plugin-import-sectionsnpm ranking · by weekly downloads · Last 90 days#3203current rank#2000#2200#2400#2600#2800#3000#3200#3400Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 41 observations · Updated Dec 5, 2026pluginstats.com
prettier-plugin-import-sections npm ranking history: currently #3203 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 161, #5 (overall #3,205)
All npm: every listing in weekly downloads order

Listing placement

Prettier plugins267 listings · 14 pages · page 13, #11 (overall #251)
Prettier plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for prettier-plugin-import-sections
Date (UTC)Weekly downloadsChange vs. previous
6-1
7-1
8+2
6+2
40
40
4-2
6+1
5+1
40
4-2
60
6+1
5—

Similar npm Prettier plugins plugins

All 20 prettier-plugin-import-sections alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/prettier-plugin-import-sections. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.