Glavin001 / Glavin001/tslint-clean-code

Create a whitelist for id-length rule

Open
#40 4 comments 0 reactions 1 assignee Claimed by @karol-majewski View on GitHub
bug good first issue help wanted
Dominant language
TypeScript
Stars
175
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hello and thank you for your work.

The `id-length` rule is great for forbidding one-letter variable names. However, there are cases where one-letter symbols would actually be preferred: type parameters (`GenericTypeAnnotation` nodes) and holes.

#### Holes

```js
Array
.from({ length: 10 })
.map((_, index) => index);
```

#### Type parameters

```ts
function unique(collection: T[]): T[] {
return [...new Set(collection)];
}
```

What do you think about passing a config that would allow them?

```json
"id-length": [true, {
"check-type-parameters": false,
"allow": ["_"]
}]
```

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.