* @param {CompilerNode} node
(node)
| 71 | * @param {CompilerNode} node |
| 72 | */ |
| 73 | function callScopedQuerySelector(node) { |
| 74 | const {callee} = node; |
| 75 | if (!callee.name.startsWith('scopedQuerySelector')) { |
| 76 | return; |
| 77 | } |
| 78 | |
| 79 | const leadingComments = context.getCommentsBefore(node); |
| 80 | const ok = leadingComments.some((comment) => { |
| 81 | return comment.value === 'OK'; |
| 82 | }); |
| 83 | if (ok) { |
| 84 | return; |
| 85 | } |
| 86 | |
| 87 | const selector = getSelector(node, 1); |
| 88 | |
| 89 | if (!isValidSelector(selector)) { |
| 90 | context.report({ |
| 91 | node, |
| 92 | message: 'Failed to parse CSS Selector `' + selector + '`', |
| 93 | }); |
| 94 | return; |
| 95 | } |
| 96 | |
| 97 | if (selectorNeedsScope(selector)) { |
| 98 | return; |
| 99 | } |
| 100 | |
| 101 | context.report({ |
| 102 | node, |
| 103 | message: |
| 104 | 'using scopedQuerySelector here is actually ' + |
| 105 | "unnecessary, since you don't use child selector semantics.", |
| 106 | }); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @param {CompilerNode} node |
no test coverage detected