Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#55429 new feature request

Coding Standard: Use spaces for JSON instead of tabs

Reported by: scruffian's profile scruffian Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: needs-refresh
Focuses: Cc:

Description

When PHP outputs JSON using json_encode, there's no option to output it with tabs instead of spaces. This is particularly relevant in since https://github.com/WordPress/gutenberg/pull/39048 merged - we now convert theme.json files that were using tabs to spaces.

We could use a regex to convert these spaces back to tabs, but maybe its simpler to default to spaces for JSON files since that is the format that PHP uses.

Opening this ticket to start the discussion...

Attachments (1)

json.patch (2.0 KB) - added by scruffian 2 years ago.
Coding standards change

Download all attachments as: .zip

Change History (4)

@scruffian
2 years ago

Coding standards change

This ticket was mentioned in Slack in #core-editor by scruffian. View the logs.


2 years ago

#2 @SergeyBiryukov
2 years ago

  • Keywords needs-refresh added

Thanks for the patch! It looks like it has some unrelated changes from [52940] / #54272, marking as needs-refresh.

#3 @johnbillion
2 years ago

  • Component changed from General to Build/Test Tools

We all know this is an age-old discussion, but I recently learned that there's an accessibility benefit to tabs instead of spaces. It allows developers with vision difficulties to control the spacing in their editor which they cannot do with spaces: https://twitter.com/johnbillion/status/1380173004307595266.

Note: See TracTickets for help on using tickets.