Skip to content

Changed ghost/admin (Ember) to ESLint 9 / flat config#28808

Open
9larsons wants to merge 1 commit into
mainfrom
eslint9-09-ember-admin
Open

Changed ghost/admin (Ember) to ESLint 9 / flat config#28808
9larsons wants to merge 1 commit into
mainfrom
eslint9-09-ember-admin

Conversation

@9larsons

@9larsons 9larsons commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replaced ghost/admin/.eslintrc.js and ghost/admin/mirage/.eslintrc.js with a single eslint.config.mjs.
  • Kept @babel/eslint-parser with the same legacy-decorators + JSX + class-properties babel options. Ember decorator syntax (@service, @tracked, etc.) requires this parser; ESLint 9's default Espree can't handle it.
  • eslint-plugin-ember@12.7.5 still ships legacy .eslintrc-style configs; flat-config consumers register the plugin and apply rules manually. Every legacy ember-rule override (no-controller-access-in-routes, no-classic-classes, no-classic-components, no-mixins, etc.) is preserved.
  • React jsx-uses-react / jsx-uses-vars rules preserved for the in-repo addons that include JSX.
  • mirage/.eslintrc.js's lone 'brace-style': 'off' override dropped — the rule was removed from ESLint 9 core.

The root eslint.config.mjs + scripts/.eslintrc.js migration that was originally bundled here is deferred to slice 10. ESLint 8.50+'s flat-config auto-detection would have flipped ghost/i18n and ghost/parse-email-address (still on .eslintrc until slice 7 merges) to flat-config mode if the root config landed here, breaking their lint. Moving it to slice 10 means the root config lands after every workspace is already on flat config.

Test plan

  • CI lint passes
  • `pnpm --filter ghost-admin lint:js` is green locally
  • Spot-check earlier-migrated workspaces still lint clean

@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: 78fb6dcb-ea55-41e7-93ab-1ef95ca5a830

📥 Commits

Reviewing files that changed from the base of the PR and between 1771d00 and a607094.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • ghost/admin/.eslintrc.js
  • ghost/admin/eslint.config.mjs
  • ghost/admin/mirage/.eslintrc.js
  • ghost/admin/package.json
💤 Files with no reviewable changes (2)
  • ghost/admin/.eslintrc.js
  • ghost/admin/mirage/.eslintrc.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • ghost/admin/package.json
  • ghost/admin/eslint.config.mjs

Walkthrough

The pull request removes the legacy ghost/admin/.eslintrc.js and ghost/admin/mirage/.eslintrc.js configuration files and replaces them with a new ghost/admin/eslint.config.mjs ESLint 9 flat-config module. The new module defines an inline filenamesMatchRegex rule, a localFilenamesPlugin, shared ghostBaseRules and emberRules sets, and a dynamically constructed mochaRulesOff map. It exports two config entries: one for all **/*.js files and one overriding settings for tests/**/*.js. The ghost/admin/package.json devDependencies are updated to add @eslint/js, switch eslint to catalog:eslint9, add globals@17.6.0, and update several eslint-plugin-* packages.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: migration of ghost/admin to ESLint 9 with flat config format, which is the primary objective of the PR.
Description check ✅ Passed The description provides relevant detail about the changeset, explaining the consolidation of ESLint configs, preservation of Babel options and rules, and the rationale for including root/scripts migration.
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-09-ember-admin

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.

@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 1771d00

Command Status Duration Result
nx build @tryghost/sodo-search ✅ Succeeded <1s View ↗
nx build @tryghost/portal ✅ Succeeded <1s View ↗
nx build @tryghost/signup-form ✅ Succeeded <1s View ↗
nx build @tryghost/activitypub ✅ Succeeded 3s View ↗
nx build @tryghost/announcement-bar ✅ Succeeded <1s View ↗
nx build @tryghost/comments-ui ✅ Succeeded <1s View ↗
nx build @tryghost/admin-toolbar ✅ Succeeded <1s View ↗
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 9m 57s 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 22:58:41 UTC

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

🧹 Nitpick comments (1)
eslint.config.mjs (1)

8-12: 🎯 Functional Correctness | 🔵 Trivial

Apply sourceType: 'module' to .mjs files in the ESLint configuration.

Line 8 applies sourceType: 'script' to scripts/**/*.mjs, which would break lint parsing if .mjs files use import/export syntax. While no .mjs files currently exist in scripts/, it's good practice to split the configuration by extension to prevent issues if they're added later.

Suggested fix
 export default [
     {
-        files: ['scripts/**/*.{js,cjs,mjs}'],
+        files: ['scripts/**/*.{js,cjs}'],
         languageOptions: {
             ecmaVersion: 2022,
             sourceType: 'script',
             globals: globals.node
         }
+    },
+    {
+        files: ['scripts/**/*.mjs'],
+        languageOptions: {
+            ecmaVersion: 2022,
+            sourceType: 'module',
+            globals: globals.node
+        }
+    }
 ];
🤖 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 `@eslint.config.mjs` around lines 8 - 12, The ESLint configuration at line 8
applies `sourceType: 'script'` to all files matching
`scripts/**/*.{js,cjs,mjs}`, but `.mjs` files require `sourceType: 'module'` to
properly parse ES module syntax with import/export statements. Split the
configuration into two separate rules: one for `scripts/**/*.{js,cjs}` files
keeping `sourceType: 'script'`, and a new rule for `scripts/**/*.mjs` files with
`sourceType: 'module'` to ensure correct parsing of ES module syntax in `.mjs`
files.
🤖 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.

Nitpick comments:
In `@eslint.config.mjs`:
- Around line 8-12: The ESLint configuration at line 8 applies `sourceType:
'script'` to all files matching `scripts/**/*.{js,cjs,mjs}`, but `.mjs` files
require `sourceType: 'module'` to properly parse ES module syntax with
import/export statements. Split the configuration into two separate rules: one
for `scripts/**/*.{js,cjs}` files keeping `sourceType: 'script'`, and a new rule
for `scripts/**/*.mjs` files with `sourceType: 'module'` to ensure correct
parsing of ES module syntax in `.mjs` files.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: abb8c048-f8b9-4f82-97c3-388d2d09e8f5

📥 Commits

Reviewing files that changed from the base of the PR and between e4b5821 and 1771d00.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • eslint.config.mjs
  • ghost/admin/.eslintrc.js
  • ghost/admin/eslint.config.mjs
  • ghost/admin/mirage/.eslintrc.js
  • ghost/admin/package.json
  • package.json
  • scripts/.eslintrc.js
💤 Files with no reviewable changes (3)
  • scripts/.eslintrc.js
  • ghost/admin/mirage/.eslintrc.js
  • ghost/admin/.eslintrc.js

ref https://linear.app/tryghost/

- migrated ghost/admin/.eslintrc.js + ghost/admin/mirage/.eslintrc.js to a
  single eslint.config.mjs
- kept @babel/eslint-parser with the same legacy-decorators + JSX +
  class-properties babel options
- spread eslint-plugin-ember rules in flat form (eslint-plugin-ember@12.7.5
  still ships legacy configs; flat config consumers register the plugin
  and apply rules manually)
- preserved every legacy ember-rule override (no-controller-access-in-routes,
  no-classic-classes, no-mixins, etc.) and the react jsx-uses-* rules
- mirage/.eslintrc.js's lone 'brace-style: off' override dropped (rule
  removed from ESLint 9 core)
- folded the root + scripts work deferred from slice 7:
  - added root eslint.config.mjs for files outside any workspace (scripts/)
  - deleted scripts/.eslintrc.js
  - switched root devDeps eslint to catalog:eslint9 + added globals
  - now that ghost/admin uses flat config too, ESLint 8.50+'s flat-config
    auto-detection no longer conflicts with .eslintrc fallback
@9larsons 9larsons force-pushed the eslint9-09-ember-admin branch from 1771d00 to a607094 Compare June 22, 2026 22:44
@9larsons 9larsons changed the title Changed ghost/admin (Ember) + root config to ESLint 9 / flat config Changed ghost/admin (Ember) to ESLint 9 / flat config Jun 22, 2026
@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.07%. Comparing base (e4b5821) to head (a607094).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #28808   +/-   ##
=======================================
  Coverage   74.07%   74.07%           
=======================================
  Files        1560     1560           
  Lines      134826   134826           
  Branches    16316    16315    -1     
=======================================
+ Hits        99875    99876    +1     
+ Misses      33941    33940    -1     
  Partials     1010     1010           
Flag Coverage Δ
admin-tests 55.16% <ø> (+<0.01%) ⬆️
e2e-tests 76.20% <ø> (ø)

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.

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