lsp-format-buffer can't decide between 4 or 2 spaces for indentation in typescript-tsx-mode
- Dominant language
- Emacs Lisp
- Stars
- 22.7k
- Forks
- 3.1k
- Avg merge
- 10h 46m
- Merged PRs (30d)
- 4
Description
### I confirm that...
- [X] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.
- [X] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.
- [X] The issue can be reproduced on the **latest** available commit of Doom.
- [X] The issue can be reproduced on a stable release of Emacs, such as 27 or 28. *(Doom does not support development builds like 29+ or any version ending in .50 or .9x)*
### Expected behavior
`lsp-format-buffer` should keep the current existing indentation length (NextJS projects have it at 2 spaces)
### Current behavior
`lsp-format-buffer` switches between 2 and 4 spaces between invocations, see video: https://user-images.githubusercontent.com/1055216/224145296-c3bc9e67-03d3-477a-af85-6c723eaa5329.mp4
you need to change `.eslintrc` to have an explicit rule for the level of indentation; otherwise it is not respected, but this also helps reproduce the bug.
### Steps to reproduce
1. Create a NextJS project with `npx create-next-app@latest my-test-project`, select all the defaults.
2. visit `.eslintrc` and the following: `"rules": { "indent": ["error", 2] }`
3. make sure `ts-ls` and `eslint` are installed
4. visit `pages/index.tsx`, make a small change and save, or directly run `lsp-format-buffer`.
### System Information
https://pastebin.com/VksLNrpb
Contributor guide
Assessment
This issue has not been assessed yet.