Skip to content

Commit

Permalink
refactor: put the default prettierrc into a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Feb 21, 2023
1 parent 5647b57 commit a0a7457
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,7 @@ export default function createConfig ({
}
if (needsPrettier) {
// Prettier recommends an explicit configuration file to let the editor know that it's used.
files['.prettierrc.json'] = prettierrcs[styleGuide] || `{
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}`
files['.prettierrc.json'] = prettierrcs[styleGuide]
}

return {
Expand Down
8 changes: 8 additions & 0 deletions templates/prettierrc-default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"trailingComma": "none"
}
1 change: 1 addition & 0 deletions templates/prettierrcs.cjs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
exports.airbnb = require('./prettierrc-airbnb.json')
exports.default = require('./prettierrc-default.json')
exports.standard = require('./prettierrc-standard.json')

0 comments on commit a0a7457

Please sign in to comment.