• Stars
    star
    140
  • Rank 255,352 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

More general-purpose (TypeScript-related) ESLint rules

eslint-plugin-etc

GitHub License NPM version Downloads Build status dependency status devDependency Status peerDependency Status

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 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:

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:

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 Forbids the assignment of returned, mutated arrays. ✅
no-commented-out-code Forbids commented-out code.
no-const-enum Forbids the use of const enum. Constant enums are not compatible with isolated modules.
no-deprecated Forbids the use of deprecated APIs. ✅
no-enum Forbids the use of enum.
no-implicit-any-catch Like the no-implicit-any-catch rule in @typescript-eslint/eslint-plugin, but for Promise rejections instead of catch clauses. ✅ 🔧
no-internal Forbids the use of internal APIs. ✅
no-misused-generics 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. See also "The Golden Rule of Generics".
no-t Forbids single-character type parameters.
prefer-interface Forbids type aliases where interfaces can be used. 🔧
prefer-less-than Forbids greater-than comparisons. (Yes, this is the rule for Ben Lesh comparisons.) 🔧
throw-error Forbids throwing - or rejecting with - non-Error values.
underscore-internal Forbids internal APIs that are not prefixed with underscores.

More Repositories

1

rxjs-spy

A debugging library for RxJS
TypeScript
698
star
2

rxjs-tslint-rules

TSLint rules for RxJS
TypeScript
370
star
3

rxjs-marbles

An RxJS marble testing library for any test framework
TypeScript
300
star
4

eslint-plugin-rxjs

ESLint rules for RxJS
TypeScript
280
star
5

rxjs-etc

Observables and operators for RxJS
TypeScript
214
star
6

ts-action

TypeScript action creators for Redux
TypeScript
184
star
7

rxjs-observe

A library for observing an object's property assignments and method calls
TypeScript
96
star
8

eslint-plugin-rxjs-angular

ESLint rules for RxJS and Angular
TypeScript
94
star
9

tslint-etc

More rules for TSLint
TypeScript
43
star
10

firebase-key

Firebase key utility and encoding/decoding functions
TypeScript
39
star
11

rxjs-spy-devtools

Chrome DevTools for rxjs-spy
TypeScript
39
star
12

firebase-nightlight

An in-memory, JavaScript mock for the Firebase Web API
TypeScript
37
star
13

ts-action-operators

TypeScript action operators for NgRx and redux-observable
TypeScript
33
star
14

ts-snippet

A TypeScript snippet compiler for any test framework
TypeScript
32
star
15

eslint-plugin-react-etc

More ESLint rules for React
TypeScript
16
star
16

devtools-example

DevTools extension examples
JavaScript
16
star
17

eslint-etc

Utils for ESLint TypeScript rules
TypeScript
15
star
18

rxjs-xyz

RxJS community packages
JavaScript
14
star
19

rxjs-pluggables

RxJS observables and operators with pluggable strategies
TypeScript
14
star
20

firebase-thermite

Firebase RxJS observables
TypeScript
13
star
21

rxjs-traits

RxJS Traits for Static Analysis
TypeScript
13
star
22

rxjs-report-usage

Report a project's RxJS API usage to the core team
JavaScript
10
star
23

rxjs-interop

Observable interop helpers for RxJS
TypeScript
8
star
24

eslint-plugin-rxjs-traits

TypeScript
8
star
25

blog

Blog post Markdown content
Shell
6
star
26

tsutils-etc

TypeScript
6
star
27

recompose-etc

React function components and higher-order components based on recompose and RxJS
TypeScript
4
star
28

cartant

3
star
29

memoize-resolver

A general-purpose key resolver for memoize
TypeScript
3
star
30

eslint-plugin-dtslint

ESLint rules for dtslint tests
TypeScript
2
star
31

eslint-issues

A repo for reproducing ESLint plugin problems
TypeScript
1
star
32

eslint-config-rxjs

JavaScript
1
star
33

eslint-config-etc

JavaScript
1
star
34

eslint-config

JavaScript
1
star
35

eslint-config-react

JavaScript
1
star