New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

import-sorter

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

import-sorter

An opinionated ES6 and TypeScript import sorter.

latest
Source
npmnpm
Version
1.0.0-alpha.6
Version published
Weekly downloads
4
100%
Maintainers
2
Weekly downloads
 
Created
Source

Import sorter

An opinionated ES6 and TypeScript import sorter.

TODO:

Ts config json

  • Should we include dom in lib?

Docs

  • write a dev guide how to develop:
  • yarn install
  • yarn watch (will block one terminal tab)
  • whenever you make a change, it will automatically be picked up by tsc
  • Quick and dirty way to run cli version: ./node_modules/.bin/ts-node ./bin/index.js
  • yarn build:prod for a production build
  • To test the newest library (not yet published) in another project, do yarn link. Then, in the other project run yarn link import-sorter. After this, you will be able to
import { sortImports } from 'import-sorter';
const result = sortImports(...);

After testing, make sure to unlink import-sorter, by navigating to it and yarn unlink

Debugging the CLI

  • Temporarly add a call to cliSort function in src/cli/index.ts with a desired configuration, i.e.:
cliSort({
  content: '',
  dryRun: true,
  verbose: true
});

Note - in this way, the configuration binding is being skipped, and it can't be relied on the default value. Thus, all desired configuration value have to be explicitly specified.

  • Use the VSCode's launch.json and launch the Launch Program configuration

Future

  • An option to specify a path or a file(s) in which to sort imports. If no option is specified, run on all files.
    • Maybe use this: https://nodejs.org/api/path.html#path_path_isabsolute_path
    • We can maybe use one files argument, which can be an array of either directories or files. If it's a file, run the lib on it. If it's a directory, run the lib on the files inside it. Optionally, if recursive flag is up, continue to iterate through directories recursevly

Keywords

imports

FAQs

Package last updated on 06 Nov 2018

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