From 74a6632f30204dad395a3a14bcaf23efac4e8746 Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Fri, 1 Nov 2024 19:55:08 +0200 Subject: [PATCH] chore: infer prettier parser from file extension Issue ===== The prettier parser was set to `typescript` in the `.prettierrc.json` file. Because prettier was used for multiple files types, it caused errors when formatting files that were not TypeScript. Here is an example: ```sh README.md [error] README.md: SyntaxError: Invalid character. (1:1) [error] > 1 | # Neovim node.js client [error] | ^ [error] 2 | [error] 3 | | CI (node >= 14, Linux/macOS/Windows) | Coverage | npm | [error] 4 | |----------------------------|----------|-----| ``` This seems to cause the build to fail as of the most recent commit https://github.com/neovim/node-client/commit/74880148636620f3f76e0a568aed10ce18b512a1 Solution ======== Automatically infer the parser based on the file extension. References: - https://prettier.io/docs/en/configuration.html#setting-the-parserdocsenoptionshtmlparser-option To make the build pass, run `npx prettier --write .` to format all files. I think it's best that someone else does this, as it will change the formatting of many files (currently 43), and reviewing them is very difficult. --- .prettierrc.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.prettierrc.json b/.prettierrc.json index 168b240a..840af7bd 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,7 +1,6 @@ { "tabWidth": 2, "trailingComma": "es5", - "parser": "typescript", "printWidth": 100, "singleQuote": true, "arrowParens": "avoid"