New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

import-sort-style-module-grouping

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

import-sort-style-module-grouping

A style for import-sort that is focused on grouping modules.

  • 0.2.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43
decreased by-24.56%
Maintainers
1
Weekly downloads
 
Created
Source

import-sort-style-module-grouping

A style for import-sort that is focused on grouping modules.

Grouping Rules:

Running this package will groups the es6 imports based on the following order:

  • Absolute javascript (.js, .jsx, .es6, .es) modules, not type imports
  • Absolute typescript (.ts, .tsx) modules, not type imports
  • Absolute styles (.css, .scss, .less) modules, not type imports
  • Absolute any other type of modules, not type imports
  • Absolute type imports (import type ... from '...';)
  • Relative javascript (.js, .jsx, .es6, .es) modules, not type imports
  • Relative typescript (.ts, .tsx) modules, not type imports
  • Relative styles (.css, .scss, .less) modules, not type imports
  • Relative any other type of modules, not type imports
  • Relative type imports (import type ... from '...';)

Install

yarn add import-sort-cli import-sort-parser-babylon import-sort-style-module-grouping --dev
OR
npm install import-sort-cli import-sort-parser-babylon import-sort-style-module-grouping --save-dev

#Config Add the following configuration to package.json

  "importSort": {
    ".js, .jsx, .es6, .es": {
      "parser": "babylon",
      "style": "module-grouping"
    },
    ".ts, .tsx": {
      "parser": "typescript",
      "style": "module-grouping"
    }
  }

#Usage ##Command Line (import-sort-cli)

Running the following command will display the result of changes after sorting ES2015 imports:

import-sort **/*.js

Use --write to update files in-place

import-sort **/*.js --write

For more command line options click here.

##Node.js (import-sort) Click here for using import-sort-style-module-grouping and import-sort in node.js

##Sample project https://github.com/NShahri/import-sort-style-module-grouping/tree/master/packages/sample

##TODO

  • make grouping rules configurable

Keywords

FAQs

Package last updated on 23 Jan 2019

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