Open nickrttn opened 1 month ago
Would it be feasible to make this rule configurable to ignore some objects?
I personally have no objection to that but would like to know how others see it. We had this similar issue in #1205, but the Effect
lib is clearly a more convincing use case.
I don't know, to be honest. Providing an option for this rule is like cheating, a user could use the option to bypass some code, e.g.
const arr = [];
arr.forEach();
Then, add arr
to the options. For us, options should be a way to empower the rule, not a way to "cheat". I think the correct course of action is for users to suppress of turn off the rule.
I don't agree that lint rules are for policing, that's for pull requests. Lint rules are guidelines that can be avoided in many ways already. Adding an option, such as the suggestion above, allows apis such as Effect to work within the rules instead of forcing people to turn them off. If a pull request to your project included an adjustment to the biome lint rules; turning off a rule for variables called "arr" - that is a red flag, just as a biome ignore comment would be.
Note: I have skin in the game as I use effect. I don't want to turn off a perfectly good linting rule if possible.
I would a configuration would look like?
Environment information
Rule name
lint/complexity/noForEach
Playground link
https://biomejs.dev/playground/?code=aQBtAHAAbwByAHQAIAB7ACAARQBmAGYAZQBjAHQALAAgAFAAcgBlAGQAaQBjAGEAdABlACwAIABwAGkAcABlACAAfQAgAGYAcgBvAG0AIAAnAGUAZgBmAGUAYwB0ACcAOwAKAAoAYwBvAG4AcwB0ACAAYQByAHIAYQB5ACAAPQAgAFsAMQAsACAAMgAsACAAbgB1AGwAbAAsACAAMwBdADsAIAAKAAoAcABpAHAAZQAoAAoAIAAgAGEAcgByAGEAeQAsAAoAIAAgAEUAZgBmAGUAYwB0AC4AZgBvAHIARQBhAGMAaAAoAHgAIAA9AD4AIABQAHIAZQBkAGkAYwBhAHQAZQAuAGkAcwBOAG8AdABOAHUAbABsAGEAYgBsAGUAKAB4ACkALAAgAHsAIABjAG8AbgBjAHUAcgByAGUAbgBjAHkAOgAgACcAdQBuAGIAbwB1AG4AZABlAGQAJwAgAH0AKQAKACkACgA%3D
Expected result
The lint rule
lint/complexity/noForEach
is very useful for plain arrays, and I would like to enable it.I read the caveat on the rule page. In our codebase however, we use a lot of Effect, a functional programming library.
Effect.forEach
is used often enough that it would be bothersome to addbiome-ignore
comments to every usage.Would it be feasible to make this rule configurable to ignore some objects?
Code of Conduct