From 40dba0289786f34aa97df565a0925c563cd65fa3 Mon Sep 17 00:00:00 2001 From: lexik04 Date: Wed, 23 Oct 2024 15:15:04 -0400 Subject: [PATCH 01/10] added example test to see standardjs working --- test/standardjs.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/standardjs.js diff --git a/test/standardjs.js b/test/standardjs.js new file mode 100644 index 0000000000..3a946c7064 --- /dev/null +++ b/test/standardjs.js @@ -0,0 +1,21 @@ +// This is a simple function that adds two numbers +function add(a, b) { + return a + b + } + + // This function checks if a number is even + function isEven(num) { + return num % 2 === 0 + } + + // Example usage + const numbers = [1, 2, 3, 4, 5] + const evenNumbers = numbers.filter(isEven) + + console.log('Even numbers:', evenNumbers) + + // A function that demonstrates a simple loop + for (let i = 0; i < numbers.length; i++) { + console.log(`Number ${numbers[i]} is ${isEven(numbers[i]) ? 'even' : 'odd'}`) + } + \ No newline at end of file From 87f8c9f933ac2d1fc4567feb5e54c634d7fc9a50 Mon Sep 17 00:00:00 2001 From: lexik04 Date: Wed, 23 Oct 2024 15:19:20 -0400 Subject: [PATCH 02/10] removed unnecessary comments and added chatgpt citation --- test/standardjs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/standardjs.js b/test/standardjs.js index 3a946c7064..e0c06771ac 100644 --- a/test/standardjs.js +++ b/test/standardjs.js @@ -1,20 +1,20 @@ -// This is a simple function that adds two numbers +// Generated by ChatGPT function add(a, b) { return a + b } - // This function checks if a number is even + function isEven(num) { return num % 2 === 0 } - // Example usage + const numbers = [1, 2, 3, 4, 5] const evenNumbers = numbers.filter(isEven) console.log('Even numbers:', evenNumbers) - // A function that demonstrates a simple loop + for (let i = 0; i < numbers.length; i++) { console.log(`Number ${numbers[i]} is ${isEven(numbers[i]) ? 'even' : 'odd'}`) } From dd130021c37f366f4fe411ed45b1975789770e04 Mon Sep 17 00:00:00 2001 From: lexik04 Date: Tue, 29 Oct 2024 20:30:19 -0400 Subject: [PATCH 03/10] Used the npx standard --fix command on the test file so that it automatically fixes the code --- test/standardjs.js | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/test/standardjs.js b/test/standardjs.js index e0c06771ac..0d57cebdda 100644 --- a/test/standardjs.js +++ b/test/standardjs.js @@ -1,21 +1,13 @@ // Generated by ChatGPT -function add(a, b) { - return a + b - } - +function isEven (num) { + return num % 2 === 0 +} - function isEven(num) { - return num % 2 === 0 - } - +const numbers = [1, 2, 3, 4, 5] +const evenNumbers = numbers.filter(isEven) - const numbers = [1, 2, 3, 4, 5] - const evenNumbers = numbers.filter(isEven) - - console.log('Even numbers:', evenNumbers) - +console.log('Even numbers:', evenNumbers) - for (let i = 0; i < numbers.length; i++) { - console.log(`Number ${numbers[i]} is ${isEven(numbers[i]) ? 'even' : 'odd'}`) - } - \ No newline at end of file +for (let i = 0; i < numbers.length; i++) { + console.log(`Number ${numbers[i]} is ${isEven(numbers[i]) ? 'even' : 'odd'}`) +} From f7737926c21cbb9ce3b140b22eeb2ec3b48525a3 Mon Sep 17 00:00:00 2001 From: lexik04 Date: Tue, 29 Oct 2024 20:51:58 -0400 Subject: [PATCH 04/10] changed files back to last state to match standardjs rules and not eslint rules because they differ --- test/iroh.js | 5 ----- test/standardjs.js | 15 +++++++++------ 2 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 test/iroh.js diff --git a/test/iroh.js b/test/iroh.js deleted file mode 100644 index 2eda46a5d4..0000000000 --- a/test/iroh.js +++ /dev/null @@ -1,5 +0,0 @@ -function factorial(n) { - if (n === 0) return 1; - return n * factorial(n - 1); - }; - diff --git a/test/standardjs.js b/test/standardjs.js index 0d57cebdda..2b2fe357ea 100644 --- a/test/standardjs.js +++ b/test/standardjs.js @@ -1,13 +1,16 @@ +'use strict'; + // Generated by ChatGPT -function isEven (num) { - return num % 2 === 0 + +function isEven(num) { + return num % 2 === 0; } -const numbers = [1, 2, 3, 4, 5] -const evenNumbers = numbers.filter(isEven) +const numbers = [1, 2, 3, 4, 5]; +const evenNumbers = numbers.filter(isEven); -console.log('Even numbers:', evenNumbers) +console.log('Even numbers:', evenNumbers); for (let i = 0; i < numbers.length; i++) { - console.log(`Number ${numbers[i]} is ${isEven(numbers[i]) ? 'even' : 'odd'}`) + console.log(`Number ${numbers[i]} is ${isEven(numbers[i]) ? 'even' : 'odd'}`); } From 88a8fecee73cb25a5cf1807191b0888d4d439124 Mon Sep 17 00:00:00 2001 From: lexik04 Date: Tue, 29 Oct 2024 21:02:19 -0400 Subject: [PATCH 05/10] Final code that uses StandardJS rules, not eslint rules will fail pr due to this --- test/standardjs.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/standardjs.js b/test/standardjs.js index 2b2fe357ea..040e23c421 100644 --- a/test/standardjs.js +++ b/test/standardjs.js @@ -1,16 +1,16 @@ -'use strict'; +'use strict' // Generated by ChatGPT -function isEven(num) { - return num % 2 === 0; +function isEven (num) { + return num % 2 === 0 } -const numbers = [1, 2, 3, 4, 5]; -const evenNumbers = numbers.filter(isEven); +const numbers = [1, 2, 3, 4, 5] +const evenNumbers = numbers.filter(isEven) -console.log('Even numbers:', evenNumbers); +console.log('Even numbers:', evenNumbers) for (let i = 0; i < numbers.length; i++) { - console.log(`Number ${numbers[i]} is ${isEven(numbers[i]) ? 'even' : 'odd'}`); + console.log(`Number ${numbers[i]} is ${isEven(numbers[i]) ? 'even' : 'odd'}`) } From 8b302eb8ad6ddfc2f8b92d365d1c85e271fcc0b3 Mon Sep 17 00:00:00 2001 From: lexik04 Date: Wed, 30 Oct 2024 17:26:28 -0400 Subject: [PATCH 06/10] attempting to disable eslint --- test/standardjs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/standardjs.js b/test/standardjs.js index 040e23c421..68f22ded78 100644 --- a/test/standardjs.js +++ b/test/standardjs.js @@ -1,4 +1,4 @@ -'use strict' +/* eslint-disable */ // Generated by ChatGPT From eac806e3b5fc8b26b504913d1c6e923e3947ebf0 Mon Sep 17 00:00:00 2001 From: lexik04 Date: Thu, 31 Oct 2024 18:16:18 -0400 Subject: [PATCH 07/10] added more details to the comments in the code --- test/standardjs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/standardjs.js b/test/standardjs.js index 68f22ded78..7daf0dc906 100644 --- a/test/standardjs.js +++ b/test/standardjs.js @@ -1,6 +1,6 @@ /* eslint-disable */ -// Generated by ChatGPT +// Generated by ChatGPT to test StandardJS abilities function isEven (num) { return num % 2 === 0 From 6299f7424bbd9a7e0c4a4a31d274856b7f319c59 Mon Sep 17 00:00:00 2001 From: lexik04 Date: Thu, 31 Oct 2024 18:26:05 -0400 Subject: [PATCH 08/10] added more context --- test/standardjs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/standardjs.js b/test/standardjs.js index 7daf0dc906..d2a108613c 100644 --- a/test/standardjs.js +++ b/test/standardjs.js @@ -1,6 +1,6 @@ /* eslint-disable */ -// Generated by ChatGPT to test StandardJS abilities +// Generated by ChatGPT to test StandardJS abilities for catching and fixing errors function isEven (num) { return num % 2 === 0 From d7caee9986253aeb6e401f3443a8dc6abee7c38b Mon Sep 17 00:00:00 2001 From: Andrew Youn <52907065+ay0503@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:36:06 -0400 Subject: [PATCH 09/10] Add workflow comment to test file. --- test/standardjs.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/standardjs.js b/test/standardjs.js index d2a108613c..0aa5fbf81c 100644 --- a/test/standardjs.js +++ b/test/standardjs.js @@ -1,6 +1,7 @@ /* eslint-disable */ // Generated by ChatGPT to test StandardJS abilities for catching and fixing errors +// This file is the only file that is checked by the workflow. function isEven (num) { return num % 2 === 0 From 0c4d651856ba418035d2b33e00da3c04a7919fb7 Mon Sep 17 00:00:00 2001 From: Andrew Youn <52907065+ay0503@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:41:41 -0400 Subject: [PATCH 10/10] Update standard-js.yml --- .github/workflows/standard-js.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/standard-js.yml b/.github/workflows/standard-js.yml index 584ba57e49..c7d3ce2921 100644 --- a/.github/workflows/standard-js.yml +++ b/.github/workflows/standard-js.yml @@ -26,8 +26,8 @@ jobs: run: npm install - name: Run StandardJS on standardjs.js - working-directory: ./install - run: npx standard ./test/standardjs.js + working-directory: ./test + run: npx standard ./standardjs.js - name: Report StandardJS issues if: failure()