@putout/plugin-convert-to-arrow-function
🐊Putout plugin adds ability to convert anonymous to arrow function
Last updated 10 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-convert-to-arrow-function 
SYNC missed versions from official npm registry.

@putout/plugin-convert-to-arrow-function NPM version

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

Current Tags

  • 5.0.1                                ...           latest (10 months ago)

7 Versions

  • 5.0.1                                ...           10 months ago
  • 5.0.0                                ...           10 months ago
  • 4.0.0                                ...           4 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.0                                ...           7 years ago
  • 1.1.0                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 12
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 0
Last Month 5
Dependencies (0)
None
Dev Dependencies (7)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE