-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add .prettierignore #5262
Open
chancancode
wants to merge
1
commit into
open-telemetry:main
Choose a base branch
from
tildeio:prettierignore
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chancancode
force-pushed
the
prettierignore
branch
2 times, most recently
from
December 18, 2024 01:10
4a17ddb
to
ca9de44
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5262 +/- ##
==========================================
+ Coverage 94.63% 94.64% +0.01%
==========================================
Files 323 323
Lines 8083 8083
Branches 1643 1643
==========================================
+ Hits 7649 7650 +1
+ Misses 434 433 -1 |
chancancode
force-pushed
the
prettierignore
branch
from
December 18, 2024 19:44
ca9de44
to
efa945c
Compare
rebased |
Currently, this project uses `prettier` to enforce consistent formatting, but only via the `eslint-plugin-prettier` integration, which only covers `*.js` and `*.ts` files in sub-packages with ESLint setup. Notably, this setup is [not recommended by the prettier project][1]. The recommended setup is to use prettier as a standalone tool, and use `eslint-plugin-config` to disable any conflicting rules. In my experience that does result in a better development experience and this is worth revisiting in the future. However, this PR doesn't aim to change that at this moment. The issue I'm trying to address is that prettier as a tool covers a wide variety of file formats beyond JavaScript, including JSON, YAML markdown, and more. When using an editor that comes with prettier integration (such as VSCode + the prettier extension), it will see that the project uses prettier, but it doesn't know the project only uses it via ESLint. Thus, when saving a file not currently covered by our set up, such as CHANGELOG.md, it may attempt to re-format the file according to prettier's conventions, causing unnecessary diffs that then need to be reverted. This solves the issue by adding a `.prettierignore` file that tries to ignore everything that isn't intended to be formatted. This is obtained by trial-and-error, until running `npx prettier -w .` no longer result in any changes. Most of the changes that prettier would have made are actually quite minor, and IMO good. If there is appetite in revisiting the prettier setup and commiting those changes, I am happy to propose that in a different PR. [1]: https://prettier.io/docs/en/integrating-with-linters#notes
chancancode
force-pushed
the
prettierignore
branch
from
December 19, 2024 19:23
efa945c
to
7de0393
Compare
Oops, guess I rebased against the wrong branch the first time, should be fixed now, and ran |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
The issue I'm trying to address is that prettier as a tool covers a wide variety of file formats beyond JavaScript, including JSON, YAML markdown, and more. When using an editor that comes with prettier integration (such as VSCode + the prettier extension), it will see that the project uses prettier, but it doesn't know the project only uses it via ESLint. Thus, when saving a file not currently covered by our set up, such as CHANGELOG.md, it may attempt to re-format the file according to prettier's conventions, causing unnecessary diffs that then need to be reverted.
Short description of the changes
This solves the issue by adding a
.prettierignore
file that tries to ignore everything that isn't intended to be formatted. This is obtained by trial-and-error, until runningnpx prettier -w .
no longer result in any changes.Context
Currently, this project uses
prettier
to enforce consistent formatting, but only via theeslint-plugin-prettier
integration, which only covers*.js
and*.ts
files in sub-packages with ESLint setup.Notably, this setup is not recommended by the prettier project. The recommended setup is to use prettier as a standalone tool, and use
eslint-plugin-config
to disable any conflicting rules.In my experience that does result in a better development experience and this is worth revisiting in the future. However, this PR doesn't aim to change that at this moment.
Most of the changes that prettier would have made are actually quite minor, and IMO good. If there is appetite in revisiting the prettier setup and commiting those changes, I am happy to propose that in a different PR.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
npx prettier -w .
Checklist:
Followed the style guidelines of this projectUnit tests have been addedDocumentation has been updated