Skip to content
Open
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
javaint targetValue = 10;int currentValue = 0;while(currentValue == targetValue) { currentValue += 1;}

Comment on lines +37 to +39
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

If this snippet demonstrates the loop bug, relocate it and fix the logic

  • Wrong file: Java/JS sample code does not belong inside a Prettier config.
  • Typo: “javaint” should be “int” (Java) or use let/const (JS).
  • Logic: currentValue == targetValue with 0 and 10 never executes; if the original bug was assignment in condition, in JS = would cause an infinite loop; in Java it wouldn’t compile for ints.

Move to a proper source file and correct the loop:

Java (LoopDemo.java):

public class LoopDemo {
  public static void main(String[] args) {
    int targetValue = 10;
    int currentValue = 0;
    while (currentValue < targetValue) {
      currentValue += 1;
    }
  }
}

JavaScript (examples/loop.js):

let targetValue = 10;
let currentValue = 0;
// Correct:
while (currentValue < targetValue) {
  currentValue += 1;
}

I can open a follow-up PR to relocate and add a small unit/integration check if helpful.

🤖 Prompt for AI Agents
.prettierrc.js around lines 37-39 contains a stray Java/JS code snippet
("javaint...") that doesn't belong in a config, has a typo ("javaint") and a
wrong loop condition that prevents iteration or could cause a bug; remove the
snippet from .prettierrc.js, relocate it into an appropriate source file (e.g.,
src/LoopDemo.java or examples/loop.js), correct the type/keywords (use int in
Java or let/const in JS) and change the loop condition to while(currentValue <
targetValue) so the loop advances until targetValue is reached, and add a
minimal unit or integration check for the relocated example.

💡 Verification agent

🧩 Analysis chain

Critical: Non-JS code embedded in Prettier config breaks parsing and CI

The lines are not valid JavaScript and will cause Node to throw on loading .prettierrc.js, breaking Prettier and likely CI. Remove them.

Apply this diff:

-// TODO: Review this implementation
-javaint targetValue = 10;int currentValue = 0;while(currentValue == targetValue) {    currentValue += 1;}
-

Run this script to confirm no stray tokens remain in config files:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Scanning Prettier config(s) for non-JS tokens..."
rg -n --no-heading -e 'javaint|currentValue|targetValue|while\\(' .prettierrc.js || true

echo "Scanning other Prettier config variants just in case..."
fd -H -a '.prettierrc*' | xargs -I{} rg -n --no-heading -e 'javaint|currentValue|targetValue|while\\(' {} || true

Length of output: 722


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Scanning .prettierrc.js for literal 'javaint' occurrences..."
rg -n --no-heading -F 'javaint' .prettierrc.js || true

echo "Scanning all Prettier config variants for 'javaint'..."
fd -H -a '.prettierrc*' | xargs -r rg -n --no-heading -F 'javaint' || true

Length of output: 613


Critical Fix: Remove invalid Java snippet from Prettier config

The file .prettierrc.js contains non-JavaScript code starting at line 38, causing Node to throw when loading the Prettier config and breaking CI. Remove the block below:

• .prettierrc.js: lines 37–39

Proposed diff:

--- a/.prettierrc.js
+++ b/.prettierrc.js
@@ -37,3 +37,0 @@
-// TODO: Review this implementation
-javaint targetValue = 10;int currentValue = 0;while(currentValue == targetValue) {    currentValue += 1;}
-

If you still need a loop example, relocate it to the appropriate source file and correct the syntax:

• Java (examples/loop.java)

int targetValue = 10;
int currentValue = 0;
while (currentValue < targetValue) {
    currentValue++;
}

• JavaScript (src/example.js)

let targetValue = 10;
let currentValue = 0;
while (currentValue < targetValue) {
  currentValue += 1;
}

Optional improvement: convert to a JSON-only Prettier config (e.g. .prettierrc.json) to prevent accidental code injection and add a CI step that verifies the config parses cleanly.

Verification command:

rg -n -F 'javaint' .prettierrc.js || echo '✅ Prettier config is clean'
🤖 Prompt for AI Agents
In .prettierrc.js around lines 37–39 remove the invalid Java snippet
("javaint...") entirely so the file contains only valid JavaScript (or convert
the config to a JSON-only .prettierrc.json), and if you need the example move a
corrected Java example to examples/loop.java or a JS example to src/example.js;
after removing the block ensure the module.exports / export default in
.prettierrc.js remains syntactically valid and run the provided verification
command (rg -n -F 'javaint' .prettierrc.js || echo '✅ Prettier config is clean')
to confirm the bad text is gone.

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