I updated my prettier atom plugin yesterday and since then I have been getting this message on save(Ctrl+s).
prettier-atom failed: text.trimEnd is not a function
I'm having this issue aswell.
I just released a new version that updates to the latest version of prettier (which had a bug in previous versions). That bug may or may not be related to what you're seeing. Can you try updating to the latest version of prettier-atom and see if it resolves your issue?
I'm facing this issue too. At first I updated to 0.60.0 and it just wouldn't work, now I went back to 0.54.0 and am facing it on certain projects too.

I updated to 0.60.0 today, I am still facing the issue. I have disabled the plugin for time being because it's a little irritating to see this after each ctrl+s, which I do a lot.
Disabled it too, completely obstructs workflow right now.
I'm on 0.60.0 as well, this issue is present.
What version of prettier are you guys using locally in your projects? They broke compatibility with the node version that Atom uses for a couple of versions. You might need to completely restart Atom after updating to resolve (I had to do this personally myself).
@robwise I'm using prettier-atom v0.60.0, and my project has a devDependency of prettier v2.0.5. After reinstalling packages and restarting Atom, I still see the text.trimEnd error described above when I save.
My .prettierrc is as follows, not sure if this is relevant.
{
"tabWidth": 2,
"semi": true,
"printWidth": 100,
"parser": "babel",
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"arrowParens": "always"
}
Can you print out a prettier debug from inside of atom?
Can you print out a prettier debug from inside of atom?
How do I do that?
Normally you would do prettier: debug in your command pallete but now it seems that's bugged.
Any update on this? I am also blocked by this issue.
I just released a new version of prettier-atom (0.60.1) that fixes the debug issue.
I upgraded to 0.60.1 but am still seeing prettier-atom failed: text.trimEnd is not a function every time I save
FWIW, I did start having this problem after upgrading to prettier 2.0.5. Maybe that has something to do with it?
@megelismi Can you try the prettier:debug command and paste the result here?
When you say prettier:debug are you referring to this? https://prettier.io/docs/en/cli.html#--debug-check
Nothing but the file outputs when I run the --debug-check command.
Err sorry, like inside your Atom command palette (usually opened by like cmd + shift + p on Mac)
cmd + shift + p
Atom version: 1.30.0
prettier-atom version: 0.60.1
prettier: bundled
prettier version: 2.0.5
prettier-eslint version: 9.0.1
prettier-atom configuration: {
"formatOnSaveOptions": {
"enabled": true,
"respectEslintignore": true,
"showInStatusBar": false,
"excludedGlobs": [],
"whitelistedGlobs": [],
"isDisabledIfNotInPackageJson": false,
"isDisabledIfNoConfigFile": false,
"ignoreNodeModules": true
},
"useEslint": false,
"useStylelint": false,
"useEditorConfig": true,
"prettierEslintOptions": {
"prettierLast": false
}
}
I had the same issue after updating prettier from version 1.19.1 to version 2.0.5.
Reverting to prettier 1.19.1 solved the issue for me.
I am using prettier-atom version is 0.60.1
Hmm, very strange, we were definitely seeing this issue with those post 2.0 releases but it seems to have resolved for most with 2.0.5
I'm not sure what's going on here.
I had the same issue. I think this issue is caused by Atom using a lower version of Node. (It's different from the Node installed on your system)
For example, my Atom version is 1.28.0, and the node version inside the Atom is 8.9.3. (Atom > About > Show more)
Prettier dropped support for node 8.x from v2.0.0, and string.trimEnd is introduced from Node.js v10.0.0.
So the solution is to upgrade Atom.
Now, my Atom version is 1.48.0, and the node version inside the Atom is 12.0.0.
@dailyrandomphoto That was exactly the issue for me. After upgrading Atom (auto update was broken for some reason), then upgrading prettier - all works fine. Many thanks.
Wow I should have paid more attention to the debug output, great catch @dailyrandomphoto
Most helpful comment
I had the same issue. I think this issue is caused by Atom using a lower version of Node. (It's different from the Node installed on your system)
For example, my Atom version is 1.28.0, and the node version inside the Atom is 8.9.3. (Atom > About > Show more)
Prettierdropped support for node 8.x from v2.0.0, andstring.trimEndis introduced from Node.js v10.0.0.So the solution is to upgrade Atom.
Now, my Atom version is 1.48.0, and the node version inside the Atom is 12.0.0.