Skip to content

Linting: Remove dependency import comments and blank lines repository-wide #81188

Description

@ciampo

Follow-up to #73396 and this review comment on #81037.

What problem does this address?

We decided to stop using External dependencies, WordPress dependencies, and Internal dependencies comment blocks, but the migration is incomplete.

Earlier work stopped requiring the comments (#73616), added a lint option to forbid them (#74990), and removed them from a few packages (#78573). However:

  • About 9,540 dependency comment blocks remain in 5,510 files.
  • The coding guidelines still tell contributors to add them.
  • Only design-system-mcp, ui, and theme prevent them from being reintroduced.
  • Blank lines between import groups are allowed.
  • Staged linting does not cover .mjs or .cjs files.

The desired result is one contiguous import block, with no dependency group comments or blank lines between imports. This does not add alphabetization or otherwise change the existing import ordering policy.

For this behavior, the relevant import/order option is newlines-between: "never". newlines-between-types only applies to type-only import groups.

Proposed plan

  1. Remove the outdated guidance

    • Stop telling contributors to add dependency group comments.
  2. Define the final lint rules

    • Harden and test the existing dependency-group rule's "never" mode.
    • Forbid dependency comments and import blank lines in the base ESLint configuration.
    • Cover *.{js,jsx,ts,tsx,mjs,cjs} files.
    • Preserve meaningful comments and side-effect import order.
  3. Replace the strict configuration with bulk suppressions

    • Remove the separate strict ESLint configuration.
    • Run ESLint with --fix first so safely fixable violations are not suppressed.
    • Bulk-suppress remaining legacy violations.
    • Use the existing CI pruning workflow to keep the suppression file current.
  4. Remove the legacy violations

    • Fix suppressed violations in reviewable batches.
    • Prune the corresponding suppressions as each batch lands.
    • Add mechanical cleanup commits to .git-blame-ignore-revs.

Done when

  • Dependency group comments remain only in lint-rule fixtures.
  • Imports have no blank lines between them.
  • The base ESLint configuration and CI enforce both rules for all supported files.
  • The strict ESLint configuration has been removed.
  • Documentation matches the enforced convention.
  • No related bulk suppressions remain.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions