You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use lodash and lodash/fp at the same time with the use of _.noConflict. Thus I have lodash bound to _ and lodash/fp bound on fp.
<script src='path/to/lodash.js'></script>
<script src='path/to/lodash.fp.js'></script>
<script>
// lodash is already on _
var fp = _.noConflict();
_.map(['6', '8', '10'], parseInt); // use standard lodash on _
fp.map(parseInt)(['6', '8', '10']); // this will give error
</script>
Now prefer-lodash-method will mark fp.map as error. Which is wrong.
There is the pragma setting with it I could set lodash to be on fp but then it is no longer on _. One possible solution would be to accept an array for pragma where I could define:
pragma: ['_', 'fp']
Or how should both be used together?
BTW: We do have lots of code in lodash already but want to use lodash/fp for the newer code. So it has to be used together.
The text was updated successfully, but these errors were encountered:
This is an interesting problem.
Like we said in issue #35, this plugin doesn't support lodash/fp.
This means that the rules shouldn't be applied to fp instances, so an array of pragma isn't what we want.
However, what happens in your example is an actual problem, specifically in prefer-lodash-method, which has an except array for methods, but not for objects.
I think what would solve the problem is adding an ignoreObjects array.
Something like:
The proposed solution sounds good to me. Since this will ensure cooperability with _ and fp used together - at least for prefer-lodash-method. But so far I did not come across other rules interfering.
So we have eslint-plugin-lodash to validate the use of _ and we have eslint-plugin-lodash-fp to validate the use of fp. This looks like a reasonable split to me.
I use lodash and lodash/fp at the same time with the use of _.noConflict. Thus I have lodash bound to _ and lodash/fp bound on fp.
Now prefer-lodash-method will mark fp.map as error. Which is wrong.
There is the pragma setting with it I could set lodash to be on fp but then it is no longer on _. One possible solution would be to accept an array for pragma where I could define:
Or how should both be used together?
BTW: We do have lots of code in lodash already but want to use lodash/fp for the newer code. So it has to be used together.
The text was updated successfully, but these errors were encountered: