Skip to content
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

Prettier reindenting json code blocks in .md files to 4 spaces. #62

Closed
Aquaticat opened this issue Jan 19, 2022 · 11 comments
Closed

Prettier reindenting json code blocks in .md files to 4 spaces. #62

Aquaticat opened this issue Jan 19, 2022 · 11 comments

Comments

@Aquaticat
Copy link
Contributor

Found this out after changing Prettier format script in package.json to properly include all .md files in subdirectories.

Before:

    "format": "run-z +z --then prettier --write \"**.{json,md}\"",

After:

    "format": "run-z +z --then prettier --write \"**/*.{json,md}\"",

Before:

{
  "scripts": {
    "test": "run-z +z jest",
    "z": "run-z +test/--runInBand"
  }
}

After:

{
    "scripts": {
        "test": "run-z +z jest",
        "z": "run-z +test/--runInBand"
    }
}

Clearly, this is unwanted. Not submitting formatted files in pull request because of this issue.

@surol
Copy link
Member

surol commented Jan 19, 2022

This is unavoidable due to prettier/prettier#5378
It seems using Prettier for all files is not an option.

@surol surol closed this as completed Jan 19, 2022
@Aquaticat
Copy link
Contributor Author

@surol I don't think this issue can be closed in its current state. Either we should just let Prettier format json inside markdown that way or we should whitelist markdown from Prettier.

@Aquaticat
Copy link
Contributor Author

Also, the npm script is not working properly. You should either fix it or remove it.

@surol
Copy link
Member

surol commented Jan 19, 2022

There is no perfect solution for this. Prettier is better to have, sometimes. E.g. I had to reformat the README file with Prettier, as you requested. Still, it is clean that Prettier is not a good thing everywhere.

@Aquaticat
Copy link
Contributor Author

So what solution do you propose?

@surol
Copy link
Member

surol commented Jan 19, 2022

Leave it be. Just ignore Prettier.

@Aquaticat
Copy link
Contributor Author

Just to confirm: Are you saying not using Prettier to format these markdown files is the solution?

@surol
Copy link
Member

surol commented Jan 19, 2022

Just to confirm: Are you saying not using Prettier to format these markdown files is the solution?

Yes, don't use Prettier for formatting. You were right about it. It brings more problems than solves.

@Aquaticat
Copy link
Contributor Author

Alright. I'll update .../styleguide/markdown.md to make sure I know it's not to be used in the future. Also I'll update #61 to include language names in code blocks.

@Aquaticat
Copy link
Contributor Author

How do you feel about removing that npm script? I feel like removing that script is the right decision.

@surol
Copy link
Member

surol commented Jan 19, 2022

Alright, you can remove it. But don't remove the devDependency. It could be useful. Occasionally.

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

No branches or pull requests

2 participants