-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add rule no-inline-units
#96
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contribution 💙
As I see, tests for documentation is broken, so, please add this rule to README.md.
Furthermore, I've found some minor issues. Could you consider fixing it?
@@ -0,0 +1,13 @@ | |||
# effector/no-inline-units | |||
|
|||
Disallows to use inline units in methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide further information, why it is a bad idea to use inline units?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ye sure
@@ -0,0 +1,83 @@ | |||
const { RuleTester } = require("eslint"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not find any TS-tests. Should we add it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add TS-tests, but I don't understand what specific cases they should cover.
Can u help me with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In mind, we should cover something like sample({ source: createCustomStoreBySomeFactory() })
where createCustomStoreBySomeFactory
is not imported from effector
, but it returns Store
.
"createApi", | ||
]; | ||
|
||
const UNIT_CREATORS = ["createStore", "createEvent", "createEffect"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about attach
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohh i lost it 🤪
"forward", | ||
"sample", | ||
"guard", | ||
"attach", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see, why inline effect in attach
in bad 🤔
It looks like other rule to omit createEffect
at all in this case.
const newEffect = attach({ effect: createEffect(() => null) })
const newEffect = attach({ effect: () => null })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is because the name of the effect is lost. Sometimes you can't just understand the meaning of the unit from the context.
Closes #84