File tree Expand file tree Collapse file tree 3 files changed +19
-29
lines changed
Expand file tree Collapse file tree 3 files changed +19
-29
lines changed Original file line number Diff line number Diff line change 44 */
55'use strict' ;
66
7+ var getTokenBeforeClosingBracket = require ( '../util/getTokenBeforeClosingBracket' ) ;
8+
79// ------------------------------------------------------------------------------
810// Rule Definition
911// ------------------------------------------------------------------------------
@@ -30,19 +32,6 @@ module.exports = {
3032 var NEVER_MESSAGE = 'A space is forbidden before closing bracket' ;
3133 var ALWAYS_MESSAGE = 'A space is required before closing bracket' ;
3234
33- /**
34- * Find the token before the closing bracket.
35- * @param {ASTNode } node - The JSX element node.
36- * @returns {Token } The token before the closing bracket.
37- */
38- function getTokenBeforeClosingBracket ( node ) {
39- var attributes = node . attributes ;
40- if ( attributes . length === 0 ) {
41- return node . name ;
42- }
43- return attributes [ attributes . length - 1 ] ;
44- }
45-
4635 // --------------------------------------------------------------------------
4736 // Public
4837 // --------------------------------------------------------------------------
Original file line number Diff line number Diff line change 44 */
55'use strict' ;
66
7- // ------------------------------------------------------------------------------
8- // Helpers
9- // ------------------------------------------------------------------------------
10-
11- /**
12- * Find the token before the closing bracket.
13- * @param {ASTNode } node - The JSX element node.
14- * @returns {Token } The token before the closing bracket.
15- */
16- function getTokenBeforeClosingBracket ( node ) {
17- var attributes = node . attributes ;
18- if ( attributes . length === 0 ) {
19- return node . name ;
20- }
21- return attributes [ attributes . length - 1 ] ;
22- }
7+ var getTokenBeforeClosingBracket = require ( '../util/getTokenBeforeClosingBracket' ) ;
238
249// ------------------------------------------------------------------------------
2510// Validators
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ /**
4+ * Find the token before the closing bracket.
5+ * @param {ASTNode } node - The JSX element node.
6+ * @returns {Token } The token before the closing bracket.
7+ */
8+ function getTokenBeforeClosingBracket ( node ) {
9+ var attributes = node . attributes ;
10+ if ( attributes . length === 0 ) {
11+ return node . name ;
12+ }
13+ return attributes [ attributes . length - 1 ] ;
14+ }
15+
16+ module . exports = getTokenBeforeClosingBracket ;
You can’t perform that action at this time.
0 commit comments