Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS Tools: update the GH action lint to use ESM for chalk v5 #40944

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ jobs:
- '.github/workflows/*.{yml,yaml}'
- '.github/actions/*/action.{yml,yaml}'
- 'projects/github-actions/*/action.{yml,yaml}'
# If we edit the linting JS files, we need to run it.
- 'tools/js-tools/lint-gh-actions.{js,mjs}'
misc_php:
# If composer, phpcs config, or the codesniffer package itself changed, there may be a new standard.
- 'composer.json'
Expand Down Expand Up @@ -341,7 +343,7 @@ jobs:
run: pnpm run lint-changed --git-base=$SHA $(jq -rn --argjson files "$FILES" '$files[]')

### Lints GitHub Actions yaml files.
# Local equivalent: `./tools/js-tools/lint-gh-actions.js <files>`
# Local equivalent: `./tools/js-tools/lint-gh-actions.mjs <files>`
lint_gh_actions:
name: Lint GitHub Actions yaml files
runs-on: ubuntu-latest
Expand All @@ -358,7 +360,7 @@ jobs:

- run: pnpm install
- name: Run lint
run: ./tools/js-tools/lint-gh-actions.js -v '.github/workflows/*.{yml,yaml}' '.github/actions/*/action.{yml,yaml}' 'projects/github-actions/*/action.{yml,yaml}'
run: ./tools/js-tools/lint-gh-actions.mjs -v '.github/workflows/*.{yml,yaml}' '.github/actions/*/action.{yml,yaml}' 'projects/github-actions/*/action.{yml,yaml}'

### Checks that copied files (e.g. readme, license) are in sync
# Local equivalent: `./tools/check-copied-files.sh`
Expand Down
2 changes: 1 addition & 1 deletion tools/js-tools/git-hooks/pre-commit-hook.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ function runCheckGitHubActionsYamlFiles() {
return;
}

const result = spawnSync( './tools/js-tools/lint-gh-actions.js', files, {
const result = spawnSync( './tools/js-tools/lint-gh-actions.mjs', files, {
stdio: 'inherit',
} );
if ( result && result.status ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

/* eslint-env node */

const fs = require( 'fs' );
const chalk = require( 'chalk' );
const { glob } = require( 'glob' );
const YAML = require( 'yaml' );
import fs from 'fs';
import chalk from 'chalk';
import { glob } from 'glob';
import YAML from 'yaml';

const isCI = !! process.env.CI;

Expand Down
Loading