@ampproject/toolbox-linter
Advanced tools
Comparing version 2.5.1 to 2.5.2
@@ -28,2 +28,3 @@ "use strict"; | ||
const IsValid_1 = require("./rules/IsValid"); | ||
const TitleMeetsLengthCriteria_1 = require("./rules/TitleMeetsLengthCriteria"); | ||
const util_1 = require("util"); | ||
@@ -93,2 +94,3 @@ var LintMode; | ||
VideosAreSubtitled_1.VideosAreSubtitled, | ||
TitleMeetsLengthCriteria_1.TitleMeetsLengthCriteria, | ||
])); | ||
@@ -95,0 +97,0 @@ return tests.get(type) || []; |
@@ -9,5 +9,8 @@ "use strict"; | ||
$("meta").each(function (i, elem) { | ||
if (elem.attribs.property && | ||
if ((elem.attribs.property && | ||
elem.attribs.property.includes("og:image", 0) && | ||
elem.attribs.content) { | ||
elem.attribs.content) || | ||
(elem.attribs.name && | ||
elem.attribs.name.includes("og:image", 0) && | ||
elem.attribs.content)) { | ||
hasOGImage = true; | ||
@@ -14,0 +17,0 @@ return false; |
@@ -25,6 +25,6 @@ "use strict"; | ||
isLandscape: " a 4:3 aspect ratio", | ||
isAtLeast96x96: " 96x96 or larger", | ||
isAtLeast696x928: " 696x928px or larger", | ||
isAtLeast928x696: " 928x696px or larger", | ||
isAtLeast928x928: " 928x928px or larger", | ||
isAtLeast80x80: " at least 80x80px [96px+ recommended]", | ||
isAtLeast640x640: " 640x640px or larger", | ||
isAtLeast480x640: " 480x640px or larger [640x853px+ recommended]", | ||
isAtLeast640x480: " 640x480px or larger", | ||
}; | ||
@@ -34,11 +34,12 @@ class StoryMetadataThumbnailsAreOk extends rule_1.Rule { | ||
// Requirements are from | ||
// https://github.com/ampproject/amphtml/blob/master/extensions/amp-story/amp-story.md#new-metadata-requirements. | ||
// https://amp.dev/documentation/components/amp-story/#poster-guidelines-for-poster-portrait-src-poster-landscape-src-and-poster-square-src | ||
// Last Updated: June 8th, 2020 | ||
function isSquare({ width, height }) { | ||
return width === height; | ||
return width > 0.9 * height && width < 1.1 * height; | ||
} | ||
function isPortrait({ width, height }) { | ||
return width > 0.74 * height && width < 0.76 * height; | ||
return width > 0.65 * height && width < 0.85 * height; | ||
} | ||
function isLandscape({ width, height }) { | ||
return height > 0.74 * width && height < 0.76 * width; | ||
return height > 0.65 * width && height < 0.85 * width; | ||
} | ||
@@ -48,13 +49,13 @@ function isRaster({ mime }) { | ||
} | ||
function isAtLeast96x96({ width, height }) { | ||
return width >= 96 && height >= 96; | ||
function isAtLeast80x80({ width, height }) { | ||
return width >= 80 && height >= 80; | ||
} | ||
function isAtLeast928x928({ width, height }) { | ||
return width >= 928 && height >= 928; | ||
function isAtLeast640x640({ width, height }) { | ||
return width >= 640 && height >= 640; | ||
} | ||
function isAtLeast696x928({ width, height }) { | ||
return width >= 696 && height >= 928; | ||
function isAtLeast480x640({ width, height }) { | ||
return width >= 480 && height >= 640; | ||
} | ||
function isAtLeast928x696({ width, height }) { | ||
return width >= 928 && height >= 696; | ||
function isAtLeast640x480({ width, height }) { | ||
return width >= 640 && height >= 480; | ||
} | ||
@@ -91,2 +92,3 @@ const metadata = inlineMetadata(context.$); | ||
}); | ||
console.log("here ", failed); | ||
//Remove the last ' and' + tack on the src | ||
@@ -97,7 +99,7 @@ m = m.slice(0, m.length - 4) + `\nsrc: ${url}`; | ||
const res = [ | ||
assert("publisher-logo-src", true, [isRaster, isSquare, isAtLeast96x96]), | ||
assert("publisher-logo-src", true, [isRaster, isSquare, isAtLeast80x80]), | ||
assert("poster-portrait-src", true, [ | ||
isRaster, | ||
isPortrait, | ||
isAtLeast696x928, | ||
isAtLeast480x640, | ||
]), | ||
@@ -107,3 +109,3 @@ assert("poster-square-src", false, [ | ||
isSquare, | ||
isAtLeast928x928, | ||
isAtLeast640x640, | ||
]), | ||
@@ -113,3 +115,3 @@ assert("poster-landscape-src", false, [ | ||
isLandscape, | ||
isAtLeast928x696, | ||
isAtLeast640x480, | ||
]), | ||
@@ -116,0 +118,0 @@ ]; |
{ | ||
"name": "@ampproject/toolbox-linter", | ||
"version": "2.5.1", | ||
"version": "2.5.2", | ||
"description": "A linter for AMP documents", | ||
@@ -17,3 +17,3 @@ "repository": { | ||
"amphtml-validator": "1.0.31", | ||
"chalk": "4.0.0", | ||
"chalk": "4.1.0", | ||
"cheerio": "1.0.0-rc.3", | ||
@@ -45,3 +45,3 @@ "commander": "5.1.0", | ||
}, | ||
"gitHead": "f92ba13281ecf3e624ee8285f2deebee18d580bd", | ||
"gitHead": "0e67c978f403a0f68d5b876010d5eb1a5ae205d9", | ||
"devDependencies": { | ||
@@ -48,0 +48,0 @@ "prettier": "2.0.5", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
320184
135
5182
+ Addedchalk@4.1.0(transitive)
- Removedchalk@4.0.0(transitive)
Updatedchalk@4.1.0