We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 66b3635 commit d37cfb8Copy full SHA for d37cfb8
lib/rules/forward-ref-uses-ref.js
@@ -70,15 +70,12 @@ module.exports = {
70
{
71
* fix(fixer) {
72
const param = node.params[0];
73
- if (
74
- node.type === 'ArrowFunctionExpression'
75
- && !isParenthesized(context, param)
76
- ) {
+ // If using shorthand arrow function syntax, add parentheses around the new parameter pair
+ const shouldAddParentheses = node.type === 'ArrowFunctionExpression' && !isParenthesized(context, param);
+ if (shouldAddParentheses) {
77
yield fixer.insertTextBefore(param, '(');
78
- yield fixer.insertTextAfter(param, ')');
79
}
80
-
81
- yield fixer.insertTextAfter(param, ', ref');
+ yield fixer.insertTextAfter(param, `, ref${shouldAddParentheses ? ')' : ''}`);
82
},
83
84
),
0 commit comments