I'm trying to use prettier-atom with a project that already has a .prettierrc file. However it doesn't seem to be picking up any of the settings in that file, and in addition it doesn't run on save if I have the "Only format if a Prettier config is found" setting checked.
Here's the contents of my .prettierrc file:
{
"printWidth": 80,
"singleQuote": true,
"bracketSpacing": false
}
Atom version: 1.23.1
prettier-atom version: 0.43.1
prettier version: 1.9.2
prettier-eslint version: 8.2.6
prettier-atom configuration: {
"formatOnSaveOptions": {
"enabled": true,
"isDisabledIfNoConfigFile": true,
"showInStatusBar": true,
"respectEslintignore": true,
"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",
"source.css.postcss"
],
"jsonScopes": [
"source.json"
],
"graphQlScopes": [
"source.graphql"
],
"markdownScopes": [
"source.md",
"source.gfm",
"text.md"
],
"excludedGlobs": [],
"whitelistedGlobs": [],
"isDisabledIfNotInPackageJson": false
},
"prettierEslintOptions": {
"prettierLast": false
},
"useEditorConfig": false,
"useEslint": false,
"useStylelint": false,
"prettierOptions": {
"singleQuote": false,
"bracketSpacing": true,
"semi": true,
"useTabs": false,
"jsxBracketSameLine": false,
"printWidth": 80,
"tabWidth": "auto",
"trailingComma": "none",
"parser": "babylon"
}
}
@mgrip We currently have an issue with prettier-atom not picking up changes to your .prettierrc (see https://github.com/prettier/prettier-atom/issues/270), can you restart atom and make sure this isn't what's going?
Ive tried restarting a couple times, still the same problem. Also its not running on save (when I have the "only format if a prettier config is found" setting checked), which seems like its not recognizing the config at all, not just changes to it.
@mgrip Can you use prettier directly from the command line and see if the same thing happens? Any errors in your atom console?
I actually just tried with another project and it worked fine (settings were picked up from rc file, they override the atom package settings, it runs on save). I don't have access to the original project I was having problems with at the moment but it must be a config issue. I'll report back if I find anything else - thanks!
Confirming that it seems to have to do with plugin startup. Restarting the editor is the only way I can get prettier-atom to pickup the presence-or-absence-of .prettierrc.
Most helpful comment
Confirming that it seems to have to do with plugin startup. Restarting the editor is the only way I can get
prettier-atomto pickup the presence-or-absence-of.prettierrc.