# altheajs-prettier-config

> A prettier config, what else?

Latest version **1.3.0** (published 2022-01-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install altheajs-prettier-config
pnpm add altheajs-prettier-config
yarn add altheajs-prettier-config
bun add altheajs-prettier-config
```

## 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.3.0 |
| Published | 2022-01-06 |
| First published | 2021-03-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Drew Cook |
| Maintainers | dcodev |
| Keywords | prettier, config |

## Links

- npm: https://www.npmjs.com/package/altheajs-prettier-config
- Repository: https://github.com/drewcook/prettier-config
- Homepage: https://github.com/drewcook/prettier-config#readme
- Issues: https://github.com/drewcook/prettier-config/issues
- npm.io page: https://npm.io/package/altheajs-prettier-config

## Dependencies (1)

- [prettier](https://npm.io/package/prettier.md) 2.5.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2022-01-06
- 1.2.0 — 2021-07-14
- 1.1.4 — 2021-04-08
- 1.1.3 — 2021-04-08
- 1.1.2 — 2021-04-08
- 1.1.1 — 2021-03-27
- 1.1.0 — 2021-03-27
- 1.0.0 — 2021-03-27

## README

# altheajs-prettier-config

Althea Web Service's [`prettier`](https://prettier.io) configuration.

View this package on NPM: [click here](https://www.npmjs.com/package/altheajs-prettier-config)

## Installation

### npm

```sh
npm install --save-dev altheajs-prettier-config
```

If you don't have it installed already, also install `prettier` as a devDependency.

```sh
npm install --save-dev prettier --save-exact
```

### yarn

```sh
yarn add --dev altheajs-prettier-config prettier
```

## Usage

We export two ESLint configurations for your usage:

1. AWS Default
2. Prettier's Default

### AWS Default Config

The simplest way to install and use the default config is to reference it directly in your `package.json` file as follows:

```js
{
	// ...package.json
	"prettier": "altheajs-prettier-config"
}
```

If you'd like to extend the configurations, create a `.prettierrc.js` file at the root of your project that contains:

```js
module.exports = {
	...require("altheajs-prettier-config"),
	semi: true,
};
```

### Prettier's Default Config

If you prefer to use Prettier's defaults, you can access it via `"altheajs-prettier-config/default"`. Just use it as a reference to what package to extend from or point to, as used in the above two examples.

````

## NPM Scripts Command

You can add in an npm script to your `package.json` which will apply prettier rules across all the file patterns specified. Simply add the following to apply to all files:

```js
	"scripts": {
		// --write will apply the rules
		"lint:prettier": "npx prettier --config ./prettier.config.js **/*.* --write",
		// if you prefer to just check for errors use the --check flag
		"lint:prettiercheck": "npx prettier --config ./prettier.config.js **/*.* --check"
	}
````

## Pre-commit Hook

As another line of defense, if you want Prettier to automatically fix your errors on commit, you can use [`lint-staged`](https://github.com/okonet/lint-staged) with [`husky`](https://github.com/typicode/husky), which manages git hooks.

1. `npm install --save-dev lint-staged husky`
2. Update your `package.json` like this:

```js
{
	"lint-staged": {
		"*.{js,css,json,md}": ["prettier --write", "git add"]
	},
	"husky": {
		"hooks": {
			"pre-commit": "lint-staged"
		}
	}
}
```

If you already have `lint-staged` running [ESLint](https://github.com/eslint/eslint), just add the prettier step on top of it:

```js
{
	"lint-staged": {
		"*.{js,css,json,md}": ["prettier --write", "git add"],
		"*.js": ["eslint --fix", "git add"]
	},
	"husky": {
		"hooks": {
			"pre-commit": "lint-staged"
		}
	}
}
```

## [Editor Integration](https://prettier.io/docs/en/editors.html)

### Visual Studio Code

1. Install Prettier extension: `View → Extensions` then find and install Prettier - Code formatter
2. Reload the editor
3. In your user settings `Code -> Preferences -> Settings` add `editor.formatOnSave: true`

### Sublime Text 3

[https://packagecontrol.io/packages/JsPrettier](https://packagecontrol.io/packages/JsPrettier)

### Atom

[https://atom.io/packages/prettier-atom](https://atom.io/packages/prettier-atom)

## Enforced Rules

Check out all of Prettier's [configuration options](https://prettier.io/docs/en/options.html).

- **Print Width**

  Line wrap at 100 characters.

- **Tab Width**

  2 spaces per indentation-level.

- **Tabs**

  Indent lines with tabs, not spaces.

- **Semicolons**

  Always print semicolons at the ends of statements.

  ```js
  const greeting = "hi";
  ```

- **Quote**

  Use single quotes instead of double quotes.

  ```js
  const quote = "single quotes are better";
  ```

- **Trailing Commas**

  Use trailing commas wherever possible.

  ```js
  const obj = {
  	a: "hi",
  	b: "hey",
  };
  ```

- **Bracket Spacing**

  Print spaces between brackets in object literals.

  ```js
  {
  	foo: bar;
  }
  ```

- **JSX Brackets**

  Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line (does not apply to self closing elements).

  ```jsx
  <button
  	className="prettier-class"
  	id="prettier-id"
  	onClick={this.handleClick}
  >
  	Click Here
  </button>
  ```

- **Arrow Function Parentheses**

  Omit parens when possible.

  ```js
  (x) => x;
  ```

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