Skip to content

Commit

Permalink
fix: skip sorting non package.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
remcohaszing committed Jul 9, 2019
1 parent af01d0b commit 0207df2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('path')
const { parsers } = require('prettier/parser-babylon')
const sortPackageJson = require('sort-package-json')
const parser = parsers['json-stringify']
Expand All @@ -9,7 +10,10 @@ exports.parsers = {
if (parser.preprocess) {
text = parser.preprocess(text, options)
}
return sortPackageJson(text)
if (options.filepath && path.basename(options.filepath) === 'package.json') {
return sortPackageJson(text)
}
return text
},
},
}

0 comments on commit 0207df2

Please sign in to comment.