https://github.com/wideplink/eslint-plugin-named-import-spacing
adjust spacing in brackets of named imports
https://github.com/wideplink/eslint-plugin-named-import-spacing
eslint eslint-plugin eslintplugin import lint linting named-imports
Last synced: 5 months ago
JSON representation
adjust spacing in brackets of named imports
- Host: GitHub
- URL: https://github.com/wideplink/eslint-plugin-named-import-spacing
- Owner: Wideplink
- License: mit
- Created: 2022-11-12T09:02:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-14T20:17:46.000Z (over 1 year ago)
- Last Synced: 2025-05-02T00:04:00.373Z (about 1 year ago)
- Topics: eslint, eslint-plugin, eslintplugin, import, lint, linting, named-imports
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/eslint-plugin-named-import-spacing
- Size: 521 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eslint-plugin-named-import-spacing
[](https://npmjs.com/package/eslint-plugin-named-import-spacing)
adjust spacing in brackets of named imports
## Installation
You'll first need to install [ESLint](https://eslint.org/):
```sh
npm i eslint --save-dev
```
Next, install `eslint-plugin-named-import-spacing`:
```sh
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:
```json
{
"plugins": [
"named-import-spacing"
]
}
```
Then configure the rules you want to use under the rules section.
```json
{
"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)
:x: **Incorrect**
```js
import {a, b} from "some-module";
import { a, b} from "some-module";
```
:white_check_mark: **Correct**
```js
import { a, b } from "some-module";
import { a,b } from "some-module";
```
- `"never"`
:x: **Incorrect**
```js
import { a, b } from "some-module";
import {a,b } from "some-module";
```
:white_check_mark: **Correct**
```js
import {a, b} from "some-module";
import {a} from "some-module";
```
> Use [`comma-spacing`](https://eslint.org/docs/latest/rules/comma-spacing) if you want to manage spaces between multiple variables.
Some other rules may be added in the future.