Skip to content

Rules for space indentation instead of tabs, specifically in multiline arrays #2448

@pdewouters

Description

@pdewouters

Is your feature request related to a problem?

Enforcing spaces for indentation

Describe the solution you'd like

I want to introduce WP standards in a codebase that is using spaces for indentation, so instead of converting all indentation to tabs, I'd like to enforce 2 spaces as per existing style.
this config gets me nearly there https://gist.github.com/pdewouters/39d6b4f1c2d60e5c1538163774c8ed18

But I still get some errors related to array indentation, it thinks it should be 4 spaces instead of 2.

function update_admin_labels() {
  wp_register_script(
    'update-some-admin-labels-js',
    plugins_url( 'my-plugin/js/update-some-admin-labels.js' ),
    [
      'wp-plugins',
      'wp-edit-post',
      'wp-element',
      'wp-components',
      'wp-i18n',
    ],
    1
  );
}
add_action( 'init', 'pdate_admin_labels' );

Additional context (optional)

See screenshot: the first line has no errors because it has 4 spaces indent but the next ones throw an error. It should be the reverse

Screenshot 2024-05-30 at 13 27 49

  • I intend to create a pull request to implement this feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions