Skip to content

Commit

Permalink
Add rule "Prefer lighter formats for image files"
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Leroux <leroux.lucas@hotmail.com>
Co-authored-by: Vincent-Letourmy <letourmyvincent@outlook.fr>
  • Loading branch information
3 people committed May 30, 2024
1 parent 1cb9478 commit a1d3a8b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#315](https://github.com/green-code-initiative/ecoCode/pull/315) Add rule EC530 for javascript
- [#321](https://github.com/green-code-initiative/ecoCode/pull/321) Add rule EC522 for javascript (avoid brightness override)
- [#???](https://github.com/green-code-initiative/ecoCode/pull/???) Implementing rule EC31 for javascript (prefer lighter formats for image files)

### Changed

Expand Down
2 changes: 1 addition & 1 deletion RULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Some are applicable for different technologies.
| EC28 | Optimize read file exceptions | | || 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
| EC29 | Avoid usage of CSS animations | ESLint key : @ecocode/avoid-css-animations /// type : Front-end | ||||||| 🚫 |
| EC30 | Provide a print stylesheet | ESLint key : @ecocode/provide-print-css /// type : Front-end | ||||||| 🚫 |
| EC31 | Prefer lighter formats for image files | ESLint key : ... /// type : ... | ||| 🚀 |||| 🚀 |
| EC31 | Prefer lighter formats for image files | ESLint key : ... /// type : ... | ||| |||| 🚀 |
| EC32 | Initialize builder/buffer with the appropriate size | If you know in advance how many characters would be appended, initialize builder/buffer with the appropriate size. They will thus never have to be resized. This saves CPU cycles and therefore consumes less energy. | || 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |
| EC35 | Using try...catch calls (on File Not Found error) | When an exception is thrown, a variable (the exception itself) is created in the catch block and destroyed at the end of the block. Creating this variable and destroying it consumes CPU cycles and RAM unnecessarily. That is why it is important not to use this construction and to prefer, as much as possible, a logical test. This new rule replace old EC34 only for a particular use case (FileNotFoundException) | [cnumr best practices (3rd edition) BP_047 (no longer exists in edition 4)](https://www.greenit.fr/2019/05/07/ecoconception-web-les-115-bonnes-pratiques-3eme-edition/) | 🚫 || 🚀 || 🚀 | 🚫 | 🚫 |
| EC36 | Avoid autoplay for videos and audio content | Autoplaying media consumes unnecessary energy, especially when users might not be actively engaging with the content. | [cnumr best practices BP_4003](https://github.com/cnumr/best-practices/blob/main/chapters/BP_4003_en.md) | 🚫 | 🚫 | 🚀 | 🚫 | 🚫 | 🚫 | 🚧 |
Expand Down

0 comments on commit a1d3a8b

Please sign in to comment.