eslint-plugin-prefer-arrow-functions
Advanced tools
Comparing version 3.3.0 to 3.3.1
@@ -141,15 +141,13 @@ "use strict"; | ||
var writeArrowFunction = function (node) { | ||
var _a = getFunctionDescriptor(node), body = _a.body, isAsync = _a.isAsync, isGeneric = _a.isGeneric, generic = _a.generic, params = _a.params, returnType = _a.returnType; | ||
return 'ASYNC<GENERIC>(PARAMS)RETURN_TYPE => BODY' | ||
.replace('ASYNC', isAsync ? 'async ' : '') | ||
.replace('<GENERIC>', isGeneric ? generic : '') | ||
.replace('BODY', body) | ||
.replace('RETURN_TYPE', returnType ? returnType : '') | ||
.replace('PARAMS', params.join(', ')); | ||
var fn = getFunctionDescriptor(node); | ||
var ASYNC = fn.isAsync ? 'async ' : ''; | ||
var GENERIC = fn.isGeneric ? fn.generic : ''; | ||
var BODY = fn.body; | ||
var RETURN_TYPE = fn.returnType ? fn.returnType : ''; | ||
var PARAMS = fn.params.join(', '); | ||
return "" + ASYNC + GENERIC + "(" + PARAMS + ")" + RETURN_TYPE + " => " + BODY; | ||
}; | ||
var writeArrowConstant = function (node) { | ||
var name = getFunctionDescriptor(node).name; | ||
return 'const NAME = ARROW_FUNCTION' | ||
.replace('NAME', name) | ||
.replace('ARROW_FUNCTION', writeArrowFunction(node)); | ||
var fn = getFunctionDescriptor(node); | ||
return "const " + fn.name + " = " + writeArrowFunction(node); | ||
}; | ||
@@ -156,0 +154,0 @@ var getFunctionDescriptor = function (node) { |
{ | ||
"name": "eslint-plugin-prefer-arrow-functions", | ||
"description": "Convert functions to arrow functions", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"author": "Jamie Mason (https://github.com/JamieMason)", | ||
@@ -12,3 +12,5 @@ "bugs": "https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions/issues", | ||
"Michael Gallagher (https://github.com/mikeapr4)", | ||
"Mitchell Merry (https://github.com/mitchell-merry)", | ||
"Pablo Enrici (https://github.com/pablen)", | ||
"Renato Böhler (https://github.com/renato-bohler)", | ||
"Triston Jones (https://github.com/TristonJ)" | ||
@@ -23,3 +25,3 @@ ], | ||
"auto-changelog": "2.4.0", | ||
"eslint": "8.2.0", | ||
"eslint": "8.57.0", | ||
"jest": "27.3.1", | ||
@@ -26,0 +28,0 @@ "prettier": "2.4.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23623
310