Skip to content

Commit

Permalink
[ec36-avoid-autoplay] add reference rgesn
Browse files Browse the repository at this point in the history
  • Loading branch information
chihebtalan committed May 29, 2024
1 parent 166d1ad commit f067a0f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions eslint-plugin/lib/rules/avoid-autoplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ module.exports = {
recommended: "warn",
},
messages: {
NoAutoplay: "Avoid using autoplay attribute for <video> and <audio> elements.",
EnforcePreloadNone: "Set preload='none' for <video> and <audio> elements.",
NoAutoplay_EnforcePreloadNone: "Avoid using autoplay attribute and set preload='none' for <video> and <audio> elements.",
NoAutoplay: "Avoid using autoplay attribute for <video> and <audio> elements. Reference to Rule RGESN 4.1 : https://www.arcep.fr/mes-demarches-et-services/entreprises/fiches-pratiques/referentiel-general-ecoconception-services-numeriques.html",
EnforcePreloadNone: "Set preload='none' for <video> and <audio> elements. Reference to Rule RGESN 4.1 : https://www.arcep.fr/mes-demarches-et-services/entreprises/fiches-pratiques/referentiel-general-ecoconception-services-numeriques.html",
NoAutoplay_EnforcePreloadNone: "Avoid using autoplay attribute and set preload='none' for <video> and <audio> elements. Reference to Rule RGESN 4.1 : https://www.arcep.fr/mes-demarches-et-services/entreprises/fiches-pratiques/referentiel-general-ecoconception-services-numeriques.html ",
},
schema: [],
},
Expand All @@ -45,18 +45,17 @@ module.exports = {
(attr) => attr.name.name === "preload",
);
if(autoplayAttr && (!preloadAttr || preloadAttr.value.value !== "none")) {
// console.log("NoAutoplay_EnforcePreloadNone")
context.report({
node: autoplayAttr||preloadAttr,
messageId: "NoAutoplay_EnforcePreloadNone",
});
}
else {
if (autoplayAttr) {
//console.log("NoAutoplay", autoplayAttr)
context.report({
node: autoplayAttr,
messageId: "NoAutoplay",

});
}

Expand Down

0 comments on commit f067a0f

Please sign in to comment.