Skip to content

Commit

Permalink
feat: add vscode config for prettier (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yordan-Ramchev authored Feb 18, 2024
1 parent fdadea4 commit e6321cf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ async function init() {
})
}

if (needsPrettier) {
render('config/prettier')
}
// Render code template.
// prettier-ignore
const codeTemplate =
Expand Down
3 changes: 3 additions & 0 deletions template/config/prettier/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode"]
}
4 changes: 4 additions & 0 deletions template/config/prettier/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
3 changes: 0 additions & 3 deletions utils/renderEslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,5 @@ export default function renderEslint(
const extensionsJsonPath = path.resolve(rootDir, '.vscode/extensions.json')
const existingExtensions = JSON.parse(fs.readFileSync(extensionsJsonPath, 'utf8'))
existingExtensions.recommendations.push('dbaeumer.vscode-eslint')
if (needsPrettier) {
existingExtensions.recommendations.push('esbenp.prettier-vscode')
}
fs.writeFileSync(extensionsJsonPath, JSON.stringify(existingExtensions, null, 2) + '\n', 'utf-8')
}

0 comments on commit e6321cf

Please sign in to comment.