I propose to add some flexibility to this rule by optionally allowing callbacks which already have some or all of the required arguments.
Current rule description example:
The unicorn module now does a minor version that adds another argument:
module.exports = (x, y) => x + (y ? y : 1);
Your code will now return something different and probably break for users because it is now passing the index of the item as second argument.
is absolutely valid, but if callback function already has all the required arguments - it's not danger anymore:
function callback(value, index, array) { }
[1,2,3].map(callback); // should pass
since 3rd 'array' argument is rarely used, we can also allow functions with value and index arguments only.
to summarize:
function c_noArgs() { }
function c_value(value) { }
function c_valueIndex(value, index) { }
function c_valueIndexArray(value, index, array) { }
[1,2,3].map(c_noArgs); // should fail
[1,2,3].map(c_value); // should fail
[1,2,3].map(c_valueIndex); // should pass if "AllowValueIndex: true"
[1,2,3].map(c_valueIndexArray); // should pass if "AllowValueIndexArray": true
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too