/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
build-system/eslint-rules/vsync.js
39 строк
963 B
Kristofer Baxter
♻️ Remove Notice from JS and Markdown (#35717)
19 авг 2021, 21:21
Не верифицирован
19 авг 2021, 21:21
f564b7e
Код
Авторство
О чём код?
'use strict'; module.exports = function (context) { return { CallExpression(node) { if (/test-/.test(context.getFilename())) { return; } const {callee} = node; if (callee.type !== 'MemberExpression') { return; } const {property} = callee; if (property.type !== 'Identifier' || property.name !== 'vsyncFor') { return; } const leadingComments = context.getCommentsBefore(property); const ok = leadingComments.some((comment) => { return comment.value === 'OK'; }); if (ok) { return; } context.report({ node, message: [ 'VSync is now a privileged service.', 'You likely want to use the `BaseElement` methods' + ' `measureElement`, `mutateElement`, or `runElement`.', 'In the worst case use the same methods on `Resources`.', ].join('\n\t'), }); }, }; };