question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.prettierrc in project is not detected

See original GitHub issue

I am on prettier 1.18.2, and plugin 1.27.14 on mac os. I have a simple vue repo:

» ll -lah
total 896
drwxr-xr-x   13 ben  staff   416B Oct 14 18:31 .
drwxr-xr-x   32 ben  staff   1.0K Oct 14 17:52 ..
drwxr-xr-x   13 ben  staff   416B Oct 14 18:42 .git
-rw-r--r--    1 ben  staff   214B Oct 14 17:52 .gitignore
-rw-r--r--    1 ben  staff    30B Oct 14 18:02 .prettierignore
-rw-r--r--@   1 ben  staff    48B Oct 14 18:42 .prettierrc
-rw-r--r--    1 ben  staff   322B Oct 14 18:20 README.md
-rw-r--r--    1 ben  staff    53B Oct 14 17:52 babel.config.js
drwxr-xr-x  821 ben  staff    26K Oct 14 17:55 node_modules
-rw-r--r--    1 ben  staff   424K Oct 14 17:52 package-lock.json
-rw-r--r--    1 ben  staff   906B Oct 14 17:52 package.json
drwxr-xr-x    4 ben  staff   128B Oct 14 17:52 public
drwxr-xr-x    6 ben  staff   192B Oct 14 17:52 src

Here my plugin config:

{
	"auto_format_on_save": true,
	// "prettier_cli_path": "/usr/local/Cellar/node/10.4.1/bin/prettier",
  "allow_inline_formatting": true,
  "debug": true,
  "auto_format_on_save_requires_prettier_config": true
}

I am expecting that on save the plugin use the .prettierrc file in my home, that has this content:

{
  "printWidth": 2000,
  "singleQuote": false
}

but instead I get this command:

/usr/local/Cellar/node/10.4.1/bin/prettier --stdin --no-config --print-width 80 --tab-width 2 --single-quote false --trailing-comma none --bracket-spacing true --jsx-bracket-same-line false --parser vue --semi true --require-pragma false --prose-wrap preserve --arrow-parens avoid --html-whitespace-sensitivity css --quote-props as-needed --use-tabs false --stdin-filepath /Users/ben/pro/i4mui/src/components/HelloWorld.vue --loglevel debug --cursor-offset 1733

Why it is not detecting my .prettierrc file?

If l manually run this:

» /usr/local/Cellar/node/10.4.1/bin/prettier --find-config-path src/components/HelloWorld.vue
.prettierrc

it works correctly.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
indiganecommented, Nov 14, 2019

I’m having the same issue. In my case it seems to have been caused by the config file resolver cache, which won’t look for the config file again, if it wasn’t found at the first format.

So if you added the config file during development, it won’t be detected.

As a workaround, I added an empty --config arg to SublimeJsPrettier settings:

  "additional_cli_args": {
    "--config": "",
  }
0reactions
lock[bot]commented, Dec 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

prettierrc config not recognized · Issue #325 - GitHub
I'm trying to use prettier-atom with a project that already has a .prettierrc file. However it doesn't seem to be picking up any...
Read more >
Pretier extension not working despite setting as default formatter
Navigate to the root of your project · Right click on the .prettierrc file · Select 'Copy Path' · Press Cmd , (Mac)...
Read more >
Configuration File - Prettier
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a...
Read more >
How to configure Prettier and VSCode - Gleb Bahmutov
This blog post shows how to configure Prettier to work from command line, from VSCode and from Git hooks.
Read more >
detected local configuration (i.e. .prettierrc or .editorconfig), vs ...
Settings mentioned in .prettierrc not working. Asked May 29, 2020 • 1 votes 0 answer ... I am using Eslint and prettier for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found