# @trove/eslint-plugin-trove

> Trove eslint rules

Latest version **1.3.2** (published 2018-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @trove/eslint-plugin-trove
pnpm add @trove/eslint-plugin-trove
yarn add @trove/eslint-plugin-trove
bun add @trove/eslint-plugin-trove
```

## 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.2 |
| Published | 2018-05-24 |
| First published | 2018-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 43.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Eric Bower |
| Maintainers | adamkempa, akinnee, baldwmic, iankberry, jimbol, tpdietz |
| Keywords | eslint, eslintplugin |

## Links

- npm: https://www.npmjs.com/package/@trove/eslint-plugin-trove
- npm.io page: https://npm.io/package/@trove/eslint-plugin-trove

## Dependencies (1)

- [estree-walk](https://npm.io/package/estree-walk.md) ^2.2.0

## 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
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 1.3.2 (latest) — 2018-05-24
- 1.3.1 — 2018-05-23
- 1.3.0 — 2018-05-21
- 1.2.2 — 2018-05-21
- 1.2.1 — 2018-05-21
- 1.2.0 — 2018-05-21
- 1.1.4 — 2018-05-16
- 1.1.3 — 2018-05-15

## README

Eslint Plugin Trove [![Build Status](https://travis-ci.org/notion/eslint-plugin-trove.svg?branch=master)](https://travis-ci.org/notion/eslint-plugin-trove)
===================

### Rules

`module-boundary`:
* Cannot reach into top-level `@trove` packages

`no-state-prop`:
* Cannot access `state` properties directly inside `mapStateToProps`, must use function like `getStatePropertyX(state)`
* Cannot access `state` properties directly inside `createSelector`

`expect-gen-run`:
* Must invoke either `run` or `toJSON` when using `expectGen`

#### `module-boundary`

This rule will check all import/require to ensure it does not reach into a top-level `notion-modules` package

##### Valid

```js
import { actionCreators } from '@trove/thread';
```

##### Invalid

```js
import { actionCreators } from '@trove/thread/message';
```

#### `no-state-prop`

This rule will check `mapStateToProps` for code trying to access state properties directly.

##### Valid

```js
import { connect } from 'react-redux';
import { getItem } from './selectors';

const App = () => {};

connect((state) => {
  return {
    item: getItem(state),
  };
})(App);
```

##### Invalid

```js
import { connect } from 'react-redux';

const App = () => {};

connect((state) => {
  return {
    item: state.item,
  };
})(App);
```

This rule will check `createSelector` for code trying to access state properties directly.

##### Valid

```js
import { createSelector } from 'reselect';
const getItem = (state) => state.item;

const getItemOpen = createSelector(
  getItem,
  (item) => item.open
);
```

##### Invalid

```js
import { createSelector } from 'reselect';

const getItem = createSelector(
  (state) => state.item,
  (item) => item
);
```

#### `expect-gen-run`

This rule will check any use of `expectGen` to ensure `.run()` or `.toJSON()` is called.

##### Valid

```js
expectGen(effect)
  .next()
  .run();
```

##### Valid

```js
expectGen(effect)
  .next()
  .toJSON();
```

##### Invalid

```js
expectGen(effect)
  .next();
```

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