MCPcopy Create free account
hub / github.com/ampproject/amphtml / CallExpression

Function CallExpression

build-system/eslint-rules/vsync.js:5–37  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

3module.exports = function (context) {
4 return {
5 CallExpression(node) {
6 if (/test-/.test(context.getFilename())) {
7 return;
8 }
9
10 const {callee} = node;
11 if (callee.type !== 'MemberExpression') {
12 return;
13 }
14
15 const {property} = callee;
16 if (property.type !== 'Identifier' || property.name !== 'vsyncFor') {
17 return;
18 }
19
20 const leadingComments = context.getCommentsBefore(property);
21 const ok = leadingComments.some((comment) => {
22 return comment.value === 'OK';
23 });
24 if (ok) {
25 return;
26 }
27
28 context.report({
29 node,
30 message: [
31 'VSync is now a privileged service.',
32 'You likely want to use the `BaseElement` methods' +
33 ' `measureElement`, `mutateElement`, or `runElement`.',
34 'In the worst case use the same methods on `Resources`.',
35 ].join('\n\t'),
36 });
37 },
38 };
39};

Callers

nothing calls this directly

Calls 2

testMethod · 0.45
reportMethod · 0.45

Tested by

no test coverage detected