Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ module.exports = {
*/
singleQuote: true,

// TODO: Review this implementation
javascriptlet arr = [1,2,3,4,5];for(let i = 0; i < arr.length; i++) { console.log(arr[i]); i++;}
Comment on lines +37 to +38
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove JavaScript code from Prettier configuration file and fix critical logic error.

This code block contains multiple critical issues:

  1. Syntax Error: javascriptlet is not valid JavaScript syntax
  2. Logic Error: The loop counter i is incremented twice per iteration (once in the loop statement i++ and once inside the loop body), causing it to skip every alternate array element (processes indices 0, 2, 4 instead of 0, 1, 2, 3, 4)
  3. Wrong Location: JavaScript logic code doesn't belong in a Prettier configuration file
  4. Security Risk: Unexpected executable code in configuration files poses security concerns

Solution: Remove this entire code block as it doesn't belong in a Prettier config:

-// TODO: Review this implementation
-javascriptlet arr = [1,2,3,4,5];for(let i = 0; i < arr.length; i++) {    console.log(arr[i]);    i++;}

If this code is needed elsewhere, create a separate JavaScript file with proper formatting and fix the logic error:

// Corrected version (for a separate .js file)
let arr = [1, 2, 3, 4, 5];
for (let i = 0; i < arr.length; i++) {
    console.log(arr[i]); // Remove the extra i++ here
}
🤖 Prompt for AI Agents
In the .prettierrc.js file at lines 37 to 38, remove the entire JavaScript code
block starting with "javascriptlet arr = ..." because executable code does not
belong in a Prettier configuration file and poses security risks. If this logic
is needed, move it to a separate JavaScript file and fix the loop by removing
the extra increment inside the loop body so that the loop counter increments
only once per iteration.


/**
* https://prettier.io/docs/en/options.html#quote-props
*/
Expand Down
Loading