File tree Expand file tree Collapse file tree 7 files changed +197
-2
lines changed
java/io/ecocode/javascript
resources/io/ecocode/profiles Expand file tree Collapse file tree 7 files changed +197
-2
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,16 @@ private CheckList() {
3434
3535 public static List <Class <? extends JavaScriptCheck >> getAllChecks () {
3636 return Arrays .asList (
37+ AvoidCSSAnimations .class ,
3738 AvoidHighAccuracyGeolocation .class ,
39+ LimitDbQueryResult .class ,
40+ NoEmptyImageSrcAttribute .class ,
3841 NoImportAllFromLibrary .class ,
3942 NoMultipleAccessDomElement .class ,
4043 NoMultipleStyleChanges .class ,
41- PreferCollectionsWithPagination .class
44+ PreferCollectionsWithPagination .class ,
45+ PreferShorthandCSSNotations .class ,
46+ ProvidePrintCSS .class
4247 );
4348 }
4449
Original file line number Diff line number Diff line change 1+ /*
2+ * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
3+ * Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+ package io .ecocode .javascript .checks ;
19+
20+ import org .sonar .check .Rule ;
21+ import org .sonar .plugins .javascript .api .EslintBasedCheck ;
22+ import org .sonar .plugins .javascript .api .JavaScriptRule ;
23+ import org .sonar .plugins .javascript .api .TypeScriptRule ;
24+
25+ @ JavaScriptRule
26+ @ TypeScriptRule
27+ @ Rule (key = AvoidCSSAnimations .RULE_KEY )
28+ public class AvoidCSSAnimations implements EslintBasedCheck {
29+
30+ public static final String RULE_KEY = "EC29" ;
31+
32+ @ Override
33+ public String eslintKey () {
34+ return "@ecocode/avoid-css-animations" ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
3+ * Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+ package io .ecocode .javascript .checks ;
19+
20+ import org .sonar .check .Rule ;
21+ import org .sonar .plugins .javascript .api .EslintBasedCheck ;
22+ import org .sonar .plugins .javascript .api .JavaScriptRule ;
23+ import org .sonar .plugins .javascript .api .TypeScriptRule ;
24+
25+ @ JavaScriptRule
26+ @ TypeScriptRule
27+ @ Rule (key = LimitDbQueryResult .RULE_KEY )
28+ public class LimitDbQueryResult implements EslintBasedCheck {
29+
30+ public static final String RULE_KEY = "EC24" ;
31+
32+ @ Override
33+ public String eslintKey () {
34+ return "@ecocode/limit-db-query-results" ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
3+ * Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+ package io .ecocode .javascript .checks ;
19+
20+ import org .sonar .check .Rule ;
21+ import org .sonar .plugins .javascript .api .EslintBasedCheck ;
22+ import org .sonar .plugins .javascript .api .JavaScriptRule ;
23+ import org .sonar .plugins .javascript .api .TypeScriptRule ;
24+
25+ @ JavaScriptRule
26+ @ TypeScriptRule
27+ @ Rule (key = NoEmptyImageSrcAttribute .RULE_KEY )
28+ public class NoEmptyImageSrcAttribute implements EslintBasedCheck {
29+
30+ public static final String RULE_KEY = "EC25" ;
31+
32+ @ Override
33+ public String eslintKey () {
34+ return "@ecocode/no-empty-image-src-attribute" ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
3+ * Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+ package io .ecocode .javascript .checks ;
19+
20+ import org .sonar .check .Rule ;
21+ import org .sonar .plugins .javascript .api .EslintBasedCheck ;
22+ import org .sonar .plugins .javascript .api .JavaScriptRule ;
23+ import org .sonar .plugins .javascript .api .TypeScriptRule ;
24+
25+ @ JavaScriptRule
26+ @ TypeScriptRule
27+ @ Rule (key = PreferShorthandCSSNotations .RULE_KEY )
28+ public class PreferShorthandCSSNotations implements EslintBasedCheck {
29+
30+ public static final String RULE_KEY = "EC26" ;
31+
32+ @ Override
33+ public String eslintKey () {
34+ return "@ecocode/prefer-shorthand-css-notations" ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
3+ * Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+ package io .ecocode .javascript .checks ;
19+
20+ import org .sonar .check .Rule ;
21+ import org .sonar .plugins .javascript .api .EslintBasedCheck ;
22+ import org .sonar .plugins .javascript .api .JavaScriptRule ;
23+ import org .sonar .plugins .javascript .api .TypeScriptRule ;
24+
25+ @ JavaScriptRule
26+ @ TypeScriptRule
27+ @ Rule (key = ProvidePrintCSS .RULE_KEY )
28+ public class ProvidePrintCSS implements EslintBasedCheck {
29+
30+ public static final String RULE_KEY = "EC30" ;
31+
32+ @ Override
33+ public String eslintKey () {
34+ return "@ecocode/provide-print-css" ;
35+ }
36+
37+ }
Original file line number Diff line number Diff line change 44 " EC8" ,
55 " EC9" ,
66 " EC11" ,
7- " EC12"
7+ " EC12" ,
8+ " EC24" ,
9+ " EC25" ,
10+ " EC26" ,
11+ " EC29" ,
12+ " EC30"
813 ]
914}
You can’t perform that action at this time.
0 commit comments