Skip to content

Commit cf76a40

Browse files
committed
Refactor
1 parent e8780d2 commit cf76a40

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

lib/rules/jsx-curly-newline.js

+7-21
Original file line numberDiff line numberDiff line change
@@ -169,33 +169,19 @@ module.exports = {
169169
}
170170
}
171171

172-
/**
173-
* Gets the left curly and right curly tokens of a node.
174-
* @param {ASTNode} node The JSXExpressionContainer node.
175-
* @returns {{leftCurly: Object, rightCurly: Object}} An object contaning left and right curly tokens.
176-
*/
177-
function getCurlyTokens(node) {
178-
return {
179-
leftCurly: sourceCode.getFirstToken(node),
180-
rightCurly: sourceCode.getLastToken(node)
181-
};
182-
}
183-
184-
/**
185-
* Validates the curlys for a JSXExpressionContainer node.
186-
* @param {ASTNode} node The JSXExpressionContainer node.
187-
* @returns {void}
188-
*/
189-
function validateNode(node) {
190-
validateCurlys(getCurlyTokens(node), node.expression);
191-
}
192172

193173
// ----------------------------------------------------------------------
194174
// Public
195175
// ----------------------------------------------------------------------
196176

197177
return {
198-
JSXExpressionContainer: validateNode
178+
JSXExpressionContainer(node) {
179+
const curlyTokens = {
180+
leftCurly: sourceCode.getFirstToken(node),
181+
rightCurly: sourceCode.getLastToken(node)
182+
};
183+
validateCurlys(curlyTokens, node.expression);
184+
}
199185
};
200186
}
201187
};

0 commit comments

Comments
 (0)