Skip to content

Commit 370ffc1

Browse files
authored
Add EC530 to javascript (#315)
1 parent df4c4e2 commit 370ffc1

6 files changed

Lines changed: 54 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- [#315](https://github.com/green-code-initiative/ecoCode/pull/315) Add rule EC530 for javascript
13+
1214
### Changed
1315

1416
### Deleted

ecocode-rules-specifications/src/main/rules/EC530/EC530.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
"func": "Constant\/Issue",
77
"constantCost": "5min"
88
},
9-
"tags": [
10-
"sobriety",
11-
"environment",
12-
"ecocode",
13-
"android",
14-
"ios",
15-
"eco-design"
16-
],
179
"ecoScore": "0.4",
1810
"defaultSeverity": "Major"
1911
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"tags": [
3+
"sobriety",
4+
"environment",
5+
"ecocode",
6+
"android",
7+
"eco-design"
8+
]
9+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
== Why is this an issue?
2+
3+
Turning on the torch mode programmatically with `react-native-torch` must absolutely be avoided because the flashlight is one of the most energy-intensive component.
4+
5+
## Non compliant Code Example
6+
7+
[source,js,data-diff-id="2",data-diff-type="noncompliant"]
8+
----
9+
import Torch from 'react-native-torch'; // Non-compliant
10+
----
11+
12+
[source,js,data-diff-id="2",data-diff-type="compliant"]
13+
----
14+
import axios from 'axios'; // Compliant
15+
----
16+
17+
== Resources
18+
19+
=== Documentation
20+
21+
- [CNUMR best practices mobile](https://github.com/cnumr/best-practices-mobile) - Torch free
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"tags": [
3+
"sobriety",
4+
"environment",
5+
"ecocode",
6+
"react-native",
7+
"eco-design"
8+
],
9+
"compatibleLanguages": [
10+
"JAVASCRIPT",
11+
"TYPESCRIPT"
12+
]
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"tags": [
3+
"sobriety",
4+
"environment",
5+
"ecocode",
6+
"ios",
7+
"eco-design"
8+
]
9+
}

0 commit comments

Comments
 (0)