@putout/plugin-convert-to-arrow-function
v4.0.0
Published
šPutout plugin adds ability to convert anonymous to arrow function
Downloads
67,350
Maintainers
Readme
@putout/plugin-convert-to-arrow-function
An arrow function expression is a compact alternative to anonymous function.
(c) MDN
šPutout plugin convert anonymous to arrow function.
Install
npm i @putout/plugin-convert-to-arrow-function
Rule
{
"rules": {
"convert-to-arrow-function": "on"
}
}
ā Example of incorrect code
module.exports = function(a, b) {};
function x() {
return function(a) {
return b;
};
}
call(function() {
return 'world';
});
ā Example of correct code
module.exports = (a, b) => {};
function x() {
return (a) => {
return b;
};
}
call(() => {
return 'world';
});
Comparison
Linter | Rule | Fix
--------|-------|------------|
š Putout | convert-to-arrow-function
| ā
ā£ ESLint | prefer-arrow-callback
| ā
License
MIT