Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-align-import

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-align-import

Babel plugin to align your import statements.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2.2K
decreased by-1.64%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-align-import

Build Status Download count Current version Support me

What is this?

This plugin / rule will align all your import statements:

from

import defaultExport from "module-name";
import * as name  from "module-name";
import { export1 } from "module-name";
import { export2 as alias1 } from "module-name";
import { export3 , export4 } from "module-name";
import { foo , bar } from "module-name/path/to/specific/un-exported/file";
import { export5 , export6 as alias7 } from "module-name";
import defaultExport2, { export8 } from "module-name";
import defaultExport3, * as name2 from "module-name";

to

import defaultExport                   from "module-name";
import * as name                       from "module-name";
import { export1 }                     from "module-name";
import { export2 as alias1 }           from "module-name";
import { export3 , export4 }           from "module-name";
import { foo , bar }                   from "module-name/path/to/specific/un-exported/file";
import { export5 , export6 as alias7 } from "module-name";
import defaultExport2, { export8 }     from "module-name";
import defaultExport3, * as name2      from "module-name";

Installation

You'll first need to install ESLint:

$ npm install eslint --save-dev

Next, install eslint-plugin-align-import:

$ npm install eslint-plugin-align-import --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-align-import globally.

Usage

Add babel-align-import to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "babel-align-import"
    ]
}

You might have to update the no-multi-spaces rule to allow multiple spaces in front of import:

{
    "rules": {
        "no-multi-spaces": ["error", {"exceptions": {"ImportDeclaration": true}}]
    }
}

There are two rules available:

ruledescription
align-import/align-importAligns your import statements, this is probably the rule you're looking for.
align-import/trim-importThis rule will remove any extra space around your import keyword.

Keywords

FAQs

Package last updated on 20 May 2020

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