Skip to content

Create a stylelint rule that fails unused disable comments #8641

@alex-page

Description

@alex-page

Our repo and shopify/web is littered with migration comments to make stylelint happy. Many of them are no longer necessary as we removed layout from failures.

We should address this and make sure comments are added only when there is a failing next line (comments should not be needed for warnings). If a comment is added and not removed when an issue is fixed it should fail like eslint does.

  • Create a new rule for stylelint that works like eslint-comments/no-unused-disable
  • Add similar logic for enable
  • Write a custom formatter or autofix to automate removal of these comments
  • Ship the linting rule to shopify/polaris and run formatter
  • Ship the linting rule to shopify/web and run formatter

Alternate temporary approach

  1. Delete all polaris migrator injected comments
  2. Run migration again to add comments where it is needed

For example: #8644


Alternate approach

  1. Update the migration to add comments to also remove unused comments

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