diff --git a/CHANGELOG.md b/CHANGELOG.md index b039089..1eb99c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- [#40](https://github.com/green-code-initiative/creedengo-javascript/pull/40) Add rule `@creedengo/avoid-autoplay` (GCI36) + ## [2.0.0] - 2025-01-22 ### Added diff --git a/eslint-plugin/README.md b/eslint-plugin/README.md index 34147e3..0285cea 100644 --- a/eslint-plugin/README.md +++ b/eslint-plugin/README.md @@ -76,6 +76,7 @@ Add `@creedengo` to the `plugins` section of your `.eslintrc`, followed by rules | Name | Description | ⚠️ | | :------------------------------------------------------------------------------------- | :-------------------------------------------------------- | :- | +| [avoid-autoplay](docs/rules/avoid-autoplay.md) | Avoid autoplay for videos and audio content | ✅ | | [avoid-brightness-override](docs/rules/avoid-brightness-override.md) | Should avoid to override brightness | ✅ | | [avoid-css-animations](docs/rules/avoid-css-animations.md) | Avoid usage of CSS animations | ✅ | | [avoid-high-accuracy-geolocation](docs/rules/avoid-high-accuracy-geolocation.md) | Avoid using high accuracy geolocation in web applications | ✅ | diff --git a/eslint-plugin/docs/rules/avoid-autoplay.md b/eslint-plugin/docs/rules/avoid-autoplay.md new file mode 100644 index 0000000..738860a --- /dev/null +++ b/eslint-plugin/docs/rules/avoid-autoplay.md @@ -0,0 +1,44 @@ +# Avoid autoplay for videos and audio content (`@creedengo/avoid-autoplay`) + +⚠️ This rule _warns_ in the ✅ `recommended` config. + + + +## Why is this an issue? + +Automatic videos and audio files activation (autoplay) during web pages loading uses resources on each tier (device, +network, data center). In many cases, automatic playback is not necessary. Moreover, it can draw users' attention and +distract them from the initially requested service. Therefore, whenever possible, these playbacks should be initiated by +the users and by not using the autoplay attributes in the `