Skip to content

Lint scripts from the root config#3310

Merged
mokagio merged 4 commits into
trunkfrom
mokagio/modernize-scripts-eslint
May 4, 2026
Merged

Lint scripts from the root config#3310
mokagio merged 4 commits into
trunkfrom
mokagio/modernize-scripts-eslint

Conversation

@mokagio
Copy link
Copy Markdown
Contributor

@mokagio mokagio commented May 1, 2026

How AI was used in this PR

Used Codex to implement the script updates, run local verification, and surface the pre-existing script lint issues that had to be fixed once scripts/ was added to the root lint target.
I reviewed the resulting diff and verification output before opening this PR.

Proposed Changes

While working with AI in this repo for the CI automation, I run into linting inconsistencies in the scripts folder a few times. This PR propose to treat the scripts as first-class linting citizens, and addresses any issue found in them.

  • Bring scripts/ under the root npm run lint target.
  • Align the ESM scripts with the repo's import.meta.dirname preference and add a guardrail against reintroducing __dirname in scripts/**/*.mjs.
  • Fix the pre-existing script lint issues that surfaced once scripts/ was linted, while keeping existing CommonJS script entrypoints valid.

Testing Instructions

  • Run npm run lint
  • Run npm run typecheck
  • Run env FILE_ARCHITECTURE=x64 WINDOWS_CODE_SIGNING_CERT_PASSWORD=fake node scripts/package-appx.mjs and confirm it gets past module loading and stops at the expected missing Windows SDK check.
  • Run env FILE_ARCHITECTURE=x64 node scripts/make-dmg.mjs after a full install and confirm it reaches appdmg; with npm install --ignore-scripts it currently stops earlier on the missing native volume.node dependency.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

Bring `scripts/` under the root `lint` target instead of leaving it
outside repo lint coverage.
Align the ESM scripts with the repo's `import.meta.dirname`
preference and fix the pre-existing script lint issues that surfaced
once `scripts/` was included.
Keep CommonJS entrypoints working by limiting the `require()`
exception to `scripts/**/*.js` and `scripts/**/*.cjs`.

---

Generated with the help of Codex, https://openai.com

Co-Authored-By: Codex GPT-5 <noreply@openai.com>
@mokagio mokagio self-assigned this May 1, 2026
Comment thread scripts/make-dmg.mjs Fixed
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mokagio mokagio requested review from p-jackson and wojtekn May 1, 2026 03:40
@mokagio mokagio marked this pull request as ready for review May 1, 2026 03:40
Copilot AI review requested due to automatic review settings May 1, 2026 03:40
@mokagio mokagio enabled auto-merge (squash) May 1, 2026 03:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the repository’s scripts/ directory part of the root ESLint target and updates affected scripts/config so they lint cleanly and follow the repo’s ESM path-resolution conventions.

Changes:

  • Include scripts/ in the root npm run lint target.
  • Update multiple .mjs scripts to use import.meta.dirname instead of fileURLToPath(import.meta.url)/__dirname.
  • Add ESLint overrides for scripts/**/* (allow require in CommonJS scripts; restrict __dirname/__filename usage in ESM scripts) and fix surfaced lint issues (e.g., hasOwnProperty, floating promises).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/start-new-ui.mjs Switch root path resolution to import.meta.dirname.
scripts/prepare-dev-build-version.mjs Reorder imports to satisfy lint ordering.
scripts/package-in-isolation.ts Use safe Object.prototype.hasOwnProperty.call check.
scripts/package-appx.mjs Remove local __dirname and use import.meta.dirname for paths.
scripts/make-dmg.mjs Replace execSync string invocation with execFileSync + import.meta.dirname paths.
scripts/download-node-binary.ts Fix lint ordering and mark async entrypoint call with void.
scripts/download-available-site-translations.mjs Use import.meta.dirname for output path resolution.
scripts/azure-signing.cjs Reformat env var list to satisfy lint/formatting.
scripts/azure-sign-hook.js Remove per-file eslint disable now covered by ESLint override.
package.json Add scripts to the root lint command target list.
eslint.config.mjs Add scripts-specific overrides and ESM guardrails for __dirname/__filename.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/make-dmg.mjs Outdated
mokagio and others added 2 commits May 1, 2026 15:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@wpmobilebot
Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing f2c750c vs trunk

app-size

Metric trunk f2c750c Diff Change
App Size (Mac) 1511.23 MB 1511.23 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk f2c750c Diff Change
load 1822 ms 1802 ms 20 ms ⚪ 0.0%

site-startup

Metric trunk f2c750c Diff Change
siteCreation 8076 ms 8079 ms +3 ms ⚪ 0.0%
siteStartup 4942 ms 4961 ms +19 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Copy link
Copy Markdown
Contributor

@wojtekn wojtekn left a comment

Choose a reason for hiding this comment

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

Looks good.

@mokagio mokagio merged commit 3981d90 into trunk May 4, 2026
11 checks passed
@mokagio mokagio deleted the mokagio/modernize-scripts-eslint branch May 4, 2026 07:56
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.

5 participants