no-units-spawn-in-render#180
Conversation
✅ Deploy Preview for eslint-plugin ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| function getCalleeName(callee: Node.CallExpression["callee"]): string | null { | ||
| if (callee.type === AST_NODE_TYPES.Identifier) return callee.name | ||
| if (callee.type === AST_NODE_TYPES.MemberExpression && callee.property.type === AST_NODE_TYPES.Identifier) { | ||
| return callee.property.name | ||
| } | ||
| return null | ||
| } |
There was a problem hiding this comment.
These checks for AST_NODE_TYPES are duplicated across the rule implementation, so it might be beneficial to
- Either narrow this down on a
esqueryselector level to remove unrelated work altogether, or - Expand the logic to both check and format the name for a more nested structure (there's no reason to exclude
a.b.c()while includinga.b())
p.s. This might also help make these names prettier by including full path. Currently domain.event() produces just event in an error, but it might be nice to have domain.event.
adf99f3 to
0f85d3b
Compare
0f85d3b to
bf6b6ad
Compare
| // `useContext` is excluded because it legitimately retrieves pre-created units. | ||
| // - Namespaced effector calls (e.g. `effector.createStore`) are matched | ||
| // by callee type against the effector package | ||
| // - Anything remaining is treated as a custom factory |
There was a problem hiding this comment.
Note for future: this directly conflicts with third-party "model" providers, like effector-factorio with its factory.useModel(). Do we recommend disabling the rule for these users, or do we make the rule configurable?
There was a problem hiding this comment.
Good call
I think, we may add an exception ahead of time for that
No description provided.