eslint-plugin-named-import-spacing

1.0.3 • Public • Published

eslint-plugin-named-import-spacing

npm

adjust spacing in brackets of named imports

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-named-import-spacing:

npm install eslint-plugin-named-import-spacing --save-dev

Usage

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

{
    "plugins": [
        "named-import-spacing"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "named-import-spacing/named-import-spacing": 2
    }
}

Supported Rules

named-import-spacing

Format spaces in named import statements

Options

This rule receives one argument. If the argument is "always" then variables require spaces before and after it. If "never" then no space is allowed either before or after.

  • "always" (default)
    Incorrect
    import {a, b} from "some-module";
    import { a, b} from "some-module";
    Correct
    import { a, b } from "some-module";
    import { a,b } from "some-module";
  • "never"
    Incorrect
    import { a, b } from "some-module";
    import {a,b } from "some-module";
    Correct
    import {a, b} from "some-module";
    import {a} from "some-module";

Use comma-spacing if you want to manage spaces between multiple variables.

Some other rules may be added in the future.

Package Sidebar

Install

npm i eslint-plugin-named-import-spacing

Weekly Downloads

177

Version

1.0.3

License

MIT

Unpacked Size

8.31 kB

Total Files

6

Last publish

Collaborators

  • mtripg6666tdr