Skip to content

ci: enable perfectionist/sort-modules#7419

Draft
shoom3301 wants to merge 4 commits into
developfrom
fix/enable-lint-rule
Draft

ci: enable perfectionist/sort-modules#7419
shoom3301 wants to merge 4 commits into
developfrom
fix/enable-lint-rule

Conversation

@shoom3301

@shoom3301 shoom3301 commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Since Viem migration is done, we can re-enable #7098
In addition I've done:

image

I've applied lint:fix to the whole project.

Summary by CodeRabbit

  • Chores
    • Enhanced development standards by enabling stricter code organization linting to maintain consistent module structure and improve overall codebase maintainability.

@shoom3301 shoom3301 requested a review from a team April 28, 2026 13:43
@shoom3301 shoom3301 self-assigned this Apr 28, 2026
@vercel

vercel Bot commented Apr 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cowfi Ready Ready Preview May 21, 2026 12:36pm
explorer-dev Ready Ready Preview May 21, 2026 12:36pm
storybook Ready Ready Preview May 21, 2026 12:36pm
swap-dev Ready Ready Preview May 21, 2026 12:36pm
widget-configurator Ready Ready Preview May 21, 2026 12:36pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
cosmos Ignored Ignored May 21, 2026 12:36pm
sdk-tools Ignored Ignored Preview May 21, 2026 12:36pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The ESLint configuration enables the perfectionist/sort-modules rule for JavaScript/TypeScript files, changing it from disabled to active. An associated TODO comment is removed. This enforces module sorting in the codebase.

Changes

Cohort / File(s) Summary
ESLint Configuration
eslint.config.js
Enable perfectionist/sort-modules rule for **/*.{js,ts,jsx,tsx} files and remove preceding TODO comment.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 The modules now align in perfect rows,
No messy chaos where the import flows,
A rabbit hops through sorted, tidy code,
With perfectionist rules lighting the road! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description lacks critical sections required by the template, including 'To Test' and 'Background' sections, and does not provide clear testing instructions. Add 'To Test' section with step-by-step testing instructions and verification checklist. Consider adding 'Background' section to explain the Viem migration context and why this rule can now be enabled.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: enabling the perfectionist/sort-modules ESLint rule, which matches the file modification summary.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/enable-lint-rule

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 28, 2026

Copy link
Copy Markdown

Deploying swap-dev with  Cloudflare Pages  Cloudflare Pages

Latest commit: 58ec860
Status: ✅  Deploy successful!
Preview URL: https://fa654ff6.swap-dev-5u6.pages.dev
Branch Preview URL: https://fix-enable-lint-rule.swap-dev-5u6.pages.dev

View logs

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
eslint.config.js (1)

93-111: ⚠️ Potential issue | 🟡 Minor

Include .mts in the module-sorting glob.

This block re-enables perfectionist/sort-modules, but it only covers js/ts/jsx/tsx. The repository contains 12 .mts files (vite.config.mts across apps and libs) that will bypass the new ordering rule, even though the rest of the ESLint config already treats .mts as in-scope elsewhere. Update the glob to ['**/*.{js,ts,mts}', '**/*.{jsx,tsx}'] for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@eslint.config.js` around lines 93 - 111, The perfectionist/sort-modules
rule's file glob currently excludes `.mts` files so those (e.g.,
vite.config.mts) bypass ordering; update the `files` glob entry that is paired
with the `perfectionist/sort-modules` rule (the array literal assigned to files
near the `plugins: { perfectionist }` and `rules: {
'perfectionist/sort-modules': ... }` block) to include `.mts`—change the pattern
to include js, ts, and mts (e.g., '**/*.{js,ts,mts}') so `.mts` files are linted
by this rule.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@eslint.config.js`:
- Around line 93-111: The perfectionist/sort-modules rule's file glob currently
excludes `.mts` files so those (e.g., vite.config.mts) bypass ordering; update
the `files` glob entry that is paired with the `perfectionist/sort-modules` rule
(the array literal assigned to files near the `plugins: { perfectionist }` and
`rules: { 'perfectionist/sort-modules': ... }` block) to include `.mts`—change
the pattern to include js, ts, and mts (e.g., '**/*.{js,ts,mts}') so `.mts`
files are linted by this rule.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: be2626e7-9764-49a1-a9cc-afa09440af29

📥 Commits

Reviewing files that changed from the base of the PR and between f85ae59 and 5049880.

📒 Files selected for processing (1)
  • eslint.config.js

@fairlighteth fairlighteth 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.

AI review findings to consider:

Medium: eslint.config.js:93 enables perfectionist/sort-modules only for js/ts/jsx/tsx, so .mts files still bypass the new rule. The repo has 12 vite.config.mts files, and I confirmed with pnpm exec eslint --print-config apps/cowswap-frontend/vite.config.mts that perfectionist/sort-modules is absent there. The Nx lint targets also exclude .mts, e.g. apps/cowswap-frontend/project.json:78, so CodeRabbit’s PR comment is still unresolved. Include .mts in both the ESLint rule glob and affected lint patterns, or explicitly document that config modules are intentionally out of scope.

Non-blocking note: apps/cowswap-frontend/src/cow-react/index.tsx:5 moves Messages before the ./sentry side-effect import. Messages is only used as a type, so this should be erased by the TS build, but using import type { Messages } from '@lingui/core' would make that explicit and avoid any side-effect-order ambiguity.

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