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

Overrides do not work in default config. #553

Open
TSoli opened this issue Jun 27, 2023 · 5 comments
Open

Overrides do not work in default config. #553

TSoli opened this issue Jun 27, 2023 · 5 comments

Comments

@TSoli
Copy link

TSoli commented Jun 27, 2023

I am using prettierd with null-ls in neovim. Basically, I can see that the default config is working because changing it is causing changes in the formatting when I apply it with :lua vim.lsp.buf.format() after reloading prettierd. However, adding overrides to this default config does not work. Overrides do seem to work if I make a .pretterrc file in the project directory though which is how I think this is different from #200 ?

To reproduce do something like this for the default prettierrc.json

{
  "printWidth": 80,
  "proseWrap": "always",
  "overrides": [
    {
      "files": "**/*.md",
      "options": {
        "printWidth": 100
      }
    }
  ]
}

And to test, also try putting the same file in the cwd of the markdown file in question.

I also tried playing around with the semi option for js files and similar results so it seems to be an issue with overrides in default config.

@trey-m
Copy link

trey-m commented Jul 9, 2023

I can confirm this is happening.

What works for me:

  • Creating a local project configuration file ✔️
  • The default prettierd configuration file if no local project file exists ✔️

What does not work for me:

  • Setting PRETTIERD_DEFAULT_CONFIG environment variable to the path of the prettier config as a source of truth for default

@TSoli
Copy link
Author

TSoli commented Jul 9, 2023

I can confirm this is happening.

What works for me:

  • Creating a local project configuration file ✔️
  • The default prettierd configuration file if no local project file exists ✔️

What does not work for me:

  • Setting PRETTIERD_DEFAULT_CONFIG environment variable to the path of the prettier config as a source of truth for default

What is the difference between the second point in what works for you and the what is not working for you? I.e isn't the default config pointed to by the environment variable? For me it's just this overrides in the default config pointed to by the environment variable that does not work.

@trey-m
Copy link

trey-m commented Jul 10, 2023

What is the difference between the second point in what works for you and the what is not working for you? I.e isn't the default config pointed to by the environment variable? For me it's just this overrides in the default config pointed to by the environment variable that does not work.

Not exactly. The env variable is only going to be used if it is set - otherwise it will use prettierd default configuration.

I am setting it and prettierd is not picking it up.

@alex35mil
Copy link

Same here. Overrides in the default config (PRETTIERD_DEFAULT_CONFIG) are ignored.

@willm
Copy link

willm commented Feb 12, 2024

I'm also having this problem

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

No branches or pull requests

4 participants