$ npm install @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.
npm i @putout/plugin-convert-to-arrow-function
{
"rules": {
"convert-to-arrow-function": "on"
}
}
module.exports = function(a, b) {};
function x() {
return function(a) {
return b;
};
}
call(function() {
return 'world';
});
module.exports = (a, b) => {};
function x() {
return (a) => {
return b;
};
}
call(() => {
return 'world';
});
Linter | Rule | Fix |
---|---|---|
🐊 Putout | convert-to-arrow-function |
✅ |
⏣ ESLint | prefer-arrow-callback |
✅ |
MIT
© 2010 - cnpmjs.org x YWFE | Home | YWFE