@putout/plugin-convert-to-arrow-function
🐊Putout plugin adds ability to convert anonymous to arrow function
Last updated 3 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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 (2 months ago)

7 Versions

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

Copyright 2013 - present © cnpmjs.org | Home |