Skip to content

Andersclark/eslint-plugin-sustainable

Repository files navigation

eslint-plugin-sustainable

About this project

Keep the climate impact of code low!

The code, infrastructure and devices supporting the internet emits around the same amount of Carbon Dioxide (CO2) as the global airline industry.

As authors of code, we can affect how applications affect climate change by making sure we avoid anti-patterns that unecessarily consume resources.

The goal of this project is to follow the development of the W3C's Sustainability Guidelines.

You can read more about this topic on The Green Web Foundation's website.

Installation

If your project is not currently using ESlint, you will first need to install it ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-sustainable:

npm install eslint-plugin-sustainable --save-dev

Usage

Add sustainable to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["sustainable"]
}

Rules

Name                             Description
avoid-inefficient-image Avoid inefficient image formats
avoid-media-autoplay Autplaying media loads data that may not be consumed by the user
avoid-using-accurate-geolocation High accuracy geolocation consumes more power and returns result slower