Skip to content

Changed admin React apps to ESLint 9 / flat config#28803

Merged
9larsons merged 2 commits into
mainfrom
eslint9-06-admin-react-apps
Jun 22, 2026
Merged

Changed admin React apps to ESLint 9 / flat config#28803
9larsons merged 2 commits into
mainfrom
eslint9-06-admin-react-apps

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

Summary

Migrates apps/admin-x-settings, apps/posts, apps/stats, and apps/activitypub.

  • Each workspace had a .eslintrc.cjs + test/.eslintrc.cjs split; collapsed each into a single eslint.config.js.
  • Swapped eslint: catalog: to catalog:eslint9 and added @eslint/js, globals, eslint-plugin-react, eslint-plugin-ghost, typescript-eslint (unified) as direct deps. eslint-plugin-tailwindcss stays at catalog:.
  • Dropped admin-x-settings's enormous inline copy of the legacy ghost/browser formatting rules — all removed from ESLint 9 core anyway. Non-formatting rules preserved inline.
  • Moved .eslintignore patterns into flat-config ignores (flat config doesn't honor .eslintignore files); deleted the legacy ignore files.
  • '@typescript-eslint/no-explicit-any' kept warn in src and off in tests, matching the legacy posture.
  • ESLint 9 dropped the --ext CLI flag; lint:code / lint:test scripts now pass directory args.
  • Modernized all four to ESM (`"type": "module"`); each was already running ESM at runtime under Vite, just makes the package metadata match.

Forced source fixes

ESLint 9's stricter defaults + a freshly-rebuilt cache exposed a few pre-existing real lint failures that had been hiding. Mechanical fixes:

  • apps/admin-x-settings/src/components/settings/general/about.tsx — empty destructuring ({}) => ...() => ...
  • apps/admin-x-settings/src/components/settings/general/invite-user-modal.tsxif (!!errors.email)if (errors.email)
  • apps/admin-x-settings/src/components/settings/growth/offers/add-offer-modal.tsx — useless backslash-dash in regex character class
  • apps/admin-x-settings/src/components/settings/growth/recommendations/recommendation-description-form.tsx — case-declaration without braces
  • apps/admin-x-settings/src/hooks/use-setting-group.tsx — empty else {} removed
  • apps/activitypub/src/components/layout/onboarding/step-3.tsx — non-breaking-space chars (U+00A0) → regular spaces (caught by no-irregular-whitespace)
  • apps/activitypub/src/views/preferences/components/profile.tsxno-async-promise-executor disabled inline (intentional pattern)
  • apps/activitypub/src/views/profile/profile.tsx — empty destructuring fix
  • apps/posts/src/views/filters/filter-codecs.ts — useless backslash in regex character class

No version bumps

None of these four are CDN-published. check-app-version-bump.js does not monitor them.

Test plan

  • CI lint passes
  • All four pnpm --filter <pkg> lint are green locally
  • Admin app build still produces working bundles for each — these are loaded into the admin host

@nx-cloud

nx-cloud Bot commented Jun 22, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit f62b8df

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 10m 1s View ↗
nx build @tryghost/activitypub ✅ Succeeded 3s View ↗
nx run ghost:test:ci:integration ✅ Succeeded 2m 21s View ↗
nx build @tryghost/portal ✅ Succeeded 1s View ↗
nx build @tryghost/announcement-bar ✅ Succeeded <1s View ↗
nx build @tryghost/admin-toolbar ✅ Succeeded <1s View ↗
nx build @tryghost/signup-form ✅ Succeeded <1s View ↗
nx build @tryghost/comments-ui ✅ Succeeded <1s View ↗
Additional runs (15) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-22 20:51:14 UTC

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6a5bbdad-e559-4e04-b91a-ceb3dd839118

📥 Commits

Reviewing files that changed from the base of the PR and between 99aa5f1 and 0a5927b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (38)
  • apps/activitypub/.eslintignore
  • apps/activitypub/.eslintrc.cjs
  • apps/activitypub/eslint.config.js
  • apps/activitypub/package.json
  • apps/activitypub/src/components/layout/onboarding/step-3.tsx
  • apps/activitypub/src/views/preferences/components/profile.tsx
  • apps/activitypub/src/views/profile/profile.tsx
  • apps/activitypub/test/.eslintrc.cjs
  • apps/activitypub/test/acceptance/dom-validation.test.ts
  • apps/activitypub/test/acceptance/feed.test.ts
  • apps/activitypub/test/acceptance/inbox.test.ts
  • apps/activitypub/test/acceptance/my-profile.test.ts
  • apps/activitypub/test/utils/initial-api-requests.ts
  • apps/admin-x-settings/.eslintignore
  • apps/admin-x-settings/.eslintrc.cjs
  • apps/admin-x-settings/eslint.config.js
  • apps/admin-x-settings/package.json
  • apps/admin-x-settings/src/components/settings/general/about.tsx
  • apps/admin-x-settings/src/components/settings/general/invite-user-modal.tsx
  • apps/admin-x-settings/src/components/settings/growth/offers/add-offer-modal.tsx
  • apps/admin-x-settings/src/components/settings/growth/recommendations/recommendation-description-form.tsx
  • apps/admin-x-settings/src/hooks/use-setting-group.tsx
  • apps/admin-x-settings/test/acceptance/advanced/integrations/pintura.test.ts
  • apps/admin-x-settings/test/acceptance/advanced/labs.test.ts
  • apps/admin-x-settings/test/acceptance/advanced/migration-tools.test.ts
  • apps/admin-x-settings/test/acceptance/general/seometa.test.ts
  • apps/admin-x-settings/test/acceptance/general/users/profile.test.ts
  • apps/admin-x-settings/test/acceptance/site/theme.test.ts
  • apps/posts/.eslintrc.cjs
  • apps/posts/eslint.config.js
  • apps/posts/package.json
  • apps/posts/src/views/filters/filter-codecs.ts
  • apps/posts/test/.eslintrc.cjs
  • apps/stats/.eslintignore
  • apps/stats/.eslintrc.cjs
  • apps/stats/eslint.config.js
  • apps/stats/package.json
  • apps/stats/test/.eslintrc.cjs
💤 Files with no reviewable changes (11)
  • apps/activitypub/.eslintrc.cjs
  • apps/stats/.eslintignore
  • apps/admin-x-settings/src/hooks/use-setting-group.tsx
  • apps/activitypub/test/.eslintrc.cjs
  • apps/admin-x-settings/.eslintignore
  • apps/stats/.eslintrc.cjs
  • apps/stats/test/.eslintrc.cjs
  • apps/admin-x-settings/.eslintrc.cjs
  • apps/activitypub/.eslintignore
  • apps/posts/test/.eslintrc.cjs
  • apps/posts/.eslintrc.cjs
✅ Files skipped from review due to trivial changes (12)
  • apps/activitypub/test/acceptance/inbox.test.ts
  • apps/activitypub/test/acceptance/feed.test.ts
  • apps/activitypub/test/acceptance/my-profile.test.ts
  • apps/admin-x-settings/test/acceptance/general/seometa.test.ts
  • apps/admin-x-settings/test/acceptance/advanced/migration-tools.test.ts
  • apps/admin-x-settings/test/acceptance/advanced/labs.test.ts
  • apps/activitypub/src/views/preferences/components/profile.tsx
  • apps/admin-x-settings/src/components/settings/general/invite-user-modal.tsx
  • apps/admin-x-settings/src/components/settings/growth/recommendations/recommendation-description-form.tsx
  • apps/activitypub/test/utils/initial-api-requests.ts
  • apps/activitypub/src/components/layout/onboarding/step-3.tsx
  • apps/admin-x-settings/src/components/settings/growth/offers/add-offer-modal.tsx
🚧 Files skipped from review as they are similar to previous changes (12)
  • apps/admin-x-settings/src/components/settings/general/about.tsx
  • apps/activitypub/src/views/profile/profile.tsx
  • apps/activitypub/test/acceptance/dom-validation.test.ts
  • apps/stats/package.json
  • apps/posts/src/views/filters/filter-codecs.ts
  • apps/posts/eslint.config.js
  • apps/admin-x-settings/eslint.config.js
  • apps/activitypub/package.json
  • apps/activitypub/eslint.config.js
  • apps/stats/eslint.config.js
  • apps/posts/package.json
  • apps/admin-x-settings/package.json

Walkthrough

Four apps (activitypub, admin-x-settings, posts, stats) are migrated from legacy .eslintrc.cjs and test/.eslintrc.cjs files to ESLint v9 flat configuration (eslint.config.js). Each app gains "type": "module" in its package.json, simplified lint scripts (removing --ext flags and test config overrides), and updated devDependencies (@eslint/js, eslint at catalog:eslint9, eslint-plugin-ghost, eslint-plugin-react, globals, typescript-eslint). Source code across the apps is adjusted to satisfy the new rule set: empty props destructuring removed, double-negation simplified, regex patterns updated, JSON test imports updated with explicit with { type: 'json' } assertions, special whitespace in hardcoded strings corrected, and test files updated with import.meta.dirname for ESM file path resolution.

Possibly related PRs

  • TryGhost/Ghost#28791: Removes or disables ghost/mocha rule directives after migration to Vitest, directly related to the mochaRulesOff map computed in the new flat configs to disable ghost/mocha/* rules in test overrides.
  • TryGhost/Ghost#28801: Part of the same ESLint 9 flat-config migration effort, migrating apps/comments-ui and apps/signup-form in parallel with this PR's migration of activitypub, admin-x-settings, posts, and stats.

Suggested labels

migration

Suggested reviewers

  • cmraible
  • kevinansfield
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: migrating admin React apps from ESLint 8 to ESLint 9 with flat configuration.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, detailing configuration changes, forced source fixes, and modernization efforts.
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 eslint9-06-admin-react-apps

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.

@9larsons 9larsons force-pushed the eslint9-06-admin-react-apps branch from 77bc878 to 4d4f71d Compare June 22, 2026 19:23

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/admin-x-settings/eslint.config.js`:
- Line 21: In the eslint.config.js file, locate the 'no-shadow': 'error' rule
within the ghostRules section and disable it by setting it to 'off'. Then add
'`@typescript-eslint/no-shadow`': 'error' to the src rules block (around line 77)
to properly handle TypeScript-specific scoping for enums, namespaces, and type
parameters, which the base ESLint rule does not understand.

In `@apps/posts/eslint.config.js`:
- Line 21: In the eslint.config.js file, replace the base ESLint rule
`'no-shadow': 'error'` in the ghostRules object with the TypeScript-specific
equivalent `'`@typescript-eslint/no-shadow`': 'error'`. This ensures proper
handling of TypeScript-specific scoping for enums, namespaces, and type
parameters. Remove the base no-shadow rule entry from ghostRules and add the
`@typescript-eslint/no-shadow` rule in the appropriate configuration section for
TypeScript files.

In `@apps/stats/eslint.config.js`:
- Line 21: The ghostRules object currently includes the base ESLint rule
'no-shadow' set to 'error', but TypeScript projects should use the
TypeScript-aware variant '`@typescript-eslint/no-shadow`' instead, as the base
rule doesn't understand TypeScript-specific scoping for enums, namespaces, and
type parameters. Remove the 'no-shadow': 'error' entry from the ghostRules
object and add '`@typescript-eslint/no-shadow`': 'error' to properly handle
TypeScript-specific scoping rules.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 20c302ee-ee9e-4f69-9d23-e78435771848

📥 Commits

Reviewing files that changed from the base of the PR and between 0b4a63c and 4d4f71d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (32)
  • apps/activitypub/.eslintignore
  • apps/activitypub/.eslintrc.cjs
  • apps/activitypub/eslint.config.js
  • apps/activitypub/package.json
  • apps/activitypub/src/components/layout/onboarding/step-3.tsx
  • apps/activitypub/src/views/preferences/components/profile.tsx
  • apps/activitypub/src/views/profile/profile.tsx
  • apps/activitypub/test/.eslintrc.cjs
  • apps/activitypub/test/acceptance/dom-validation.test.ts
  • apps/activitypub/test/acceptance/feed.test.ts
  • apps/activitypub/test/acceptance/inbox.test.ts
  • apps/activitypub/test/acceptance/my-profile.test.ts
  • apps/activitypub/test/utils/initial-api-requests.ts
  • apps/admin-x-settings/.eslintignore
  • apps/admin-x-settings/.eslintrc.cjs
  • apps/admin-x-settings/eslint.config.js
  • apps/admin-x-settings/package.json
  • apps/admin-x-settings/src/components/settings/general/about.tsx
  • apps/admin-x-settings/src/components/settings/general/invite-user-modal.tsx
  • apps/admin-x-settings/src/components/settings/growth/offers/add-offer-modal.tsx
  • apps/admin-x-settings/src/components/settings/growth/recommendations/recommendation-description-form.tsx
  • apps/admin-x-settings/src/hooks/use-setting-group.tsx
  • apps/posts/.eslintrc.cjs
  • apps/posts/eslint.config.js
  • apps/posts/package.json
  • apps/posts/src/views/filters/filter-codecs.ts
  • apps/posts/test/.eslintrc.cjs
  • apps/stats/.eslintignore
  • apps/stats/.eslintrc.cjs
  • apps/stats/eslint.config.js
  • apps/stats/package.json
  • apps/stats/test/.eslintrc.cjs
💤 Files with no reviewable changes (11)
  • apps/posts/.eslintrc.cjs
  • apps/admin-x-settings/.eslintrc.cjs
  • apps/activitypub/.eslintrc.cjs
  • apps/activitypub/test/.eslintrc.cjs
  • apps/activitypub/.eslintignore
  • apps/stats/.eslintrc.cjs
  • apps/stats/.eslintignore
  • apps/admin-x-settings/.eslintignore
  • apps/admin-x-settings/src/hooks/use-setting-group.tsx
  • apps/stats/test/.eslintrc.cjs
  • apps/posts/test/.eslintrc.cjs

'no-eval': 'error',
'no-useless-call': 'error',
'no-console': 'error',
'no-shadow': 'error',

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enable @typescript-eslint/no-shadow and disable the base no-shadow rule.

The ghostRules includes 'no-shadow': 'error' (line 21), but TypeScript projects should use @typescript-eslint/no-shadow instead. The base ESLint no-shadow rule doesn't understand TypeScript-specific scoping for enums, namespaces, and type parameters.

Compare with activitypub/eslint.config.js which correctly handles this by disabling the base rule and enabling the TypeScript variant.

🔧 Proposed fix
 const ghostRules = {
     curly: 'error',
     camelcase: ['error', {properties: 'never'}],
     'dot-notation': 'error',
     eqeqeq: ['error', 'always'],
     'no-plusplus': ['error', {allowForLoopAfterthoughts: true}],
     'no-eval': 'error',
     'no-useless-call': 'error',
     'no-console': 'error',
-    'no-shadow': 'error',
     'array-callback-return': 'error',
     'no-constructor-return': 'error',
     'no-promise-executor-return': 'error',
     'no-unused-vars': 'off',
     '`@typescript-eslint/no-unused-vars`': ['error', {
         args: 'after-used',
         argsIgnorePattern: '^_',
         caughtErrors: 'none'
     }],
     'ghost/filenames/match-regex': ['error', '^[a-z0-9.-]+$', false]
 };

Then add to the src rules block after line 77:

             // TS handles these — disable the base ESLint variants
             'no-undef': 'off',
             'no-redeclare': 'off',
             'no-unexpected-multiline': 'off',
+            'no-shadow': 'off',
+            '`@typescript-eslint/no-shadow`': 'error',
             'ghost/sort-imports-es6-autofix/sort-imports-es6': ['error', {

Also applies to: 74-77

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/admin-x-settings/eslint.config.js` at line 21, In the eslint.config.js
file, locate the 'no-shadow': 'error' rule within the ghostRules section and
disable it by setting it to 'off'. Then add '`@typescript-eslint/no-shadow`':
'error' to the src rules block (around line 77) to properly handle
TypeScript-specific scoping for enums, namespaces, and type parameters, which
the base ESLint rule does not understand.

'no-eval': 'error',
'no-useless-call': 'error',
'no-console': 'error',
'no-shadow': 'error',

@coderabbitai coderabbitai Bot Jun 22, 2026

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enable @typescript-eslint/no-shadow and disable the base no-shadow rule.

The ghostRules includes 'no-shadow': 'error' (line 21), but TypeScript projects should use @typescript-eslint/no-shadow instead. The base ESLint no-shadow rule doesn't understand TypeScript-specific scoping for enums, namespaces, and type parameters.

See activitypub/eslint.config.js for the correct implementation.

🔧 Proposed fix

Remove 'no-shadow': 'error' from ghostRules:

 const ghostRules = {
     curly: 'error',
     camelcase: ['error', {properties: 'never'}],
     'dot-notation': 'error',
     eqeqeq: ['error', 'always'],
     'no-plusplus': ['error', {allowForLoopAfterthoughts: true}],
     'no-eval': 'error',
     'no-useless-call': 'error',
     'no-console': 'error',
-    'no-shadow': 'error',
     'array-callback-return': 'error',
     'no-constructor-return': 'error',
     'no-promise-executor-return': 'error',
     'no-unused-vars': 'off',
     '`@typescript-eslint/no-unused-vars`': ['error', {
         args: 'after-used',
         argsIgnorePattern: '^_',
         caughtErrors: 'none'
     }],
     'ghost/filenames/match-regex': ['error', '^[a-z0-9.-]+$', false]
 };

Add after line 76:

             'no-undef': 'off',
             'no-redeclare': 'off',
             'no-unexpected-multiline': 'off',
+            'no-shadow': 'off',
+            '`@typescript-eslint/no-shadow`': 'error',
             'ghost/sort-imports-es6-autofix/sort-imports-es6': ['error', {

Also applies to: 74-76

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/posts/eslint.config.js` at line 21, In the eslint.config.js file,
replace the base ESLint rule `'no-shadow': 'error'` in the ghostRules object
with the TypeScript-specific equivalent `'`@typescript-eslint/no-shadow`':
'error'`. This ensures proper handling of TypeScript-specific scoping for enums,
namespaces, and type parameters. Remove the base no-shadow rule entry from
ghostRules and add the `@typescript-eslint/no-shadow` rule in the appropriate
configuration section for TypeScript files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will do in a follow up.

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.

@9larsons, sounds good! Would you like me to open a GitHub issue to track replacing 'no-shadow': 'error' with @typescript-eslint/no-shadow (and disabling the base rule) across the migrated ESLint flat configs in apps/posts, apps/stats, and apps/activitypub?


🧠 Learnings used
Learnt from: JohnONolan
Repo: TryGhost/Ghost PR: 28368
File: apps/admin-x-settings/src/components/settings/site/navigation/navigation-edit-form.tsx:32-32
Timestamp: 2026-06-04T15:15:20.265Z
Learning: In this TryGhost/Ghost codebase (Tailwind CSS v4), use/accept the v4 suffix form of the important modifier in class names (e.g., `opacity-100!`, `flex!`). Do not flag these as incorrect or inconsistent with the older v3 prefix form (`!opacity-100`), since the suffix form is the established convention and aligns with the generated CSS.

Learnt from: sagzy
Repo: TryGhost/Ghost PR: 28779
File: ghost/core/core/frontend/web/middleware/error-handler.js:0-0
Timestamp: 2026-06-22T14:36:35.803Z
Learning: When using Express.js view engines, Express stores engine handler functions in `app.engines` with keys that include a leading dot (e.g., `app.engines['.hbs']` and `app.engines['.ejs']`). Therefore, checking `app.engines.hbs` (no dot) will be `undefined`; to test whether an engine is already registered, use bracket notation with the dot prefix: `app.engines['.hbs'] !== undefined` (or equivalently `Object.prototype.hasOwnProperty.call(app.engines, '.hbs')`).

'no-eval': 'error',
'no-useless-call': 'error',
'no-console': 'error',
'no-shadow': 'error',

@coderabbitai coderabbitai Bot Jun 22, 2026

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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enable @typescript-eslint/no-shadow and disable the base no-shadow rule.

The ghostRules includes 'no-shadow': 'error' (line 21), but TypeScript projects should use @typescript-eslint/no-shadow instead. The base ESLint no-shadow rule doesn't understand TypeScript-specific scoping for enums, namespaces, and type parameters.

See activitypub/eslint.config.js for the correct implementation.

🔧 Proposed fix

Remove 'no-shadow': 'error' from ghostRules:

 const ghostRules = {
     curly: 'error',
     camelcase: ['error', {properties: 'never'}],
     'dot-notation': 'error',
     eqeqeq: ['error', 'always'],
     'no-plusplus': ['error', {allowForLoopAfterthoughts: true}],
     'no-eval': 'error',
     'no-useless-call': 'error',
     'no-console': 'error',
-    'no-shadow': 'error',
     'array-callback-return': 'error',
     'no-constructor-return': 'error',
     'no-promise-executor-return': 'error',
     'no-unused-vars': 'off',
     '`@typescript-eslint/no-unused-vars`': ['error', {
         args: 'after-used',
         argsIgnorePattern: '^_',
         caughtErrors: 'none'
     }],
     'ghost/filenames/match-regex': ['error', '^[a-z0-9.-]+$', false]
 };

Add after line 76:

             'no-undef': 'off',
             'no-redeclare': 'off',
             'no-unexpected-multiline': 'off',
+            'no-shadow': 'off',
+            '`@typescript-eslint/no-shadow`': 'error',
             'ghost/sort-imports-es6-autofix/sort-imports-es6': ['error', {

Also applies to: 74-76

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/stats/eslint.config.js` at line 21, The ghostRules object currently
includes the base ESLint rule 'no-shadow' set to 'error', but TypeScript
projects should use the TypeScript-aware variant '`@typescript-eslint/no-shadow`'
instead, as the base rule doesn't understand TypeScript-specific scoping for
enums, namespaces, and type parameters. Remove the 'no-shadow': 'error' entry
from the ghostRules object and add '`@typescript-eslint/no-shadow`': 'error' to
properly handle TypeScript-specific scoping rules.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will do in a follow up.

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.

@9larsons, sounds good! Would you like me to open a GitHub issue to track replacing no-shadow with @typescript-eslint/no-shadow across the ESLint flat configs (apps/stats, apps/posts, apps/activitypub, apps/admin-x-settings) so it doesn't get lost?


🧠 Learnings used
Learnt from: JohnONolan
Repo: TryGhost/Ghost PR: 28368
File: apps/admin-x-settings/src/components/settings/site/navigation/navigation-edit-form.tsx:32-32
Timestamp: 2026-06-04T15:15:20.265Z
Learning: In this TryGhost/Ghost codebase (Tailwind CSS v4), use/accept the v4 suffix form of the important modifier in class names (e.g., `opacity-100!`, `flex!`). Do not flag these as incorrect or inconsistent with the older v3 prefix form (`!opacity-100`), since the suffix form is the established convention and aligns with the generated CSS.

Learnt from: sagzy
Repo: TryGhost/Ghost PR: 28779
File: ghost/core/core/frontend/web/middleware/error-handler.js:0-0
Timestamp: 2026-06-22T14:36:35.803Z
Learning: When using Express.js view engines, Express stores engine handler functions in `app.engines` with keys that include a leading dot (e.g., `app.engines['.hbs']` and `app.engines['.ejs']`). Therefore, checking `app.engines.hbs` (no dot) will be `undefined`; to test whether an engine is already registered, use bracket notation with the dot prefix: `app.engines['.hbs'] !== undefined` (or equivalently `Object.prototype.hasOwnProperty.call(app.engines, '.hbs')`).

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.09%. Comparing base (3c8576d) to head (f62b8df).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28803      +/-   ##
==========================================
+ Coverage   74.06%   74.09%   +0.02%     
==========================================
  Files        1559     1559              
  Lines      134729   134729              
  Branches    16296    16298       +2     
==========================================
+ Hits        99784    99823      +39     
+ Misses      33966    33896      -70     
- Partials      979     1010      +31     
Flag Coverage Δ
e2e-tests 76.22% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@9larsons 9larsons force-pushed the eslint9-06-admin-react-apps branch from 4d4f71d to 99aa5f1 Compare June 22, 2026 19:39
ref https://linear.app/tryghost/

- migrated apps/admin-x-settings, apps/posts, apps/stats, apps/activitypub
- each had .eslintrc.cjs + test/.eslintrc.cjs split; collapsed to single
  eslint.config.js per workspace
- dropped admin-x-settings's enormous inline copy of the legacy ghost/browser
  formatting rules (all removed from ESLint 9 core anyway)
- moved .eslintignore patterns into flat-config 'ignores' (flat config does
  not honor .eslintignore files)
- fixed a small batch of pre-existing real lint failures uncovered when the
  cache was rebuilt:
    - empty-pattern destructurings -> regular signatures
    - !!x boolean cast in an if-test -> bare condition
    - useless backslashes inside regex character classes
    - case-without-braces for a const declaration
    - empty else block
    - one no-async-promise-executor disabled inline (intentional pattern)
    - regex newlines via NBSP -> regular space
- '@typescript-eslint/no-explicit-any' kept 'warn' in src and 'off' in tests
- modernized all four to ESM ('type': 'module'); each already runs ESM at
  runtime under Vite, just makes declaration match
@9larsons 9larsons force-pushed the eslint9-06-admin-react-apps branch from 99aa5f1 to 0a5927b Compare June 22, 2026 20:13
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.

1 participant