Overview

https://cs.symfony.com/doc/rules/import/ordered_imports.html

Most IDEs collapse this so it's not obvious, but can be a source of merge failures when updating an MR with upstream.

This is already done in our typescript: #3544433: Sort import statements in JS/TS files using Prettier

Proposed resolution

Enable that rule in phpcs.

User interface changes

None.

Issue fork canvas-3588837

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

penyaskito created an issue. See original summary.

penyaskito’s picture

Not really tech debt, but definitely a DX improvement.

wim leers’s picture

Component: Code » Project management

👍 Yes please! This would have made many merge conflicts easier to resolve (or make them simply not exist, even).

wim leers’s picture

wim leers’s picture

Title: phpcs: Organize PHP imports alphabetically » phpcs: Organize PHP imports alphabetically to reduce merge conflict frequency
Assigned: Unassigned » penyaskito
Status: Active » Needs review

For once, a PHPCS issue that didn't require any AI 🤖 😄

penyaskito’s picture

Assigned: penyaskito » wim leers
Status: Needs review » Reviewed & tested by the community

Didn't merge this because CI is clunky tonight and want to merge #3591028: Consistently use JSON-Schema Draft-07 dialect in frontend and backend by updating `justinrainbow/json-schema` to ^6.8.0 first, but this is RTBC.

  • wim leers committed 0fbc6ec5 on 1.x
    chore(Project management): #3588837 phpcs: Organize PHP imports...
wim leers’s picture

Assigned: wim leers » Unassigned
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.