bito-code-review[bot] commented on PR #42955:
URL: https://github.com/apache/superset/pull/42955#issuecomment-5235127525

   <!-- Bito Reply -->
   The flagged issue is correct. When `oxlint` encounters linting errors, it 
exits with a nonzero status code, causing `execSync` to throw an exception 
before the output can be parsed. To resolve this, you should wrap the 
`execSync` call in a `try...catch` block and access the `stdout` from the error 
object, which contains the linting results even on failure.
   
   Here is the suggested fix:
   
   ```javascript
       let oxlintOutput;
       try {
         oxlintOutput = execSync('npx oxlint --config oxlint.json --format 
json', {
           encoding: 'utf8',
           maxBuffer: 50 * 1024 * 1024,
           stdio: ['pipe', 'pipe', 'ignore'],
         });
       } catch (error) {
         if (error.stdout) {
           oxlintOutput = error.stdout;
         } else {
           throw error;
         }
       }
       const results = JSON.parse(oxlintOutput);
   ```
   
   There are no other comments available in the PR to address.
   
   **superset-frontend/scripts/oxlint-metrics-uploader.js**
   ```
   let oxlintOutput;
       try {
         oxlintOutput = execSync('npx oxlint --config oxlint.json --format 
json', {
           encoding: 'utf8',
           maxBuffer: 50 * 1024 * 1024,
           stdio: ['pipe', 'pipe', 'ignore'],
         });
       } catch (error) {
         if (error.stdout) {
           oxlintOutput = error.stdout;
         } else {
           throw error;
         }
       }
       const results = JSON.parse(oxlintOutput);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to