will-sh commented on PR #10094:
URL: https://github.com/apache/ozone/pull/10094#issuecomment-4310617446

   committed again, tested with below command, it can identify both `unused 
var` and `.then()` now.
   ```
   $ cd 
/home/wxiao/ozone/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web
 && pnpm run lint | awk '
     /@typescript-eslint\/no-unused-vars/ { unused++ }
     /promise\/prefer-await-to-then/ { then++ }
     END {
       print "=== ESLint Check Results ===";
       print "Unused variables detected: " unused + 0;
       print "Promise .then() usages detected: " then + 0;
     }'
   === ESLint Check Results ===
   Unused variables detected: 41
   Promise .then() usages detected: 47
   (base) [wxiao@db ozone-recon-web]$ cd 
/home/wxiao/ozone/hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web
 && pnpm run lint | awk '
     /@typescript-eslint\/no-unused-vars/ { 
       unused++ 
       if (unused <= 3) {
         unused_examples[unused] = $0
       }
     }
     /promise\/prefer-await-to-then/ { 
       then++ 
       if (then <= 3) {
         then_examples[then] = $0
       }
     }
     END {
       print "=== ESLint Check Results ===";
       print "Unused variables detected: " unused + 0;
       if (unused > 0) {
         print "\nExamples of unused variables:";
         for (i = 1; i <= 3 && i <= unused; i++) {
           print unused_examples[i];
         }
       }
       
       print "\n----------------------------------------\n";
       
       print "Promise .then() usages detected: " then + 0;
       if (then > 0) {
         print "\nExamples of .then() usages:";
         for (i = 1; i <= 3 && i <= then; i++) {
           print then_examples[i];
         }
       }
     }'
   === ESLint Check Results ===
   Unused variables detected: 41
   
   Examples of unused variables:
     19:8  warning  'React' is defined but never used. Allowed unused vars must 
match /^_\w*/u  @typescript-eslint/no-unused-vars
     19:8  warning  'React' is defined but never used. Allowed unused vars must 
match /^_\w*/u  @typescript-eslint/no-unused-vars
     18:8   warning  'React' is defined but never used. Allowed unused vars 
must match /^_\w*/u                                                             
                                                                                
                                                                                
                                                                                
                             @typescript-eslint/no-unused-vars
   
   ----------------------------------------
   
   Promise .then() usages detected: 47
   
   Examples of .then() usages:
     74:41  warning  Prefer await to then()/catch()/finally()                   
                                                                  
promise/prefer-await-to-then
     81:8   warning  Prefer await to then()/catch()/finally()                   
                                                                  
promise/prefer-await-to-then
     72:15  warning  Prefer await to then()/catch()/finally()                   
                                                                                
                                                                                
                                                                                
                                                                                
                                                   promise/prefer-await-to-then
   ```


-- 
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