plugin-ruby icon indicating copy to clipboard operation
plugin-ruby copied to clipboard

TypeError: contents.some is not a function

Open gin0606 opened this issue 7 years ago • 1 comments

Metadata

  • Ruby version: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin17]
  • @prettier/plugin-ruby version: 0.12.0

[].each do |e|
  # comment
  p(//, e)
end

When I try to format file like ↑this, I get the following error. I found this issue in this file https://github.com/rails/rails/blob/92c464373abe7c486e189b21a6376aca01173b06/actionpack/test/dispatch/debug_exceptions_test.rb

[error] actionpack/test/dispatch/debug_exceptions_test.rb: TypeError: contents.some is not a function
[error]     at Object.regexp_literal (/app/node_modules/@prettier/plugin-ruby/src/nodes/regexp.js:8:32)
[error]     at Object.module.exports [as print] (/app/node_modules/@prettier/plugin-ruby/src/print.js:8:32)
[error]     at callPluginPrintFunction (/app/node_modules/prettier/bin-prettier.js:13576:18)
[error]     at /app/node_modules/prettier/bin-prettier.js:13527:16
[error]     at Object.printComments (/app/node_modules/prettier/bin-prettier.js:13250:17)
[error]     at printGenerically (/app/node_modules/prettier/bin-prettier.js:13526:22)
[error]     at FastPath.map (/app/node_modules/prettier/bin-prettier.js:13430:21)
[error]     at Object.makeList (/app/node_modules/@prettier/plugin-ruby/src/utils.js:33:46)
[error]     at Object.module.exports [as print] (/app/node_modules/@prettier/plugin-ruby/src/print.js:8:32)
[error]     at callPluginPrintFunction (/app/node_modules/prettier/bin-prettier.js:13576:18)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

gin0606 avatar Apr 19 '19 19:04 gin0606

While I don't like the formatting on master, this issue is fixed. The formatting will be fixed in a larger comment refactor

kddnewton avatar Jul 05 '19 15:07 kddnewton