# eslint-plugin-etc

> More general-purpose ESLint rules

Latest version **2.0.3** (published 2023-05-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-etc
pnpm add eslint-plugin-etc
yarn add eslint-plugin-etc
bun add eslint-plugin-etc
```

## 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.3 |
| Published | 2023-05-10 |
| First published | 2019-02-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 90 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 151 |
| Author | Nicholas Jamieson |
| Maintainers | cartant |
| Keywords | lint, rules, eslint |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-etc
- Repository: https://github.com/cartant/eslint-plugin-etc
- Issues: https://github.com/cartant/eslint-plugin-etc/issues
- npm.io page: https://npm.io/package/eslint-plugin-etc

## Dependencies (6)

- [tslib](https://npm.io/package/tslib.md) ^2.0.0
- [tsutils](https://npm.io/package/tsutils.md) ^3.0.0
- [eslint-etc](https://npm.io/package/eslint-etc.md) ^5.1.0
- [requireindex](https://npm.io/package/requireindex.md) ~1.2.0
- [@phenomnomnominal/tsquery](https://npm.io/package/@phenomnomnominal/tsquery.md) ^5.0.0
- [@typescript-eslint/experimental-utils](https://npm.io/package/@typescript-eslint/experimental-utils.md) ^5.0.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.3 (latest) — 2023-05-10
- 2.0.2 — 2022-01-22
- 2.0.1 — 2021-11-07
- 2.0.0 — 2021-10-17
- 1.5.4 — 2021-07-02
- 1.5.3 — 2021-06-30
- 1.5.2 — 2021-06-16
- 1.5.1 — 2021-06-16
- 1.5.0 — 2021-05-27
- 1.4.1 — 2021-05-27
- 1.4.0 — 2021-04-15
- 1.3.8 — 2021-03-29
- 1.3.7 — 2021-03-22
- 1.3.6 — 2021-03-19
- 1.3.5 — 2021-03-14
- … 70 more at https://npm.io/package/eslint-plugin-etc/versions

## README

# eslint-plugin-etc

[![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cartant/eslint-plugin-etc/blob/master/LICENSE)
[![NPM version](https://img.shields.io/npm/v/eslint-plugin-etc.svg)](https://www.npmjs.com/package/eslint-plugin-etc)
[![Downloads](http://img.shields.io/npm/dm/eslint-plugin-etc.svg)](https://npmjs.org/package/eslint-plugin-etc)
[![Build status](https://img.shields.io/circleci/build/github/cartant/eslint-plugin-etc?token=8ebc6af0847545d4c2346f5ffaedee508b55ce38)](https://app.circleci.com/pipelines/github/cartant)
[![dependency status](https://img.shields.io/david/cartant/eslint-plugin-etc.svg)](https://david-dm.org/cartant/eslint-plugin-etc)
[![devDependency Status](https://img.shields.io/david/dev/cartant/eslint-plugin-etc.svg)](https://david-dm.org/cartant/eslint-plugin-etc#info=devDependencies)
[![peerDependency Status](https://img.shields.io/david/peer/cartant/eslint-plugin-etc.svg)](https://david-dm.org/cartant/eslint-plugin-etc#info=peerDependencies)

This package contains a bunch of general-purpose, TypeScript-related ESLint rules. Essentially, it's a re-implementation of the rules that are in the [`tslint-etc`](https://github.com/cartant/tslint-etc) package.

Some of the rules are rather opinionated and are not included in the `recommended` configuration. Developers can decide for themselves whether they want to enable opinionated rules.

# Install

Install the ESLint TypeScript parser using npm:

```
npm install @typescript-eslint/parser --save-dev
```

Install the package using npm:

```
npm install eslint-plugin-etc --save-dev
```

Configure the `parser` and the `parserOptions` for ESLint. Here, I use a `.eslintrc.js` file for the configuration:

```js
const { join } = require("path");
module.exports = {
  parser: "@typescript-eslint/parser",
  parserOptions: {
    ecmaVersion: 2019,
    project: join(__dirname, "./tsconfig.json"),
    sourceType: "module"
  },
  plugins: ["etc"],
  extends: [],
  rules: {
    "etc/no-t": "error"
  }
};
```

Or, using the `recommended` configuration:

```js
const { join } = require("path");
module.exports = {
  parser: "@typescript-eslint/parser",
  parserOptions: {
    ecmaVersion: 2019,
    project: join(__dirname, "./tsconfig.json"),
    sourceType: "module"
  },
  extends: ["plugin:etc/recommended"],
};
```

# Rules

The package includes the following rules.

Rules marked with ✅ are recommended and rules marked with 🔧 have fixers.

| Rule | Description | | |
| --- | --- | --- | --- |
| [`no-assign-mutated-array`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-assign-mutated-array.md) | Forbids the assignment of returned, mutated arrays. | ✅ | |
| [`no-commented-out-code`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-commented-out-code.md) | Forbids commented-out code. | | |
| [`no-const-enum`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-const-enum.md) | Forbids the use of `const enum`. Constant enums are [not compatible with isolated modules](https://ncjamieson.com/dont-export-const-enums/). | | |
| [`no-deprecated`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-deprecated.md) | Forbids the use of deprecated APIs. | ✅ | |
| [`no-enum`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-enum.md) | Forbids the use of `enum`. | | |
| [`no-implicit-any-catch`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-implicit-any-catch.md) | Like the [`no-implicit-any-catch` rule](https://github.com/typescript-eslint/typescript-eslint/blob/e01204931e460f5e6731abc443c88d666ca0b07a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md) in `@typescript-eslint/eslint-plugin`, but for `Promise` rejections instead of `catch` clauses. | ✅ | 🔧 |
| [`no-internal`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-internal.md) | Forbids the use of internal APIs. | ✅ | |
| [`no-misused-generics`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-misused-generics.md) | Forbids type parameters without inference sites and type parameters that don't add type safety to declarations. This is an ESLint port of [Wotan's `no-misused-generics` rule](https://github.com/fimbullinter/wotan/blob/11368a193ba90a9e79b9f6ab530be1b434b122de/packages/mimir/docs/no-misused-generics.md). See also ["The Golden Rule of Generics"](https://effectivetypescript.com/2020/08/12/generics-golden-rule/). | | |
| [`no-t`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/no-t.md) | Forbids single-character type parameters. | | |
| [`prefer-interface`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/prefer-interface.md) | Forbids type aliases where interfaces can be used. | | 🔧 |
| [`prefer-less-than`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/prefer-less-than.md) | Forbids greater-than comparisons. (Yes, this is the rule for [Ben Lesh comparisons](https://twitter.com/BenLesh/status/1397593619096166400).) | | 🔧 |
| [`throw-error`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/throw-error.md) | Forbids throwing - or rejecting with - non-`Error` values. | | |
| [`underscore-internal`](https://github.com/cartant/eslint-plugin-etc/blob/main/docs/rules/underscore-internal.md) | Forbids internal APIs that are not prefixed with underscores. | | |

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