eslint-plugin-total-functions icon indicating copy to clipboard operation
eslint-plugin-total-functions copied to clipboard

An ESLint plugin to enforce the use of total functions (and prevent the use of partial functions) in TypeScript.

Results 61 eslint-plugin-total-functions issues
Sort by recently updated
recently updated
newest added

* Prevent use of `t.type` unless it is nested within a `t.readonly`. * Prevent use of `t.array`, with fixer to `t.readonlyArray`.

good first issue

```typescript const x: { readonly a: number } = { a: 1 }; Object.assign(x, { a: 3 }); ``` This should warn, I guess, but it doesn't. Am I missing...

good first issue

We already bail out early if the type in question is an array. We should do the same for strings, which are only ever immutable. We might get a good...

good first issue

_NB this issue is distinct from (but related to) #100. That issue is about the return type, this is about the parameter type._ Concatenating a mutable array to another array...

help wanted
good first issue

We should report the property name (and the path down through nested properties to get to it) in the eslint error message to make fixing unsafe assignments easier.

help wanted
good first issue

As discussed in https://github.com/danielnixon/readonly-types/issues/7, lots of readonly array methods return mutable arrays. An example of this is `concat`. So if you have code like the following very common example, you...

good first issue

Index signatures lead to all sorts of unsoundness and you're better off using a real [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) in almost every case.

For examples where the RHS is an array or object literal we should be able to automatically fix by appending `as const`. Example: ```ts const foo: ReadonlyArray = ["foo"]; ```...

good first issue