Skip to content

Commit

Permalink
Remove generator, fix description
Browse files Browse the repository at this point in the history
  • Loading branch information
NotWoods committed Dec 20, 2023
1 parent d37cfb8 commit f3d75e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lib/rules/forward-ref-uses-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ module.exports = {
Object.assign(
getMessageData('addRefParameter', messages.addRefParameter),
{
* fix(fixer) {
fix(fixer) {
const param = node.params[0];
// If using shorthand arrow function syntax, add parentheses around the new parameter pair
const shouldAddParentheses = node.type === 'ArrowFunctionExpression' && !isParenthesized(context, param);
if (shouldAddParentheses) {
yield fixer.insertTextBefore(param, '(');
}
yield fixer.insertTextAfter(param, `, ref${shouldAddParentheses ? ')' : ''}`);
return [].concat(
shouldAddParentheses ? fixer.insertTextBefore(param, '(') : [],
fixer.insertTextAfter(param, `, ref${shouldAddParentheses ? ')' : ''}`),
};
},
}
),
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/forward-ref-uses-ref.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @fileoverview Ensure symmetric naming of setState hook value and setter variables
* @author Duncan Beevers
* @fileoverview Require all forwardRef components include a ref parameter
* @author Tiger Oakes
*/

'use strict';
Expand Down

0 comments on commit f3d75e6

Please sign in to comment.