Skip to content

HDDS-11199. [Recon] Fix eslint configs and add missing packages for Recon web#10094

Merged
adoroszlai merged 3 commits into
apache:masterfrom
will-sh:HDDS-11199
May 11, 2026
Merged

HDDS-11199. [Recon] Fix eslint configs and add missing packages for Recon web#10094
adoroszlai merged 3 commits into
apache:masterfrom
will-sh:HDDS-11199

Conversation

@will-sh

@will-sh will-sh commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

HDDS-11199. [Recon] Fix eslint configs and add missing packages for Recon web

Currently, the ESLint configuration in the Recon web project is outdated and missing some essential plugin packages in the devDependencies. This causes the linting process to fail to resolve modern ES6 variables or TypeScript paths properly.

This PR proposes the following improvements to the frontend ESLint configuration:

  1. Add eslint-plugin-react, eslint-plugin-import, and eslint-import-resolver-typescript to devDependencies to ensure all required linting plugins are explicitly declared and installed.
    Update .eslintrc.json by adding es6: true to the env block to prevent "undefined" errors for modern JS objects (like Promise, Set, etc.).
  2. Configure the import/resolver in .eslintrc.json to correctly resolve .ts and .tsx file paths when using TypeScript in the project.
  3. Clean up old/deprecated ESLint rules (such as @typescript-eslint/interface-name-prefix) and adopt the modern recommended import configs (plugin:import/recommended, plugin:import/typescript).
  4. Regenerate pnpm-lock.yaml using the official NPM registry to resolve CI test failures related to pnpm install --frozen-lockfile.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-11199

How was this patch tested?

Manually tested in the local environment by running the following commands in hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web:

pnpm install --frozen-lockfile (Verified successful dependency resolution without any private registry/mirror errors).
pnpm run lint (Verified that ESLint runs successfully without throwing Cannot find module 'eslint-plugin-react' or Unable to resolve path errors).

workflow run on the fork git repo.

@will-sh will-sh changed the title Hdds 11199 HDDS-11199. [Recon] Fix eslint configs and add missing packages for Recon web Apr 20, 2026
@adoroszlai
adoroszlai requested a review from spacemonkd April 23, 2026 07:41
@adoroszlai

Copy link
Copy Markdown
Contributor

@arunsarin85 would you like to help review?

@spacemonkd spacemonkd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the patch @will-sh.
Overall it looks good to me, just a few comments.

It would be great if you could address them.

@will-sh

will-sh commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

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

@spacemonkd spacemonkd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the changes @will-sh.
This LGTM, +2.

Have you raised the JIRA to fix the .then() references ? It would be great to have that as a follow up task.

@will-sh

will-sh commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review @spacemonkd .
I raised https://issues.apache.org/jira/browse/HDDS-15144 under the same epic and start to work on it.

@adoroszlai
adoroszlai merged commit c3872cd into apache:master May 11, 2026
38 checks passed
@adoroszlai

Copy link
Copy Markdown
Contributor

Thanks @will-sh for the patch, @spacemonkd for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants