# @unitario/eslint-config

> Standard ESLint configurations for Unitario

Latest version **1.0.8** (published 2020-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @unitario/eslint-config
pnpm add @unitario/eslint-config
yarn add @unitario/eslint-config
bun add @unitario/eslint-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.0.8 |
| Published | 2020-03-22 |
| First published | 2020-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | unitario |
| Maintainers | unitario |
| Keywords | eslint, eslintconfig |

## Links

- npm: https://www.npmjs.com/package/@unitario/eslint-config
- Repository: https://github.com/unitario/eslint-config
- Issues: https://github.com/unitario/eslint-config/issues
- npm.io page: https://npm.io/package/@unitario/eslint-config

## Dependencies (10)

- [eslint-plugin-jest](https://npm.io/package/eslint-plugin-jest.md) ^23.0.3
- [eslint-plugin-ramda](https://npm.io/package/eslint-plugin-ramda.md) ^2.5.1
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.18.2
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^6.5.0
- [eslint-plugin-prettier](https://npm.io/package/eslint-plugin-prettier.md) ^3.1.1
- [@typescript-eslint/parser](https://npm.io/package/@typescript-eslint/parser.md) ^2.6.1
- [eslint-config-airbnb-base](https://npm.io/package/eslint-config-airbnb-base.md) ^14.0.0
- [eslint-plugin-package-json](https://npm.io/package/eslint-plugin-package-json.md) ^0.1.4
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^2.6.1
- [eslint-plugin-simple-import-sort](https://npm.io/package/eslint-plugin-simple-import-sort.md) ^5.0.2

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2020-03-22
- 1.0.7 — 2020-03-22
- 1.0.6 — 2020-03-22
- 1.0.5 — 2020-03-22
- 1.0.4 — 2020-03-22
- 1.0.3 — 2020-03-22
- 1.0.2 — 2020-03-22
- 1.0.1 — 2020-03-22
- 1.0.0 — 2020-03-02

## README

# Unitario ESLint Configuration

The package provides base [ESLint](https://eslint.org) configurations for Unitario. It follows a set of recommended style guidelines for writing code that is more performant and easier to reason about.

This package use [ESLint to run Prettier](https://prettier.io/docs/en/integrating-with-linters.html#use-eslint-to-run-prettier). 

## What it does

- Lints JavaScript or TypeScript based on latest standards
- Follows a [mostly reasonable approach](https://github.com/airbnb/javascript) by Airbnb
- Fixes common code errors and style issues

## Installation

### 1. Install dependencies

#### Development

```
npm install @unitario/eslint-config --save-dev
```

#### Peer

In case peer dependencies has not already been installed, make sure to install these too:

```
npm install eslint prettier --save-dev
```

#### Optional

- **[jest](https://jestjs.io)** – Test framework. _Configuration files has already loaded in this package._
- **[ramda](https://ramdajs.com)** – Functional utility library. _Configuration files has already loaded in this package._
- **[lint-staged](https://github.com/okonet/lint-staged)** – _Used to enable allow ESLint to run on staged files._
- **[husky](https://github.com/typicode/husky)** – _Used to enable allow ESLint to run on staged files._

Use them if you project requires it. If so then configuration files has already been bundled in this package. Just make sure that they have been installed in your project.

### 2. Create config file

Create an `.eslintrc` file at the root of your project with this content:

```json
{
  "extends": "@unitario"
}
```

## Rules

### Extends

This configuration package follows a specific list of configuration rules. Each configuration overwrites the previous configuration in the case of conflicting rules.

1. [Airbnb ESLint Base Config](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base) – Base ruleset for JavaScript files
2. [TypeScript ESLint Recommended Config](https://github.com/typescript-eslint/typescript-eslint) – Base ruleset for TypeScript files
2. [Jest ESLint Recommended Config](https://github.com/jest-community/eslint-plugin-jest#readme) – Base ruleset for Jest spec-files
3. [Prettier ESLint Config](https://github.com/prettier/eslint-config-prettier) – Turns off all rules that are unnecessary or might conflict with Prettier

### Enforced Rules

This configuration package makes a couple of opinionated style rules which overwrites any rules provided in the extends array.

- **Print Width.** Line wrap at 160 characters (default is `80`).
- **Tab Width.** Tab with is 2 spaces (default is `4`).
- **Semicolons.** Never print semicolons in end of statements (default is `always`).

### Overriding Rules

If you'd like to override any rules, you can add the rules to your `.eslintrc` file.

```json
{
  "extends": "@unitario",
  "rules": {
    "no-console": "off"
  }
}
```

## Code Editor Integrations

### Visual Studio Code

1. Install the [ESLint Extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
2. Reload Visual Studio Code
3. Modify your `settings.json` file

```json
// Format on save with Prettier
"editor.formatOnSave": true,
"eslint.alwaysShowStatus": true,
// Tell the ESLint plugin to run on save
"eslint.autoFixOnSave": true,
// An array of language identifiers specify the files to be validated
"eslint.validate": [
  { "language": "html", "autoFix": true },
  { "language": "json", "autoFix": true },
  { "language": "javascript", "autoFix": true },
  { "language": "typescript", "autoFix": true }
],
// Turn off Prettier extension for js and ts files since we're handling that with ESLint
"prettier.disableLanguages": ["javascript", "typescript"],
```

## Pre-Commit Hook

You may want ESLint 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. Install dependencies
    - `npm install lint-staged husky --save-dev `
2. Update `package.json`:

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

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