npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@devim-front/prettier-plugin-group-imports

v1.0.2

Published

Provides a concise way to organize imports in your code.

Downloads

7

Readme

Devim Front: Prettier Plugin Group Imports

Provides a concise way to organize imports in your code.

While this is not recommended, it is also a common practice that you or your organization can ask for

This plugin is mainly designed for internal use at Devim but you are free to use it and/or contribute

Installation

Using NPM:

npm i --save-dev @devim-front/prettier-plugin-group-imports

Using Yarn:

yarn add -D @devim-front/prettier-plugin-group-imports

Add it to your .prettierrc:

"plugins": ["./node_modules/@devim-front/prettier-plugin-group-imports"]

Configuration

All configuration is stored in .prettierrc file. You can configure it as you like. All parameters are optional

Resolver

Resolver checks for local imports using its contained API. There are two:

[default] Package Resolver

Checks if import location starts with one of dependencies listed in package.json. Your package.json must exist and be accesible to the plugin

"resolver": {
  "type": "package"
}

Filesystem resolver (slow)

Automatically resolves your import location using tsconfig.json' baseUrl and paths to absolute and check if this file exists.

You can also specify custom name for your tsconfig file to search

"resolver": {
  "type": "fs",
  "configName": "tsconfig.json"
}

Parser options


importCommentMode

Sets how imports are moved within the source code. Specifically: which comment sections are considered relative to the provided import statement

Default value

prev-line

Available values

prev-line - Comment that is located no further than 1 line upwards is considered relative to the import

same-line Comment that is located on the same line as an import is considered relative default prev-line

none Comments will persist their initial place


importLocation

Sets the location where are you imports will be inserted to

Default value

auto

Available values

leading - Imports will be placed starting from the first line of the source code

auto - Imports will be placed starting from the position of the first import encountered in your source code


Groups

You can specify sorting groups with separate internal sorting algorithms. First parameter of the tuple is one of each sorting groups (global, local, relative, static or rest). If import node does not fit any of listed groups it will fall to the 'rest' group. Second parameter represent the sorting algorithm that is used within this specific group

Available groups

global, local, relative, static, rest

Available algorithms

natural - Uses natural sort

persist - Persists original order from the source code

Default value

[
  ['global','persist'],
  ['local','persist'],
  ['relative','persist'],
  ['static','persist'],
  ['rest','persist']
]

splitRelativeGroups

Splits group of relative imports to subgroups based on their deepness (true/false)

Default value

true


relativeSortAlg

Sets algorithm that is used to sort relative groups based on their deepness

Available values

shallow-first - Nearest relative imports will be put first

deepest-first - Deepest relative imports will be put first

Default value

deepest-first


License

MIT