# @hokla/eslint-plugin-custom-rules

> ESLint rules to comply with Hokla's best development practices

Latest version **2.0.0** (published 2023-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @hokla/eslint-plugin-custom-rules
pnpm add @hokla/eslint-plugin-custom-rules
yarn add @hokla/eslint-plugin-custom-rules
bun add @hokla/eslint-plugin-custom-rules
```

## 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 | 2.0.0 |
| Published | 2023-08-21 |
| First published | 2022-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 43.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 8 |
| Author | Ludovic Descateaux |
| Maintainers | ludovic-descateaux |
| Keywords | eslint |

## Links

- npm: https://www.npmjs.com/package/@hokla/eslint-plugin-custom-rules
- Repository: https://github.com/hokla-org/eslint-plugin-custom-rules
- Homepage: https://github.com/hokla-org/eslint-plugin-custom-rules#readme
- Issues: https://github.com/hokla-org/eslint-plugin-custom-rules/issues
- npm.io page: https://npm.io/package/@hokla/eslint-plugin-custom-rules

## Dependencies (4)

- [requireindex](https://npm.io/package/requireindex.md) ^1.2.0
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) ^7.33.2
- [eslint-plugin-react-hooks](https://npm.io/package/eslint-plugin-react-hooks.md) ^4.6.0
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^6.4.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
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2023-08-21
- 1.10.0 — 2023-08-21
- 1.9.0 — 2023-08-03
- 1.8.4 — 2023-07-03
- 1.8.3 — 2023-06-01
- 1.8.2 — 2023-06-01
- 1.6.1 — 2023-02-03
- 1.6.0 — 2023-01-26
- 1.5.2 — 2023-01-12
- 1.5.1 — 2023-01-12
- 1.5.0 — 2023-01-12
- 1.4.1 — 2023-01-12
- 1.4.0 — 2023-01-06
- 1.3.2 — 2023-01-03
- 1.3.1 — 2023-01-03
- … 5 more at https://npm.io/package/@hokla/eslint-plugin-custom-rules/versions

## README

# Hokla's Eslint plugin

Recommended custom eslint rules at Hokla

# How to use

## Install

```
yarn add --dev @hokla/eslint-plugin-custom-rules
```

**Optional:** In case you also need to setup eslint :

```
yarn add --dev eslint typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin
```

## Use rules in your projects

In your `.eslintrc.json` file :

```json
{
  "root": true,
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@hokla/custom-rules/recommended"
  ],
  "plugins": ["@typescript-eslint"],
  "parser": "@typescript-eslint/parser",
  // In case you want to customize the level of warning (default to 'warn')
  "rules": {
    "@hokla/custom-rules/react-query-specify-typing": "warn" // "error" | "warn
  }
}
```

                   |

# Contribute

- Create a new branch and PR: https://github.com/hokla-org/eslint-plugin-custom-rules/compare

- Write a test with valid and invalid code samples

- Use online tools to specify AST selectors and implement the rule

  - https://astexplorer.net/
  - https://estools.github.io/esquery/
  - https://typescript-eslint.io/play
  - https://www.notion.so/m33/Faire-ses-propres-r-gles-de-linter-AST-801c068aa15d40a4b39bc0ceff5e49aa
  - https://eslint-utils.mysticatea.dev/
  - https://typescript-eslint.io/

- Build rules with `yarn build`, create the doc file for your rule in `docs/rules/[YOUR_RULE_NAME].md` (empty file is ok) and run `yarn update:eslint-docs` to update rules docs.

- Ask a review !

- Let the world know (slack the teams you want to share it with and tell them to upgrade by running `yarn upgrade @hokla/eslint-plugin-custom-rules` or `npm update @hokla/eslint-plugin-custom-rules`)

## Configs

Configs section would normally go here.

## Rules

<!-- begin auto-generated rules list -->

💼 [Configurations](https://github.com/hokla-org/eslint-plugin-custom-rules) enabled in.\
⚠️ [Configurations](https://github.com/hokla-org/eslint-plugin-custom-rules) set to warn in.\
🌐 Set in the `react` [configuration](https://github.com/hokla-org/eslint-plugin-custom-rules).\
☑️ Set in the `recommended` [configuration](https://github.com/hokla-org/eslint-plugin-custom-rules).

| Name                                                                                                               | Description                                                                                                                                                                         | 💼 | ⚠️ |
| :----------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :- | :- |
| [forbid-lowercase-jsx-tags](docs/rules/forbid-lowercase-jsx-tags.md)                                               | To be used in a React Native project: this rule forbids JSX tags that don't begin with a capital letter                                                                             |    |    |
| [luxon-force-zone-in-datetime](docs/rules/luxon-force-zone-in-datetime.md)                                         | TODO                                                                                                                                                                                |    |    |
| [mutation-decorator-return-type-mismatch](docs/rules/mutation-decorator-return-type-mismatch.md)                   | Parameter of Mutation Decorator should match the method's return type                                                                                                               |    |    |
| [no-async-in-foreach](docs/rules/no-async-in-foreach.md)                                                           | Array.prototype.forEach is not designed for asynchronous code                                                                                                                       | ☑️ |    |
| [no-key-or-ref-prop](docs/rules/no-key-or-ref-prop.md)                                                             | This rule forbids using props named `key` or `ref` in React function components, as they are reserved words and will not act as intended                                            | 🌐 |    |
| [no-value-export-in-declaration-file](docs/rules/no-value-export-in-declaration-file.md)                           | This rule forbids exporting values from TypeScript declaration files (ending in ".d.ts"), which can lead to bugs since these files are dropped during transpilation.                | ☑️ |    |
| [property-decorator-type-mismatch](docs/rules/property-decorator-type-mismatch.md)                                 | Parameter of Type Decorator should match the property type                                                                                                                          | ☑️ |    |
| [react-query-specify-typing](docs/rules/react-query-specify-typing.md)                                             | Type parameters should always be specified when calling useQuery and useMutation from react-query                                                                                   |    | 🌐 |
| [react-routes-must-be-wrapped-in-router](docs/rules/react-routes-must-be-wrapped-in-router.md)                     | enforce encapsulation of <...Routes> in <...Router> provider and explicit naming of components returning <...Routes> element                                                        | 🌐 |    |
| [redux-saga-no-sequential-actions](docs/rules/redux-saga-no-sequential-actions.md)                                 | description here                                                                                                                                                                    |    |    |
| [typeorm-enforce-repository-generic-method-typing](docs/rules/typeorm-enforce-repository-generic-method-typing.md) | enforce calls to repository generic methods (save, softRemove and recover) without type specification                                                                               |    |    |
| [typeorm-query-runner-release](docs/rules/typeorm-query-runner-release.md)                                         | Any statement calling a queryRunner should be followed by a try/catch/finally block that ensures that the connection pool is released in any case by calling queryRunner.release(). |    |    |

<!-- end auto-generated rules list -->

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