-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from green-code-initiative/no-css-animations
Add test file for "No css animations" rule
- Loading branch information
Showing
7 changed files
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import lodash from "lodash"; | ||
import * as _ from "underscore"; | ||
import lodash from "lodash"; // Non-compliant: lodash is entirely loaded | ||
import * as _ from "underscore"; // Non-compliant: underscore is entirely loaded | ||
|
||
lodash.isEmpty(""); | ||
_.isEmpty(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
//OK | ||
let query = "SELECT * FROM customers LIMIT 10;"; | ||
query = "SELECT TOP 5 * FROM products;"; | ||
query = "SELECT * FROM orders FETCH FIRST 20 ROWS ONLY;"; | ||
import mysql from "mysql2"; | ||
|
||
// Compliant | ||
let query = "SELECT * FROM customers LIMIT 10"; | ||
query = "SELECT TOP 5 * FROM products"; | ||
query = "SELECT * FROM orders FETCH FIRST 20 ROWS ONLY"; | ||
query = | ||
"WITH numbered_customers AS (SELECT *, ROW_NUMBER() OVER (ORDER BY customer_id) AS row_num FROM customers) SELECT * FROM numbered_customers WHERE row_num <= 50;"; | ||
"WITH numbered_customers AS (SELECT *, ROW_NUMBER() OVER (ORDER BY customer_id) AS row_num FROM customers) SELECT * FROM numbered_customers WHERE row_num <= 50"; | ||
|
||
// Non-compliant | ||
query = "SELECT id FROM bikes"; | ||
|
||
//NOK | ||
query = "SELECT id FROM bikes;"; | ||
// Sample to execute the query | ||
const connection = mysql.createConnection({ | ||
host: "localhost", | ||
user: "root", | ||
database: "test", | ||
}); | ||
connection.query(query, function (_, results, fields) { | ||
console.log(results); | ||
console.log(fields); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import isEmpty from "lodash/isEmpty"; | ||
import isEmpty from "lodash/isEmpty"; // Compliant | ||
|
||
isEmpty(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
|
||
function AnimatedComponent() { | ||
return ( | ||
<div> | ||
{/* Compliant */} | ||
<div style={{ border: "5px solid red" }}></div> | ||
<div class="my-awesome-element"></div> | ||
|
||
{/* Non-compliant */} | ||
<div style={{ animation: "background 0.3s ease" }}></div> | ||
</div> | ||
); | ||
} | ||
|
||
export default AnimatedComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters