agiledigital-labs / agiledigital-labs/eslint-plugin-total-functions

prefer-immutable-types causes ESLint to crash on matrices

Open
#875 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
92
Forks
5
PR merge metrics
No merged PRs in 30d

Description

```ts
const myFunction = (x: number[][]): string => {
return 0;
};
```

Causes the rule to crash:

```
Oops! Something went wrong! :(

ESLint: 8.56.0

RangeError: Maximum call stack size exceeded
Occurred while linting .../src/index.ts:1
Rule: "functional/prefer-immutable-types"
at TypeObject.hasOwn ()
at Function.hasOwn ()
at isTypeNode (.../is-immutable-type/dist/index.cjs:287:19)
at .../is-immutable-type/dist/index.cjs:246:30
at Array.map ()
at typeArgumentsToString (.../is-immutable-type/dist/index.cjs:245:47)
at TypeName.getNameWithArguments (.../is-immutable-type/dist/index.cjs:171:54)
at .../is-immutable-type/dist/index.cjs:253:26
at Array.map ()
at typeArgumentsToString (.../node_modules/is-immutable-type/dist/index.cjs:245:47)
```

While it doesn't crash with a single-depth array `number[]`

```ts
const myFunction = (x: number[]): string => {
return 0;
};
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.