Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix Page.emulateMedia doclint failure #5584

Merged
merged 2 commits into from Apr 6, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion utils/doclint/check_public_api/index.js
Expand Up @@ -154,6 +154,13 @@ function checkDuplicates(doc) {
return errors;
}

const expectedNonExistingMethods = new Map([
/* Expected to be missing as the method is deprecated
* and we alias it to Page.prototype.emulateMediaType in index.js
* which is not checked by DocLint
*/
['Page', new Set(['emulateMedia'])],
]);
/**
* @param {!Documentation} actual
* @param {!Documentation} expected
Expand All @@ -176,8 +183,12 @@ function compareDocumentations(actual, expected) {
const actualMethods = Array.from(actualClass.methods.keys()).sort();
const expectedMethods = Array.from(expectedClass.methods.keys()).sort();
const methodDiff = diff(actualMethods, expectedMethods);
for (const methodName of methodDiff.extra)
for (const methodName of methodDiff.extra) {
const missingMethodsForClass = expectedNonExistingMethods.get(className);
const methodNameIsExpectedMissing = missingMethodsForClass ? missingMethodsForClass.has(methodName) : false;
if (methodNameIsExpectedMissing) continue;
jackfranklin marked this conversation as resolved.
Show resolved Hide resolved
errors.push(`Non-existing method found: ${className}.${methodName}()`);
}
for (const methodName of methodDiff.missing)
errors.push(`Method not found: ${className}.${methodName}()`);

Expand Down