Prettier automatically removes my debugger statements (not very nice :P).
Here is a conversation with @kentcdodds https://twitter.com/jasonlaster11/status/890683399974920194

Atom version: 1.18.0
prettier-atom version: 0.37.0
prettier version: 1.5.3
prettier-eslint version: 6.4.2
prettier-atom configuration: {
"formatOnSave": true,
"formatOnSaveOptions": {
"enabled": true,
"excludedGlobs": [
"**/mochitest/**",
"**/assets/**"
],
"respectEslintignore": true,
"showInStatusBar": false,
"javascriptScopes": [
"source.js",
"source.jsx",
"source.js.jsx",
"source.babel",
"source.js-semantic",
"text.html.basic",
"text.html.vue"
],
"typescriptScopes": [
"source.ts",
"source.tsx",
"source.ts.tsx"
],
"cssScopes": [
"source.css",
"source.less",
"source.css.less",
"source.scss",
"source.css.scss"
],
"jsonScopes": [
"source.json"
],
"whitelistedGlobs": [],
"isDisabledIfNotInPackageJson": false
},
"prettierOptions": {
"singleQuote": false,
"bracketSpacing": true,
"semi": true,
"useTabs": false,
"jsxBracketSameLine": false,
"printWidth": 80,
"tabWidth": "auto",
"trailingComma": "none",
"parser": "babylon"
},
"silenceErrors": true,
"useEslint": true,
"useEditorConfig": true,
"prettierEslintOptions": {
"prettierLast": false
}
}
So here's a proposal. I think that this would actually be a change in prettier-eslint rather than prettier-atom... We could add a property in the settings of your eslint config to do this. For example:
{
"extends": "airbnb",
"settings": {
"prettier-eslint": {
"rules": { "semi": [2, "never"] }
}
},
}
The prettier-eslint property would effectively be an eslint config that would override the rest of your config. I'm not sure how easy that would be (like supporting extends and stuff like that). But at _least_ having rules configured there would be really handy.
Thoughts?
That would be one way to solve it. The disadvantage is now you can't use prettier-eslint to auto-fix this in the cases where you actually _do_ want it to fix that. In other words, it seems when you're using prettier-atom, you probably don't want to remove the debugger, but if you're using prettier-eslint in some sort of validate script, you probably do.
In order to get both, you could allow passing an option for prettier-eslint that lets you override eslint rules at the time of invocation? That way you could have debuggers disabled in your eslint config, but prettier-atom could call prettier-eslint and override that rule as we assume it's okay for development? Then when you run prettier-eslint as part of a validate script or whatever, it still removes it for you.
That seems fine to me :+1:
Anyone wanna work on that? I guess I should file this on the prettier-eslint repo.... 馃 But don't let that stop anyone from starting a PR :wink:
I'm going to move this over here: https://github.com/prettier/prettier-eslint/issues/118
Hi, big fan of prettier, I'm promoting it in my team, but one dev stop using it due to this behavior.
One solution is to disable atom-prettier on save and set a shortcut to run it manually but you know dev don't like to do stuff manually.
Btw. how does prettier/prettier-eslint#118 solves this as it's still open and doesn't mention the debugger statement issue.
Cheer
I suggest disabling prettier-eslint integration and just using prettier. That's what I've done. At this point I'm only minimally maintaining prettier-eslint. If you want to make
https://github.com/prettier/prettier-eslint/issues/118 a reality, be my guest.
Thanks for the clarification.
Most helpful comment
That would be one way to solve it. The disadvantage is now you can't use prettier-eslint to auto-fix this in the cases where you actually _do_ want it to fix that. In other words, it seems when you're using prettier-atom, you probably don't want to remove the debugger, but if you're using prettier-eslint in some sort of validate script, you probably do.
In order to get both, you could allow passing an option for prettier-eslint that lets you override eslint rules at the time of invocation? That way you could have debuggers disabled in your eslint config, but prettier-atom could call prettier-eslint and override that rule as we assume it's okay for development? Then when you run prettier-eslint as part of a
validatescript or whatever, it still removes it for you.