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.

Not compatible with root level `.prettierrc.js`

See original GitHub issue
$ cat app/models/user.rb

# A User is neat
class User < ApplicationRecord
end

$ ./node_modules/.bin/prettier --write app/models/user.rb
app/models/user.rb
[error] app/models/user.rb: SyntaxError: Unexpected token # (1:1)
[error] > 1 | # A User is neat
[error]     | ^
[error]   2 | class User < ApplicationRecord
[error]   3 | end
[error]   4 |

$ ./node_modules/.bin/prettier --version
1.16.4

$ ruby --version
ruby 2.5.1p57

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kddnewtoncommented, Aug 5, 2019

This should be fixed on master. If this becomes a problem again feel free to reopen.

0reactions
JoshuaKGoldbergcommented, May 15, 2019

are you using the gem or the npm package?

npm package.

how are you invoking prettier?

This is in the scripts in a package.json, invoked via yarn:

prettier spec/**/*.rb

what version of ruby, node, prettier, and the ruby plugin are you using?

  • Ruby: 2.5.5p157 (2019-03-15 revision 67260) [x86_64-darwin18]
  • Node: 8.10.0
  • prettier package: 1.16.4
  • @prettier/plugin-ruby package: 0.12.2

what OS are you running?

macOS Mojave 10.14.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration File - Prettier
A .prettierrc.js , .prettierrc.cjs , prettier.config.js ... for .editorconfig files in the parent directories # root = true [*] # Non-configurable Prettier ...
Read more >
How to configure Prettier and VSCode - Gleb Bahmutov
You can configure JavaScript code auto-formatting with Prettier to work per-project. This allows you to get a consistent formatting without ...
Read more >
Why does Prettier not format code in VS Code? - Stack Overflow
Make sure your Editor: Default Formatter field is not null but rather ... already had .eslintrc.js and .prettierrc files But nothing worked.
Read more >
How to Format All Files in a Directory with Prettier
Level Up Coding ... If you'd rather not install Prettier globally, ... put a .prettierrc file in the root folder of your project, ......
Read more >
Setting up Prettier and ESlint for JS and React Apps - Medium
2- Will help everyone to learn and level up, as every linting rule is ... 3- Handling legacy code that doesn't follow linting...
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