Socket
Socket
Sign inDemoInstall

@ianvs/prettier-plugin-sort-imports

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ianvs/prettier-plugin-sort-imports

A prettier plugins to sort imports in provided RegEx order


Version published
Weekly downloads
464K
increased by3.92%
Maintainers
1
Weekly downloads
 
Created

What is @ianvs/prettier-plugin-sort-imports?

@ianvs/prettier-plugin-sort-imports is a Prettier plugin that automatically sorts your import statements in a consistent and customizable manner. It helps maintain a clean and organized codebase by ensuring that import statements are ordered logically and consistently across your project.

What are @ianvs/prettier-plugin-sort-imports's main functionalities?

Basic Import Sorting

This feature sorts import statements alphabetically by default, making it easier to find and manage dependencies.

import z from 'z';
import a from 'a';
import b from 'b';

// After running Prettier with the plugin
import a from 'a';
import b from 'b';
import z from 'z';

Grouping Imports

This feature allows you to group imports by type, such as external libraries, internal modules, and side-effect imports, improving the readability of your import statements.

import React from 'react';
import { useState } from 'react';
import _ from 'lodash';
import { Button } from '@material-ui/core';

// After running Prettier with the plugin
import React from 'react';
import { useState } from 'react';

import { Button } from '@material-ui/core';

import _ from 'lodash';

Custom Sorting Order

This feature allows you to define a custom sorting order for your imports using regular expressions, giving you full control over how your imports are organized.

import z from 'z';
import a from 'a';
import b from 'b';

// .prettierrc configuration
{
  "importOrder": ["^react", "^@material-ui", "^[a-z]", "^[A-Z]", "^\.\./", "^\./"]
}

// After running Prettier with the plugin
import a from 'a';
import b from 'b';
import z from 'z';

Other packages similar to @ianvs/prettier-plugin-sort-imports

Keywords

FAQs

Package last updated on 12 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc