Skip to content
View ec0lint's full-sized avatar

Block or report ec0lint

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
ec0lint/README.md

ec0lint

npm version Downloads Build Status Open Collective Sponsors Linkedin

Website | Configuring | Rules

ec0lint is a static code analysis tool that provides users with hints on how to reduce the carbon footprint of their websites during the development process. Applying code changes suggested by ec0lint results in lower carbon emissions per visit, quicker loading and higher space efficiency. The tool is open-source and community-driven.

Our goal

Did you know that more than 250 000 websites are published every day?

The majority uses too heavy fonts, too large/unnecessary images or utilises redundant libraries. These and other factors generate the carbon footprint. Actually, one view of an average website emits 1.8 g CO2 which sums up to 216 kg CO2 annually. Unfortunately, current solutions optimise only already existing websites.

ec0lint is a tool for frontend developers that mitigates the carbon footprint of websites. It shows tips advising how to create a more climate-friendly code. Thanks to code optimization ec0lint can help in reducing CO2 emissions per one view from 1.8 g to ~0.2 g saving 198 kg CO2 (-88%!) annually.

The tool is customized and each rule applied during the analysis can be adjusted, or treated as hints rather than errors. This flexibility allows the developers to reach their goals without interruptions from ec0lint, at the same time drawing attention to possible improvements.

Get started

Make sure you have Node installed

(a) If your code contains CSS files

Download ec0lint:

npm i ec0lint ec0lint-style ec0lint-style-config-recommended

Configure your project:

npm init @ec0lint/config

Create a .ec0lint-stylerc.json configuration file in the root of your project with the following content:

{ "extends": "ec0lint-style-config-recommended" }

(b) If your code contains LESS, SASS/SCSS files

npm i ec0lint ec0lint-style ec0lint-style-config-recommended-scss

Configure your project:

npm init @ec0lint/config

Create a .ec0lint-stylerc.json configuration file in the root of your project with the following content:

{ "extends": "ec0lint-style-config-recommended-scss" }

(c) If your code contains PostCSS / Tailwind

npm i ec0lint ec0lint-style ec0lint-style-config-postcss

Configure your project:

npm init @ec0lint/config

Create a .ec0lint-stylerc.json configuration file in the root of your project with the following content:

{ "extends": "ec0lint-style-config-postcss" }

If you use React

Install React plugin (or use npm init):

npm i ec0lint-plugin-react

Add to your .ec0lintrc.json configuration file:

 "extends": [
    "ec0lint:recommended",
    "plugin:react/recommended"
  ]

Run ec0lint

Split your terminal and run:

npx ec0lint-style "**/*.scss" npx ec0lint .

Let's build an eco-friendly website!

Release plan

✅ v1.0.0 - June - MVP

  • ✅ Lighter HTTP (lighter-http, ec0lint)
  • ✅ Font format (no-ttf-font-files, ec0lint-style)
  • ✅ Image format validation (lighter-image-formats, ec0lint-style)
  • ✅ Light libraries - lodash (avoid-lodash, ec0lint)
  • ✅ Light libraries - date-fns (no-date-fns, ec0lint)
  • ✅ Light libraries - moment.js (no-moment-js, ec0lint)

✅ v2.0.0 - October - CO2 modules + React plugin

  • ✅ CO2 calculation (ec0lint)
  • ✅ CO2 calculation (ec0lint-style)
  • ✅ Plugin React (ec0lint-plugin-react)
  • ✅ Light libraries - jQuery Ajax (no-ajax, ec0lint)
  • ✅ Light libraries - jQuery Ajax events (no-ajax-events, ec0lint)
  • ✅ Font-display (require-font-display, ec0lint-style)

✅ v2.1.0 - January - 20 rule implementations, 15 unique rules

  • ✅ Image format (lighter-image-formats, ec0lint)
  • ✅ Video format (lighter-video-formats, ec0lint)
  • ✅ Plugin HTML (ec0lint-plugin-html)
  • ✅ Lazy loading (require-lazy-loading, ec0lint-plugin-html)
  • ✅ Font source (no-hosted-online-fonts, ec0lint-style)
  • ✅ Light libraries - jQuery andSelf (no-and-self, ec0lint)
  • ✅ Light libraries – jQuery Animate (no-animate, ec0lint)
  • ✅ Light libraries – jQuery Attr (no-attr, ec0lint)
  • ✅ Light libraries – jQuery Bind (no-bind, ec0lint)
  • ✅ Video auto-play (require-auto-play, ec0lint)

🔨 v3.0.0 - April - IDE plugins + resources scanning

  • ☑️ VSCode plugin ec0lint
  • 🔨 VSCode plugin ec0lint-style
  • 🔨 IntelliJ plugin ec0lint
  • 🔨 IntelliJ plugin ec0lint-style
  • 🔨 Colors validation (background-color-validation, ec0lint-style)
  • 🔨 Image size (image-size-validation, ec0lint-style)
  • 🔨 Video size (video-size-validation, ec0lint-style)
  • ☑️ Light libraries – jQuery Box Model (no-box-model, ec0lint)
  • ☑️ Light libraries – jQuery Browser (no-browser, ec0lint)

🔒 v4.0.0 - June - TypeScript plugin

  • TypeScript plugin (ec0lint-plugin-typescript)
  • Lighter HTTP (lighter-http, ec0lint-plugin-typescript)
  • Light libraries - lodash (avoid-lodash, ec0lint-plugin-typescript)
  • Light libraries - date-fns (no-date-fns, ec0lint-plugin-typescript)
  • Light libraries - moment.js (no-moment-js, ec0lint-plugin-typescript)
  • Light libraries - jQuery Ajax (no-ajax, ec0lint-plugin-typescript)
  • Light libraries - jQuery Ajax events (no-ajax-events ec0lint-plugin-typescript)
  • Video format (lighter-video-formats, ec0lint-plugin-typescript)
  • Lazy loading (require-lazy-loading, ec0lint-plugin-typescript)
  • Video auto-play (require-auto-play, ec0lint-plugin-typescript)

🔒 v5.0.0 - September - CI/CD report

  • CI/CD report
  • research - user tracking scripts
  • research - dark mode
  • research - new rules
  • new rules

Next:

  • 🔒 Website budget
  • 🔒 Angular plugin
  • 🔒 Vue plugin
  • 🔒 --fix option

Legend:

  • ✅ released
  • ☑️ implemented, not yet released
  • 🔨 in progress
  • 🍀 task to take
  • 🔒 to do in future releases

How to start contributing

If you wish to contribute, just write to us and start coding!

You can look at tasks marked as 🍀 or at our issues (https://github.com/ec0lint/ec0lint/issues) and search for a task for you.

Thank you!

We are open to collaboration on improving ec0lint, and we are very grateful for all contributions and feedback on the tool. Thank you for creating sustainable digital environment with us!

Conctact: ec0lint@tutanota.com

Popular repositories Loading

  1. ec0lint ec0lint Public

    Create sustainable digital environment with ec0lint

    JavaScript 152 5

  2. ec0lint-style ec0lint-style Public

    CSS linter working with ec0lint, checking styles and static resources

    JavaScript 8 2

  3. landing-page landing-page Public

    Landing page of ec0lint

    TypeScript 6

  4. create-config create-config Public

    Utility to create ec0lint config files

    JavaScript 5

  5. ec0lintrc ec0lintrc Public

    ec0lint configuration

    JavaScript 5

  6. ec0lint-style-config-recommended ec0lint-style-config-recommended Public

    The recommended shareable config for ec0lint-css

    JavaScript 5 1