Skip to content

Narrow scope of prettier command #38

Description

@mortona42

I ran ddev prettier on a custom module, and it incorrectly flagged a .inc file.

In Drupal code, .inc files are PHP, but prettier parses them as HTML by default.

Drupal core has two ways to run prettier:

  1. npm/yarn script in package.json.
    This command is exclusive to css/js.
    It also has some custom exclusions in .prettierignore.
  2. Run on postcss compiled css by compile.js.
    Change record

A lot of our code should actually be checked by eslint and phpcs/phpcbf, which raises the question - what do we actually want to check with a prettier ddev command?

A conversation with claude says that it should only be used for .md and .json. However, core doesn't do this.

Another consideration is that we'll want to have config we can use in our IDEs. So we probably want to make the change in .prettierignore, and not in the ddev command.

Therefore, I think the most straightforward fix is to add .inc to .prettierignore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions