green-code-initiative / ecocode-javascript Goto Github PK
View Code? Open in Web Editor NEWReduce the environmental footprint of your JS/TS software programs
Home Page: https://ecocode.io
License: GNU General Public License v3.0
Reduce the environmental footprint of your JS/TS software programs
Home Page: https://ecocode.io
License: GNU General Public License v3.0
Team 5R
In JS, we can write strings inside :
By using backticks, we can inject variables that will be evaluated on runtime, just like that :
console.log(`this is my ${variable} content.`);
I made a simple jsperf test to evaluate the performance between each approach.
<!-- HTML -->
<p id="my-para"></p>
// JS. Test 1.
document.getElementById('my-para').textContent = 'A few words...';
// JS. Test 2.
document.getElementById('my-para').textContent = "A few words...";
// JS. Test 3.
document.getElementById('my-para').textContent = `A few words...`;
Here are the results :
A dedicated rule?
Backticks without interpolation needs should be avoid.
Hello,
I'm Alex, Product Manager at Sonar.
SonarQube 10.4 will come with a feature to only download Sonar analyzers and 3rd-party plugins when they are really required by the Scanner. To make this feature work, each analyzer or 3rd-party plugin should declare the list of languages on which they expect to raise issues through a new MANIFEST property called Plugin-RequiredForLanguages.
See https://community.sonarsource.com/t/the-sonarscanners-download-only-required-3rd-party-plugins/108156 for more details.
Regards
Rule EC31 can be implemented in the plugin, for React/JSX.
Rule description in the ecoCode repository: green-code-initiative/ecoCode#269
If you start this task during the challenge, I suggest you leave a comment with your team's name to let us know you've taken it. Then, you can link your PR so that we can easily keep track of the work you've done. Thank you and enjoy the challenge!
Plugin has been submitted to the SonarQube Marketplace!
Even though the request was accepted (🥳), there are a few improvements to be made to the plugin for future versions. Here are the suggestions proposed by Ann:
Implements rules EC522 "avoid brightness override" for react native and expo framework by team Lanthanum
No response
No response
No response
Implements rules EC522 "avoid keep awake (screen on)" for react native and expo framework
No response
No response
No response
I made a series of pull request proposing new rules for the eslint plugin, those rules need to be added to SonarQube for proper integration.
React Native is a framework that allows for the development of mobile applications for iOS and Android using the JavaScript language. It would be interesting to develop rules for React Native in this project.
No response
No response
No response
Rule EC36 can be implemented in the plugin, for React/JSX.
Rule description in the ecoCode repository: green-code-initiative/ecoCode#298
If you start this task during the challenge, I suggest you leave a comment with your team's name to let us know you've taken it. Then, you can link your PR so that we can easily keep track of the work you've done. Thank you and enjoy the challenge!
ESLint exports a package @types/eslint
with typings of the whole linter. This can simplify the writing of rules with autocompletion and typing verification.
This idea has been proposed during the challenge, and I think it's a good idea to look into it.
Maybe we should use it? What do you think of this?
Due to the use of an external ESLint plugin, JavaScript rules are not displayed in the SonarQube interface and cannot be associated to a quality profile. Maybe we can find a way to work around this restriction of SonarQube to improve and simplify the configuration of the rules?
Any ideas are welcome, I will also do a lot of tests on my side.
The idea is to create a linter to check HTML files, using the rule to avoir autoplay parameter on
Rule proposal here : green-code-initiative/ecoCode-challenge#49
First checking if it is possible to send eslint report for HTML files ton Sonar.
(Description will be update)
It might be interesting to start with the idea given by a group of spotters at the 2023 hackathon:
green-code-initiative/ecoCode-challenge#37
And perhaps extend it a little to advise against using certain old or resource-hungry libraries?
CNumR doc is also here
Important
This rule has not yet been implemented in the ecoCode rules repository.
But I think it's worth exploring during the challenge! And think about a suitable implementation.
Now that ecoCode JavaScript plugin is standalone, it's time to prepare its arrival on the SonarQube marketplace 🚀
Below is the todo-list, based on the one created by @jycr for other plugins.
EC
prefix followed by a number) (Do not forget to add @DeprecatedRuleKey
annotation when needed)More information:
Based on the enhancement done in #16 for the Sonar plugin, the idea would be to import rules specifications for the ESLint plugin from central repository too.
There are few limitations because at the moment the artifact is created using Maven with .html
and .json
files inside. But for the ESLint plugin we need to have a package that can be used by NPM with .md
files inside. The main goal is to find a way to generate a package like this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.