Skip to content

Commit

Permalink
Add Prettier plugins to format SQL in JS / TS (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed Oct 30, 2023
1 parent cd5fca7 commit 94c225a
Show file tree
Hide file tree
Showing 4 changed files with 303 additions and 10 deletions.
22 changes: 14 additions & 8 deletions bin/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,20 @@ const newDevDependenciesToInstall = [
'typescript',
];

if (
// Install SafeQL dependencies in Postgres.js projects
projectType === 'next-js-postgresql' &&
// SafeQL currently not supported on Windows
// https://github.com/ts-safeql/safeql/issues/80
process.platform !== 'win32'
) {
newDevDependenciesToInstall.push('@ts-safeql/eslint-plugin', 'libpg-query');
// Install Prettier and SafeQL dependencies in Postgres.js projects
if (projectType === 'next-js-postgresql') {
newDevDependenciesToInstall.push(
'prettier-plugin-embed',
'prettier-plugin-sql',
);

if (
// SafeQL currently not supported on Windows
// https://github.com/ts-safeql/safeql/issues/80
process.platform !== 'win32'
) {
newDevDependenciesToInstall.push('@ts-safeql/eslint-plugin', 'libpg-query');
}
}

if (
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"@types/prettier": "2.7.3",
"@typescript-eslint/utils": "6.9.0",
"eslint-config-upleveled": "5.1.3",
"prettier-plugin-embed": "0.2.5",
"prettier-plugin-sql": "0.15.1",
"stylelint": "15.11.0",
"typescript": "5.2.2"
},
Expand Down

0 comments on commit 94c225a

Please sign in to comment.