Open ghost opened 3 years ago
This will not conflict with prettier-plugin-package
because it doesn't get applied to package.json
. Prettier recognizes package.json
as its own format, so it doesn't get included by JSON parsers such as this plugin.
Still a good suggestion though! We should update the README to clarify how this works with prettier-plugin-package
, and I can still see an ignore configuration being useful sometimes.
The README was updated in #96 to explain that package.json
files are not sorted.
I came across this, as I wanted a way to only sort my locale files. Would it be possible to add a glob matcher?
@JoshWhite were you able to find a way around this?
Should this be closed because prettier supports an override format in their configuration, which can be used by any plugin?
{
"semi": false,
"overrides": [
{
"plugins": ["prettier-plugin-OTHER"],
"files": "*.test.js",
"excludeFiles": ["my.test.js"],
},
{
"plugins": ["prettier-plugin-sort-json"],
"files": ["my.test.js"],
}
]
}
^ Amazing! I'll leave this issue open until adding a brief note to the README about this, but that looks like the perfect solution to me.
I had a similar issue with tsconfig.json
files that I didn't want sorted. I used the below which worked well:
plugins:
- prettier-plugin-organize-imports
singleQuote: true
trailingComma: es5
overrides:
- options:
plugins:
- prettier-plugin-sort-json
jsonRecursiveSort: true
files: '*.json'
excludeFiles:
- '**/tsconfig.json'
Should this be closed because prettier supports an override format in their configuration, which can be used by any plugin?
{ "semi": false, "overrides": [ { "plugins": ["prettier-plugin-OTHER"], "files": "*.test.js", "excludeFiles": ["my.test.js"], }, { "plugins": ["prettier-plugin-sort-json"], "files": ["my.test.js"], } ] }
this doesn't work
I'm already using prettier-plugin-package to sort my
package.json
file, but its custom sort would conflict with this plugin. Would it be possible to add an option to the.prettierrc
configuration to ignore certain files?