# esformatter-only-return

> If return is the only statement in the block remove line breaks above it

Latest version **1.0.1** (published 2016-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install esformatter-only-return
pnpm add esformatter-only-return
yarn add esformatter-only-return
bun add esformatter-only-return
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-08-22 |
| First published | 2016-08-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Prasad Thondamuthur Vasanth |
| Maintainers | iamprasad88 |
| Keywords | esformatter, expressions, expression, multiline |

## Links

- npm: https://www.npmjs.com/package/esformatter-only-return
- Repository: https://github.com/iamprasad88/esformatter-only-return
- Homepage: https://github.com/iamprasad88/esformatter-only-return#readme
- Issues: https://github.com/iamprasad88/esformatter-only-return/issues
- npm.io page: https://npm.io/package/esformatter-only-return

## Dependencies (1)

- [rocambole-token](https://npm.io/package/rocambole-token.md) ^1.2.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-08-22
- 1.0.0 — 2016-08-19

## README

# [esformatter](https://github.com/millermedeiros/esformatter)-only-return

> esformatter plugin for removing empty space between return statement and begining of block **if return statement is the only statement in the block**


Turn this:
```js
if (some_condition...) {


return (value);



}
```

into:
```js
if (some_condition...) {
  return (value);
}
```


## Goals

- Focus on making return only blocks consise
- Do not force multilines and indentations, _let this be expressed through config params_


## Installation

```sh
$ npm install esformatter-only-return --save-dev
```


## Config

```json
{
  "plugins": [
    "esformatter-only-return"
  ]
}
```
This plugin will only come into picture after esformatter has worked on the code. So if you want to keep/remove a newline you can make use of config params for that
e.g.

If you want to keep a newline before Return, add this to your config
```json
"lineBreak": {
  "before": {
    "ReturnStatement": 1
  }
}
```

If you want to add a newline after return statement, you can add this to the config file (this is the default value)

```json
"lineBreak": {
  "before": {
    "BlockStatementClosingBrace": ">=1"
  }
}
```

or (if you need to change the above default value for some reason)

```json
"lineBreak": {
  "after": {
    "ReturnStatement": ">=1"
  }
}
```

---
_Source: https://npm.io/package/esformatter-only-return · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
