prettier / plugin-ruby

Prettier Ruby Plugin
MIT License
1.47k stars 97 forks source link

No parser could be inferred for file xyz.rb #1369

Closed langalex closed 1 year ago

langalex commented 1 year ago

Since upgrading to version 4.0.2, the Ruby plugin appears to not get picked up by Prettier anymore.

$ yarn prettier -w xyz.rb 

yarn run v1.22.19
$ /Users/alexanderlang/Projects/cobot/node_modules/.bin/prettier -w xyz.rb
[error] No parser could be inferred for file "/Users/alexanderlang/Projects/xyz.rb".
error Command failed with exit code 2.

package.json:

  "devDependencies": {
    "@prettier/plugin-ruby": "^4.0.2",
    "eslint": "^8.45.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-prettier": "^5.0.0",
    "prettier": "^3.0.0",
  },

Gemfile:

  gem 'prettier_print' 
  gem 'syntax_tree'
  gem 'syntax_tree-haml' 
  gem 'syntax_tree-rbs'
kddnewton commented 1 year ago

With prettier v3, you need to specify the plugins manually as the autoload has been removed. See the CHANGELOG https://prettier.io/blog/2023/07/05/3.0.0.html#plugin-search-feature-has-been-removed-14759httpsgithubcomprettierprettierpull14759-by-fiskerhttpsgithubcomfisker.

This means either creating a config file or passing on the command line like --plugin=@prettier/plugin-ruby.

langalex commented 1 year ago

Apologies, I only checked the changelog in this repo.