Skip to content

Run prettier in the development workflow #2543

Open
@trivikr

Description

@trivikr

Is your feature request related to a problem? Please describe

Prettier was added in #1439, but I couldn't find where it's run in the CI.
There don't seem to be IDE specific configurations or precommit hooks.

https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-js-contrib+prettier+NOT+path%3A*.md&type=code

Because of this, there are some files committed without prettier being run

$ npx prettier --write $(git ls-files '*.ts' '*.js')
...

$ git status --short | wc -l
     143

Describe the solution you'd like to see

Run prettier somewhere in the development cycle. A good place to start is GitHub CI.

Maybe add format and format:fix in root package.json similar to lint:markdown and lint:markdown:fix

    "format": "prettier --check $(git ls-files '*.ts' '*.js')",
    "format:fix": "prettier --write $(git ls-files '*.ts' '*.js')",

Describe alternatives you've considered

All packages already have lint and lint:fix scripts. Another option will be add equivalent format and format:fix which run prettier.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions