Skip to content

Commit 11c5c5c

Browse files
authored
Merge pull request #1605 from devansh016/Format-files-using-npm-run-format-js
Improve formatting of `.json` and `.yml` files
2 parents d6a87bc + 2e8f0b4 commit 11c5c5c

16 files changed

Lines changed: 1853 additions & 1838 deletions

File tree

.editorconfig

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,25 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
14
# WordPress Coding Standards
2-
# https://make.wordpress.org/core/handbook/best-practices/coding-standards/
5+
# https://developer.wordpress.org/coding-standards/wordpress-coding-standards/
6+
7+
# This is largely aligned with the .editorconfig in wordpress-develop and Gutenberg.
8+
# Matches: https://github.com/WordPress/wordpress-develop/blob/bff31ca3a823e89127a7d3c2d953eda3d9b2193e/.editorconfig#L7-L21
9+
# See also: https://github.com/WordPress/gutenberg/blob/trunk/.editorconfig
310

411
root = true
512

613
[*]
714
charset = utf-8
815
end_of_line = lf
9-
indent_size = 4
10-
tab_width = 4
11-
indent_style = tab
1216
insert_final_newline = true
1317
trim_trailing_whitespace = true
14-
15-
[*.md]
16-
trim_trailing_whitespace = false
17-
indent_style = space
18-
indent_size = 2
19-
20-
[*.txt]
21-
trim_trailing_whitespace = false
22-
23-
[*.json]
24-
indent_style = space
25-
indent_size = 2
26-
27-
[.*rc]
28-
insert_final_newline = false
29-
indent_style = space
30-
indent_size = 2
18+
indent_style = tab
3119

3220
[*.yml]
33-
insert_final_newline = false
34-
quote_type = single
3521
indent_style = space
3622
indent_size = 2
3723

38-
[.github/CODEOWNERS]
39-
indent_style = space
24+
[*.md]
25+
trim_trailing_whitespace = false

.github/dependabot.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ updates:
66
interval: weekly
77
open-pull-requests-limit: 10
88
labels:
9-
- "no milestone"
10-
- "[Type] Enhancement"
11-
- "github_actions"
9+
- 'no milestone'
10+
- '[Type] Enhancement'
11+
- 'github_actions'
1212
cooldown:
1313
default-days: 7
1414

@@ -18,9 +18,9 @@ updates:
1818
interval: weekly
1919
open-pull-requests-limit: 10
2020
labels:
21-
- "no milestone"
22-
- "[Type] Enhancement"
23-
- "javascript"
21+
- 'no milestone'
22+
- '[Type] Enhancement'
23+
- 'javascript'
2424
cooldown:
2525
default-days: 7
2626
groups:
@@ -34,9 +34,9 @@ updates:
3434
interval: weekly
3535
open-pull-requests-limit: 10
3636
labels:
37-
- "no milestone"
38-
- "[Type] Enhancement"
39-
- "php"
37+
- 'no milestone'
38+
- '[Type] Enhancement'
39+
- 'php'
4040
cooldown:
4141
default-days: 7
4242
groups:

.github/workflows/deploy-plugins.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
echo "plugins=$(echo $PLUGINS | jq -c .)" >> $GITHUB_OUTPUT
4848
4949
deploy:
50-
name: "Deploy Plugin: ${{ matrix.plugin }}"
50+
name: 'Deploy Plugin: ${{ matrix.plugin }}'
5151
needs: pre-run
5252
runs-on: ubuntu-latest
5353
permissions:
@@ -132,7 +132,7 @@ jobs:
132132
with:
133133
step: start
134134
token: ${{ secrets.GITHUB_TOKEN }}
135-
env: "wp.org plugin: ${{ matrix.plugin }}"
135+
env: 'wp.org plugin: ${{ matrix.plugin }}'
136136

137137
- name: Deploy Plugin - ${{ matrix.plugin }}
138138
if: steps.check-deployment.outputs.deploy == 'true'
@@ -155,12 +155,12 @@ jobs:
155155
token: ${{ secrets.GITHUB_TOKEN }}
156156
status: ${{ job.status }}
157157
deployment_id: ${{ steps.wporg-deployment.outputs.deployment_id }}
158-
env: "wp.org plugin: ${{ matrix.plugin }}"
159-
env_url: "https://wordpress.org/plugins/${{ matrix.plugin }}/"
158+
env: 'wp.org plugin: ${{ matrix.plugin }}'
159+
env_url: 'https://wordpress.org/plugins/${{ matrix.plugin }}/'
160160

161161
release-assets:
162162
name: Add release assets
163-
needs: [ pre-run, deploy ]
163+
needs: [pre-run, deploy]
164164
runs-on: ubuntu-latest
165165
permissions:
166166
actions: read

.github/workflows/php-test-plugins.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ on:
3333

3434
jobs:
3535
php-test-plugins:
36-
name: "PHP ${{ matrix.php }} / WP ${{ matrix.wp }}"
36+
name: 'PHP ${{ matrix.php }} / WP ${{ matrix.wp }}'
3737
runs-on: ubuntu-latest
3838
timeout-minutes: 20
3939
strategy:
4040
fail-fast: false
4141
matrix:
4242
php: ['8.1', '8.0', '7.4', '7.3', '7.2']
43-
wp: [ 'latest' ]
43+
wp: ['latest']
4444
coverage: [false]
4545
include:
4646
- php: '7.4'

.github/workflows/plugin-check.yml

Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
11
name: Plugin Check
22

33
on:
4-
workflow_dispatch:
5-
push:
6-
branches:
7-
- develop
8-
- trunk
9-
pull_request:
10-
types:
11-
- opened
12-
- synchronize
13-
- ready_for_review
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- develop
8+
- trunk
9+
pull_request:
10+
types:
11+
- opened
12+
- synchronize
13+
- ready_for_review
1414

1515
# Cancels all previous workflow runs for pull requests that have not completed.
1616
concurrency:
17-
# The concurrency group contains the workflow name and the branch name for pull requests
18-
# or the commit hash for any other events.
19-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
20-
cancel-in-progress: true
17+
# The concurrency group contains the workflow name and the branch name for pull requests
18+
# or the commit hash for any other events.
19+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
20+
cancel-in-progress: true
2121

2222
# Disable permissions for all available scopes by default.
2323
# Any needed permissions should be configured at the job level.
2424
permissions: {}
2525

2626
jobs:
27-
prepare-matrix:
28-
runs-on: ubuntu-latest
29-
permissions:
30-
contents: read
31-
outputs:
32-
plugins: ${{ steps.set-matrix.outputs.plugins }}
33-
steps:
34-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
27+
prepare-matrix:
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: read
31+
outputs:
32+
plugins: ${{ steps.set-matrix.outputs.plugins }}
33+
steps:
34+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3535

36-
- uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
37-
with:
38-
php-version: '8.3'
36+
- uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # 2.36.0
37+
with:
38+
php-version: '8.3'
3939

40-
- name: Setup Node.js (.nvmrc)
41-
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
42-
with:
43-
node-version-file: '.nvmrc'
44-
cache: npm
40+
- name: Setup Node.js (.nvmrc)
41+
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
42+
with:
43+
node-version-file: '.nvmrc'
44+
cache: npm
4545

46-
- name: npm install
47-
run: npm ci
46+
- name: npm install
47+
run: npm ci
4848

49-
- name: Build plugins
50-
run: npm run build-plugins
49+
- name: Build plugins
50+
run: npm run build-plugins
5151

52-
- name: Upload built plugins
53-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
54-
with:
55-
name: built-plugins
56-
path: build/
57-
retention-days: 1
52+
- name: Upload built plugins
53+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
54+
with:
55+
name: built-plugins
56+
path: build/
57+
retention-days: 1
5858

59-
- name: Generate matrix
60-
id: set-matrix
61-
run: |
62-
PLUGINS=$(jq -c '.plugins' plugins.json)
63-
echo "plugins=$PLUGINS" >> $GITHUB_OUTPUT
59+
- name: Generate matrix
60+
id: set-matrix
61+
run: |
62+
PLUGINS=$(jq -c '.plugins' plugins.json)
63+
echo "plugins=$PLUGINS" >> $GITHUB_OUTPUT
6464
65-
plugin-check:
66-
needs: prepare-matrix
67-
name: Check ${{ matrix.plugin }}
68-
runs-on: ubuntu-24.04
69-
permissions:
70-
contents: read
71-
timeout-minutes: 20
72-
strategy:
73-
fail-fast: false
74-
matrix:
75-
plugin: ${{ fromJson(needs.prepare-matrix.outputs.plugins) }}
76-
steps:
77-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
65+
plugin-check:
66+
needs: prepare-matrix
67+
name: Check ${{ matrix.plugin }}
68+
runs-on: ubuntu-24.04
69+
permissions:
70+
contents: read
71+
timeout-minutes: 20
72+
strategy:
73+
fail-fast: false
74+
matrix:
75+
plugin: ${{ fromJson(needs.prepare-matrix.outputs.plugins) }}
76+
steps:
77+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
7878

79-
- name: Download built plugins
80-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
81-
with:
82-
name: built-plugins
83-
path: build
79+
- name: Download built plugins
80+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
81+
with:
82+
name: built-plugins
83+
path: build
8484

85-
- name: Run plugin check
86-
uses: wordpress/plugin-check-action@27b60e89aad9f3006d5c800a8fa9bbaa87c36421 # main
87-
with:
88-
build-dir: ./build/${{ matrix.plugin }}
89-
slug: ${{ matrix.plugin }}
90-
ignore-codes: 'readme_reserved_contributors,WordPress.WP.I18n.TextDomainMismatch'
85+
- name: Run plugin check
86+
uses: wordpress/plugin-check-action@27b60e89aad9f3006d5c800a8fa9bbaa87c36421 # main
87+
with:
88+
build-dir: ./build/${{ matrix.plugin }}
89+
slug: ${{ matrix.plugin }}
90+
ignore-codes: 'readme_reserved_contributors,WordPress.WP.I18n.TextDomainMismatch'

.prettierignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Files and folders related to build
2+
/build
3+
/node_modules
4+
/vendor
5+
/dist
6+
7+
# Minified files
8+
/**/*.min.js
9+
10+
# Build files
11+
/plugins/*/build/*
12+
13+
# Ignore Composer lock file
14+
composer.lock
15+
16+
# Ignore npm package lock file
17+
package-lock.json

.prettierrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Prettier configuration.
3+
*
4+
* @see https://prettier.io/docs/en/configuration.html
5+
*/
6+
const wordpressConfig = require( '@wordpress/prettier-config' );
7+
8+
/** @type {import("prettier").Config} */
9+
const config = {
10+
...wordpressConfig,
11+
overrides: [
12+
...( wordpressConfig.overrides || [] ),
13+
{
14+
files: '*.{yml,yaml}',
15+
options: {
16+
tabWidth: 2,
17+
useTabs: false,
18+
},
19+
},
20+
],
21+
};
22+
23+
module.exports = config;

0 commit comments

Comments
 (0)