# parindent

> __[Try it online](https://shaunlebron.github.io/parindent/)__

Latest version **0.2.0** (published 2018-12-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install parindent
pnpm add parindent
yarn add parindent
bun add parindent
```

Provides the command `parindent`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2018-12-17 |
| First published | 2018-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 20.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shaun Lebron |
| Maintainers | shaunlebron |

## Links

- npm: https://www.npmjs.com/package/parindent
- npm.io page: https://npm.io/package/parindent

## Dependencies (6)

- [esm](https://npm.io/package/esm.md) ^3.0.84
- [glob](https://npm.io/package/glob.md) ^7.1.3
- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [readline](https://npm.io/package/readline.md) ^1.3.0
- [get-stdin](https://npm.io/package/get-stdin.md) ^6.0.0

## Recent versions

- 0.2.0 (latest) — 2018-12-17
- 0.1.0 — 2018-12-15

## README

# Parindent

__[Try it online](https://shaunlebron.github.io/parindent/)__

**WIP public prototype**— Indent Clojure files based on the following discussions:

- [Daniel Compton's call for a "no config" clojure formatter](https://clojureverse.org/t/clj-commons-building-a-formatter-like-gofmt-for-clojure/3240)
- [Nikita Prokopov's proposed simple rules](http://tonsky.me/blog/clojurefmt/)
- [discussion on indentation rules](https://github.com/clj-commons/formatter/issues/9)

## Current Rules

1. ALLOW - 1-space, 2-space, or Arg-alignment (user preference determined by first sibling line)
2. ENFORCE - vertically aligned sibling lines
3. ENFORCE - indentation after a paren should imply containment

## Friction

Staggered indentation of siblings not allowed:

```diff
 (cond
   foo
-    bar
+  bar

   baz
-    qux)
+    qux)
```

Cannot indent past an open-paren unless contained inside it ([Parinfer]):

[Parinfer]:http://shaunlebron.github.io/parinfer

```diff
 (defn foo
  ([a b]
-    (+ a b))
+  (+ a b))
  ([a b c]
-    (+ a b c)))
+  (+ a b c)))
```


## Install

```
npm install -g parindent
```

## Try it

To indent all your files **in place**, run from your project root:

```
parindent '**/*.{clj,cljs,cljc}' --write
```

## Usage

```
$ parindent

Usage: parindent [opts] [filename ...]

A minimal indenter for Lisp code (e.g. Clojure)

Available options:
  --write                  Edit the file in-place. (Beware!)
  --list-different or -l   Print filenames of files that are different from Parindent formatting.
  --stdin                  Read input from stdin.
  --version or -v          Print Parindent version.

```

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