From 9d61e0b6edc488704268094821d582f8285092b1 Mon Sep 17 00:00:00 2001 From: adnanfajlur Date: Fri, 27 Sep 2024 21:21:13 +0700 Subject: [PATCH] setup dprint formatter --- .vscode/settings.json | 30 ++++++++++ app/routes/_index.tsx | 24 ++++---- dprint.json | 30 ++++++++++ package-lock.json | 125 ++++++++++++++++++++++++++++++++++++++++++ package.json | 3 +- 5 files changed, 199 insertions(+), 13 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 dprint.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b064d6f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + "files.eol": "\n", + "typescript.tsdk": "node_modules/typescript/lib", + + "files.associations": { + ".env.*": "dotenv", + "*.module.css": "scss" + }, + + "unocss.colorPreview": false, + "unocss.remToPxPreview": true, + "unocss.autocomplete.matchType": "fuzzy", + "unocss.autocomplete.maxItems": 200, + + "editor.defaultFormatter": "dprint.dprint", + "editor.formatOnSave": true, + + "javascript.preferences.importModuleSpecifier": "shortest", + "typescript.preferences.importModuleSpecifier": "shortest", + + "[prisma]": { "editor.defaultFormatter": "Prisma.prisma" }, + + "[typescript]": { "editor.defaultFormatter": "dprint.dprint" }, + "[typescriptreact]": { "editor.defaultFormatter": "dprint.dprint" }, + "[javascript]": { "editor.defaultFormatter": "dprint.dprint" }, + "[javascriptreact]": { "editor.defaultFormatter": "dprint.dprint" }, + + "[json]": { "editor.defaultFormatter": "dprint.dprint" }, + "[jsonc]": { "editor.defaultFormatter": "dprint.dprint" } +} diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 172d7b9..78dd4b1 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,16 +1,16 @@ -import type { MetaFunction } from "@remix-run/node"; +import type { MetaFunction } from '@remix-run/node' export const meta: MetaFunction = () => { - return [ - { title: "Remix workshop" }, - { name: "description", content: "Welcome to Remix workshop!" }, - ]; -}; + return [ + { title: 'Remix workshop' }, + { name: 'description', content: 'Welcome to Remix workshop!' }, + ] +} export default function Index() { - return ( -
-

Hello world

-
- ); -} \ No newline at end of file + return ( +
+

Hello world

+
+ ) +} diff --git a/dprint.json b/dprint.json new file mode 100644 index 0000000..ceb6833 --- /dev/null +++ b/dprint.json @@ -0,0 +1,30 @@ +{ + "incremental": true, + "indentWidth": 2, + "useTabs": true, + "lineWidth": 180, + "typescript": { + "useTabs": true, + "quoteStyle": "preferSingle", + "quoteProps": "asNeeded", + "trailingCommas": "onlyMultiLine", + "semiColons": "asi", + "preferHanging": true, + "arrowFunction.useParentheses": "force", + "importDeclaration.preferSingleLine": true, + "importDeclaration.forceSingleLine": true, + "typeLiteral.separatorKind": "semiColon", + "jsx.quoteStyle": "preferDouble", + "memberExpression.preferSingleLine": false + }, + "json": {}, + "excludes": [ + "**/node_modules", + "**/*-lock.json", + "dist" + ], + "plugins": [ + "https://plugins.dprint.dev/typescript-0.93.0.wasm", + "https://plugins.dprint.dev/json-0.19.3.wasm" + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 897a023..33a022d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "@typescript-eslint/eslint-plugin": "^6.7.4", "@typescript-eslint/parser": "^6.7.4", "autoprefixer": "^10.4.19", + "dprint": "^0.47.2", "eslint": "^8.38.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", @@ -623,6 +624,110 @@ "node": ">=6.9.0" } }, + "node_modules/@dprint/darwin-arm64": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.47.2.tgz", + "integrity": "sha512-mVPFBJsXxGDKHHCAY8wbqOyS4028g1bN15H9tivCnPAjwaZhkUimZHXWejXADjhGn+Xm2SlakugY9PY/68pH3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@dprint/darwin-x64": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.47.2.tgz", + "integrity": "sha512-T7wzlc+rBV+6BRRiBjoqoy5Hj4TR2Nv2p2s9+ycyPGs10Kj/JXOWD8dnEHeBgUr2r4qe/ZdcxmsFQ5Hf2n0WuA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@dprint/linux-arm64-glibc": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.47.2.tgz", + "integrity": "sha512-B0m1vT5LdVtrNOVdkqpLPrSxuCD+l5bTIgRzPaDoIB1ChWQkler9IlX8C+RStpujjPj6SYvwo5vTzjQSvRdQkA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-arm64-musl": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.47.2.tgz", + "integrity": "sha512-zID6wZZqpg2/Q2Us+ERQkbhLwlW3p3xaeEr00MPf49bpydmEjMiPuSjWPkNv+slQSIyIsVovOxF4lbNZjsdtvw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-x64-glibc": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.47.2.tgz", + "integrity": "sha512-rB3WXMdINnRd33DItIp7mObS7dzHW90ZzeJSsoKJLPp+Z7wXjjb27UUowfqVI4baa/1pd7sdbX54DPohMtfu/A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/linux-x64-musl": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.47.2.tgz", + "integrity": "sha512-E0+TNbzYdTXJ/jCVjUctVxkda/faw++aDQLfyWGcmdMJnbM7NZz+W4fUpDXzMPsjy+zTWxXcPK7/q2DZz2gnbg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@dprint/win32-arm64": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/win32-arm64/-/win32-arm64-0.47.2.tgz", + "integrity": "sha512-K1EieTCFjfOCmyIhw9zFSduE6qVCNHEveupqZEfbSkVGw5T9MJQ1I9+n7MDb3RIDYEUk0enJ58/w82q8oDKCyA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@dprint/win32-x64": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.47.2.tgz", + "integrity": "sha512-LhizWr8VrhHvq4ump8HwOERyFmdLiE8C6A42QSntGXzKdaa2nEOq20x/o56ZIiDcesiV+1TmosMKimPcOZHa+Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@emotion/hash": { "version": "0.9.2", "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.9.2.tgz", @@ -4457,6 +4562,26 @@ "url": "https://dotenvx.com" } }, + "node_modules/dprint": { + "version": "0.47.2", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.47.2.tgz", + "integrity": "sha512-geUcVIIrmLaY+YtuOl4gD7J/QCjsXZa5gUqre9sO6cgH0X/Fa9heBN3l/AWVII6rKPw45ATuCSDWz1pyO+HkPQ==", + "dev": true, + "hasInstallScript": true, + "bin": { + "dprint": "bin.js" + }, + "optionalDependencies": { + "@dprint/darwin-arm64": "0.47.2", + "@dprint/darwin-x64": "0.47.2", + "@dprint/linux-arm64-glibc": "0.47.2", + "@dprint/linux-arm64-musl": "0.47.2", + "@dprint/linux-x64-glibc": "0.47.2", + "@dprint/linux-x64-musl": "0.47.2", + "@dprint/win32-arm64": "0.47.2", + "@dprint/win32-x64": "0.47.2" + } + }, "node_modules/duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", diff --git a/package.json b/package.json index 657fdfd..7c5fe39 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@typescript-eslint/eslint-plugin": "^6.7.4", "@typescript-eslint/parser": "^6.7.4", "autoprefixer": "^10.4.19", + "dprint": "^0.47.2", "eslint": "^8.38.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.28.1", @@ -40,4 +41,4 @@ "engines": { "node": ">=20.0.0" } -} \ No newline at end of file +}