Skip to content

Create a whitelist for id-length rule #40

@karol-majewski

Description

@karol-majewski

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

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

Type parameters

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

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

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

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions