Skip to content

Files

Latest commit

09ae161 · Apr 13, 2024

History

History
 
 

plugin-convert-assignment-to-arrow-function

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jun 21, 2023
Jun 21, 2023
Jul 20, 2022
Jan 6, 2022
Jun 21, 2023
Apr 10, 2024
Apr 13, 2024
Jun 21, 2023
Feb 28, 2021
Mar 20, 2022
Apr 8, 2024

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

The assignment operator (=) is used to assign a value to a variable. The assignment operation evaluates to the assigned value. Chaining the assignment operator is possible in order to assign a single value to multiple variables.

An arrow function expression is a compact alternative to a function expression.

(c) MDN

🐊Putout plugin adds ability to convert assignment to arrow function.

Install

npm i @putout/plugin-convert-assignment-to-arrow-function -D

Rule

{
    "rules": {
        "convert-assignment-to-arrow-function": "on"
    }
}

❌ Example of incorrect code

const createRegExp = a = RegExp(a, 'g');

✅ Example of correct code

const createRegExp = (a) => RegExp(a, 'g');

License

MIT