-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💅 lint/complexity/noForEach
should not throw on Effect.forEach
(or be configurable)
#3351
Comments
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 |
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 |
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. 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. |
How would a configuration would look like? |
Maybe something like the below would work? {
"noForEach": {
"level": "error",
"options": {
"ignore": ["Effect.forEach"]
}
} |
@nickrttn Why not disable the rule? |
Because it does have value to us outside of Effect. |
PRs are welcome, here's an acceptable option: {
"noForEach": {
"level": "error",
"options": {
"validIdentifiers": ["Effect", "_"]
}
} The rule will check if Effect.forEach();
_.forEach(); Values with dots won't be accepted. A value such as |
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
The text was updated successfully, but these errors were encountered: