Skip to content

chore(ui): migrate ESLint to flat eslint.config.ts with typescript-eslint and import-x#11352

Open
pfe-nazaries wants to merge 4 commits into
masterfrom
feature/eslint-typescript-flat
Open

chore(ui): migrate ESLint to flat eslint.config.ts with typescript-eslint and import-x#11352
pfe-nazaries wants to merge 4 commits into
masterfrom
feature/eslint-typescript-flat

Conversation

@pfe-nazaries
Copy link
Copy Markdown
Contributor

Context

The legacy ui/eslint.config.mjs was an early flat-config port: it still glued together hand-imported plugins (@typescript-eslint/eslint-plugin, @typescript-eslint/parser, eslint-plugin-prettier, eslint-plugin-simple-import-sort, eslint-plugin-unused-imports) and didn't use type-aware linting. This PR consolidates that config onto the canonical flat-config primitives and prepares the workspace for type-aware rules without changing any product behavior.

Description

  • Renames ui/eslint.config.mjsui/eslint.config.ts and wires it through tseslint.config(...) so we can use the typescript-eslint meta-package and TS types in the config itself.
  • Replaces the separate @typescript-eslint/eslint-plugin + @typescript-eslint/parser entries with typescript-eslint. Enables parserOptions.projectService with tsconfigRootDir: import.meta.dirname so the parser uses the canonical TS project graph. events-timeline.test.tsx is opted into allowDefaultProject because TypeScript skips it in favor of its .ts sibling.
  • Replaces eslint-plugin-prettier (which runs Prettier through ESLint) with eslint-config-prettier/flat (which only disables conflicting rules).
  • Consolidates eslint-plugin-simple-import-sort + eslint-plugin-unused-imports into eslint-plugin-import-x using its recommended + typescript flat configs. Wires the resolver chain via createTypeScriptImportResolver + createNodeResolver and adds jiti so ESLint can load the .ts config.
  • Adds eslint.config.ts to tsconfig.json exclude and to the ESLint own ignore list to keep it out of the typecheck/lint passes.
  • Applies eslint --fix for the new import-x/order rule across the workspace (alphabetised, blank lines between groups). All churn is purely import grouping/consolidation — no runtime code changes.
  • Adds a ui/CHANGELOG.md entry under [1.28.0] / 🔄 Changed.

The migration is intentionally behavior-preserving: import-x/export is kept off so pre-existing duplicate exports stay tracked separately, and lint:check stays under the existing --max-warnings 40 budget.

Steps to review

  1. pnpm install (regenerates the lockfile entries for the new plugins).
  2. pnpm run lint:check should pass under --max-warnings 40.
  3. pnpm run typecheck should pass.
  4. Skim ui/eslint.config.ts and compare with the previous .mjs to confirm there are no rule changes other than the documented ones.
  5. Spot-check a couple of the touched files (e.g. ui/components/findings/table/resource-detail-drawer/resource-detail-drawer-content.tsx, ui/components/ui/sidebar/sidebar.tsx) — the only edits are import consolidation and blank lines between import groups.

Checklist

Community Checklist
  • This feature/issue is listed in here or roadmap.prowler.com
  • Is it assigned to me, if not, request it via the issue/feature in here or Prowler Community Slack

SDK/CLI

  • Are there new checks included in this PR? No

UI

  • All issue/task requirements work as expected on the UI
  • If this PR adds or updates npm dependencies, include package-health evidence (maintenance, popularity, known vulnerabilities, license, release age) and explain why existing/native alternatives are insufficient.
  • Screenshots/Video of the functionality flow (if applicable) - Mobile (X < 640px) — N/A (config-only, no UI changes)
  • Screenshots/Video of the functionality flow (if applicable) - Table (640px > X < 1024px) — N/A (config-only, no UI changes)
  • Screenshots/Video of the functionality flow (if applicable) - Desktop (X > 1024px) — N/A (config-only, no UI changes)
  • Ensure new entries are added to CHANGELOG.md, if applicable.

API

  • All issue/task requirements work as expected on the API — N/A
  • Endpoint response output (if applicable) — N/A
  • EXPLAIN ANALYZE output for new/modified queries or indexes (if applicable) — N/A
  • Performance test results (if applicable) — N/A
  • Any other relevant evidence of the implementation (if applicable) — N/A
  • Verify if API specs need to be regenerated. — N/A
  • Check if version updates are required (e.g., specs, uv, etc.). — N/A
  • Ensure new entries are added to CHANGELOG.md, if applicable. — N/A

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@pfe-nazaries pfe-nazaries requested a review from a team as a code owner May 25, 2026 11:47
@github-actions
Copy link
Copy Markdown
Contributor

ghost commented May 25, 2026

🔒 osv-scanner: 2 finding(s) in ui/pnpm-lock.yaml

Severity gate: HIGH,CRITICAL,UNKNOWN

Severity ID Package Version Summary
🟠 HIGH (7.5) GHSA-w5hq-g745-h8pq npm/uuid 10.0.0 uuid: Missing buffer bounds check in v3/v5/v6 when buf is provided
🟠 HIGH (7.5) GHSA-w5hq-g745-h8pq npm/uuid 9.0.1 uuid: Missing buffer bounds check in v3/v5/v6 when buf is provided

To accept a finding, add an [[IgnoredVulns]] entry to osv-scanner.toml at the repo root with a reason and ignoreUntil.

View run

@github-actions
Copy link
Copy Markdown
Contributor

ghost commented May 25, 2026

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@github-actions
Copy link
Copy Markdown
Contributor

ghost commented May 25, 2026

✅ All necessary CHANGELOG.md files have been updated.

Pablo F.G added 3 commits May 25, 2026 13:48
…lint and import-x

Convert ui/eslint.config.mjs to ui/eslint.config.ts and switch to the
typescript-eslint meta-package via tseslint.config(), replacing the
separate @typescript-eslint/eslint-plugin and @typescript-eslint/parser
entries. Enable projectService with tsconfigRootDir: import.meta.dirname
so the parser uses the canonical TS project graph; one duplicate test
file (events-timeline.test.tsx) is opted into allowDefaultProject
because TypeScript skips it in favor of its .ts sibling.

Replace eslint-plugin-prettier (which proxies Prettier through ESLint
rules) with eslint-config-prettier/flat so Prettier only disables
conflicting rules. Replace eslint-plugin-simple-import-sort and
eslint-plugin-unused-imports with eslint-plugin-import-x using the
recommended + typescript flat configs, wire up the import-x
resolver-next chain via eslint-import-resolver-typescript +
createNodeResolver, and add jiti so ESLint can load the .ts config.

The migration is intentionally behavior-preserving: import-x/export is
disabled to keep parity with the legacy config (pre-existing duplicate
exports stay tracked for the canonical Base layer PR), eslint.config.ts
is excluded from tsc and ignored by ESLint, and lint:check stays under
the --max-warnings 40 budget.
Re-sort imports and consolidate duplicate React imports to satisfy the
new import-x/order rule from eslint-plugin-import-x's recommended +
typescript configs. The rule enforces alphabetical sort within groups
(builtin / external / internal / parent / sibling / index) and a blank
line between groups, replacing the prior simple-import-sort layout.

Pure auto-fix output from `pnpm run lint:fix` — no runtime changes.
@github-actions
Copy link
Copy Markdown
Contributor

ghost commented May 25, 2026

🔒 Container Security Scan

Image: prowler-ui:72a7939
Last scan: 2026-05-25 11:57:52 UTC

📊 Vulnerability Summary

Severity Count
🔴 Critical 2
Total 2

2 package(s) affected

⚠️ Action Required

Critical severity vulnerabilities detected. These should be addressed before merging:

  • Review the detailed scan results
  • Update affected packages to patched versions
  • Consider using a different base image if updates are unavailable

📋 Resources:

@pfe-nazaries pfe-nazaries force-pushed the feature/eslint-typescript-flat branch from 666bbc7 to 41e8178 Compare May 25, 2026 11:54
import { useTheme } from "next-themes";
import { FC } from "react";
import React from "react";
import React, { FC } from "react";
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.

Maybe we can use this opportunity to remove this kind of imports (import React)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants