diff --git a/.eslintrc b/.eslintrc index 63e41ad81faf2..31f3fbc235513 100644 --- a/.eslintrc +++ b/.eslintrc @@ -33,6 +33,7 @@ }, "additionalTagNames": { "customTags": [ + "closurePrimitive", "deprecated", "export", "final", diff --git a/build-system/config.js b/build-system/config.js index aa0bce4aa953b..c06064b7caad3 100644 --- a/build-system/config.js +++ b/build-system/config.js @@ -159,6 +159,7 @@ module.exports = { '!validator/webui/node_modules/**/*.*', '!build-system/tasks/e2e/node_modules/**/*.*', '!build-system/tasks/presubmit-checks.js', + '!build-system/runner/build/**/*.*', '!build-system/tasks/visual-diff/node_modules/**/*.*', '!build-system/tasks/visual-diff/snippets/*.js', '!build/polyfills.js', diff --git a/build-system/runner/dist/runner.jar b/build-system/runner/dist/runner.jar index 55ab374137bc0..8a18057ee724f 100644 Binary files a/build-system/runner/dist/runner.jar and b/build-system/runner/dist/runner.jar differ diff --git a/build-system/runner/src/org/ampproject/AmpCodingConvention.java b/build-system/runner/src/org/ampproject/AmpCodingConvention.java index 44e5f3a475ab3..df13d5b2bb443 100644 --- a/build-system/runner/src/org/ampproject/AmpCodingConvention.java +++ b/build-system/runner/src/org/ampproject/AmpCodingConvention.java @@ -44,26 +44,6 @@ public AmpCodingConvention(CodingConvention convention) { super(convention); } - @Override - public ImmutableCollection getAssertionFunctions() { - return ImmutableList.of( - AssertionFunctionSpec.forMatchesReturn().setFunctionName( - "module$src$log.devAssert").build(), - AssertionFunctionSpec.forMatchesReturn().setFunctionName( - "devAssert$$module$src$log").build(), - AssertionFunctionSpec.forMatchesReturn().setFunctionName( - "module$src$log.userAssert").build(), - AssertionFunctionSpec.forMatchesReturn().setFunctionName( - "userAssert$$module$src$log").build(), - AssertionFunctionSpec.forMatchesReturn().setFunctionName( - "assertService$$module$src$element_service").build(), - AssertionFunctionSpec.forMatchesReturn().setFunctionName( - "module$src$layout.assertLength").build(), - AssertionFunctionSpec.forMatchesReturn().setFunctionName( - "assertLength$$module$src$layout").build() - ); - } - /** * {@inheritDoc} * Because AMP objects can travel between compilation units, we consider diff --git a/src/element-service.js b/src/element-service.js index f6928d8f80b73..a15085b55b065 100644 --- a/src/element-service.js +++ b/src/element-service.js @@ -180,6 +180,7 @@ export function getElementServiceIfAvailableForDocInEmbedScope( * @param {string} extension * @return {!Object} * @private + * @closurePrimitive {asserts.matchesReturn} */ function assertService(service, id, extension) { return /** @type {!Object} */ (userAssert( diff --git a/src/layout.js b/src/layout.js index a3e8112864ce1..b53c1b1387b4e 100644 --- a/src/layout.js +++ b/src/layout.js @@ -194,6 +194,7 @@ export function parseLength(s) { * Asserts that the supplied value is a non-percent CSS Length value. * @param {!LengthDef|string|null|undefined} length * @return {!LengthDef} + * @closurePrimitive {asserts.matchesReturn} */ export function assertLength(length) { userAssert( @@ -209,6 +210,7 @@ export function assertLength(length) { * (including percent unit). * @param {!LengthDef|string} length * @return {!LengthDef} + * @closurePrimitive {asserts.matchesReturn} */ export function assertLengthOrPercent(length) { userAssert( diff --git a/src/log.js b/src/log.js index 544d8902b67ef..0c6f893504e87 100644 --- a/src/log.js +++ b/src/log.js @@ -317,7 +317,7 @@ export class Log { * @param {...*} var_args Arguments substituted into %s in the message. * @return {T} The value of shouldBeTrueish. * @template T - * eslint "google-camelcase/google-camelcase": 0 + * @closurePrimitive {asserts.matchesReturn} */ assert(shouldBeTrueish, opt_message, var_args) { let firstElement; @@ -360,7 +360,7 @@ export class Log { * @param {string=} opt_message The assertion message * @return {!Element} The value of shouldBeTrueish. * @template T - * eslint "google-camelcase/google-camelcase": 2 + * @closurePrimitive {asserts.matchesReturn} */ assertElement(shouldBeElement, opt_message) { const shouldBeTrueish = shouldBeElement && shouldBeElement.nodeType == 1; @@ -381,7 +381,7 @@ export class Log { * @param {*} shouldBeString * @param {string=} opt_message The assertion message * @return {string} The string value. Can be an empty string. - * eslint "google-camelcase/google-camelcase": 2 + * @closurePrimitive {asserts.matchesReturn} */ assertString(shouldBeString, opt_message) { this.assert( @@ -402,6 +402,7 @@ export class Log { * @param {string=} opt_message The assertion message * @return {number} The number value. The allowed values include `0` * and `NaN`. + * @closurePrimitive {asserts.matchesReturn} */ assertNumber(shouldBeNumber, opt_message) { this.assert( @@ -419,6 +420,7 @@ export class Log { * @param {*} shouldBeArray * @param {string=} opt_message The assertion message * @return {!Array} The array value + * @closurePrimitive {asserts.matchesReturn} */ assertArray(shouldBeArray, opt_message) { this.assert( @@ -437,6 +439,7 @@ export class Log { * @param {*} shouldBeBoolean * @param {string=} opt_message The assertion message * @return {boolean} The boolean value. + * @closurePrimitive {asserts.matchesReturn} */ assertBoolean(shouldBeBoolean, opt_message) { this.assert( @@ -456,7 +459,7 @@ export class Log { * @param {string=} opt_enumName * @return {T} * @template T - * eslint "google-camelcase/google-camelcase": 2 + * @closurePrimitive {asserts.matchesReturn} */ assertEnumValue(enumObj, s, opt_enumName) { if (isEnumValue(enumObj, s)) { @@ -731,7 +734,7 @@ export function isFromEmbed(win, opt_element) { * @param {*=} opt_9 Optional argument * @return {T} The value of shouldBeTrueish. * @template T - * eslint "google-camelcase/google-camelcase": 0 + * @closurePrimitive {asserts.matchesReturn} */ export function devAssert( shouldBeTrueish, @@ -790,7 +793,7 @@ export function devAssert( * @param {*=} opt_9 Optional argument * @return {T} The value of shouldBeTrueish. * @template T - * eslint "google-camelcase/google-camelcase": 0 + * @closurePrimitive {asserts.matchesReturn} */ export function userAssert( shouldBeTrueish,