From d75dd94195b3af81c5a4ce741f5f6b13de97b3cf Mon Sep 17 00:00:00 2001 From: MatsDK <67562518+MatsDK@users.noreply.github.com> Date: Sun, 28 May 2023 16:58:05 +0200 Subject: [PATCH] formatting --- .eslintrc.js | 78 +++++++++++++-------------- .vscode/extension.json | 8 +-- .vscode/settings.json | 16 +++--- dprint.json | 54 +++++++++---------- example/.vscode/extensions.json | 10 ++-- example/package.json | 52 +++++++++--------- example/src-tauri/tauri.conf.json | 80 ++++++++++++++-------------- example/src/main.ts | 2 +- example/tsconfig.json | 52 +++++++++--------- example/tsconfig.node.json | 16 +++--- example/vite.config.ts | 56 ++++++++++---------- package.json | 88 +++++++++++++++---------------- src/index.ts | 2 +- tsconfig.json | 28 +++++----- 14 files changed, 270 insertions(+), 272 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 06cffd7..9b0286d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,44 +1,44 @@ /** @type {import("eslint").Linter.Config} */ const config = { - parser: '@typescript-eslint/parser', - env: { - node: true, - browser: true, - }, - extends: [ - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', - 'eslint:recommended', - // 'plugin:dprint/recommended', - ], - parserOptions: { - ecmaVersion: 'latest', - tsconfigRootDir: __dirname, - project: [ - './tsconfig.json', - './example/tsconfig.json', - ], - }, - rules: { - // 'dprint/dprint': [ - // 'error', - // { - // config: {}, - // }, - // ], - '@typescript-eslint/no-unused-vars': [ - 'error', - { - argsIgnorePattern: '^_', - varsIgnorePattern: '^_', - caughtErrorsIgnorePattern: '^_', - }, - ], - }, - plugins: [ - '@typescript-eslint', - ], - ignorePatterns: ['node_modules', 'dist', 'taurpc', 'target', 'test'], + parser: '@typescript-eslint/parser', + env: { + node: true, + browser: true, + }, + extends: [ + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'eslint:recommended', + // 'plugin:dprint/recommended', + ], + parserOptions: { + ecmaVersion: 'latest', + tsconfigRootDir: __dirname, + project: [ + './tsconfig.json', + './example/tsconfig.json', + ], + }, + rules: { + // 'dprint/dprint': [ + // 'error', + // { + // config: {}, + // }, + // ], + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + }, + plugins: [ + '@typescript-eslint', + ], + ignorePatterns: ['node_modules', 'dist', 'taurpc', 'target', 'test'], } module.exports = config diff --git a/.vscode/extension.json b/.vscode/extension.json index fbbfc21..82a4fa3 100644 --- a/.vscode/extension.json +++ b/.vscode/extension.json @@ -1,6 +1,6 @@ { - "recommendations": [ - "dbaeumer.vscode-eslint", - "dprint.dprint" - ] + "recommendations": [ + "dbaeumer.vscode-eslint", + "dprint.dprint" + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 729cbaa..9ee978e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,10 +1,10 @@ { - "editor.defaultFormatter": "dprint.dprint", - "dprint.path": "node_modules/dprint/dprint", - "typescript.preferences.importModuleSpecifierEnding": "js", - "typescript.tsdk": "node_modules\\typescript\\lib", - "rust-analyzer.linkedProjects": [ - "taurpc/Cargo.toml", - "example/src-tauri/Cargo.toml" - ] + "editor.defaultFormatter": "dprint.dprint", + "dprint.path": "node_modules/dprint/dprint", + "typescript.preferences.importModuleSpecifierEnding": "js", + "typescript.tsdk": "node_modules\\typescript\\lib", + "rust-analyzer.linkedProjects": [ + "taurpc/Cargo.toml", + "example/src-tauri/Cargo.toml" + ] } diff --git a/dprint.json b/dprint.json index c21466b..1944ed6 100644 --- a/dprint.json +++ b/dprint.json @@ -1,30 +1,28 @@ { - "incremental": true, - "useTabs": true, - "indentWidth": 2, - "lineWidth": 100, - "typescript": { - "quoteStyle": "preferSingle", - "semiColons": "asi" - }, - "exec": { - "associations": "**/*.{rs}", - "rustfmt": "rustfmt --edition 2021", - "rustfmt.associations": "**/*.rs" - }, - "includes": [ - "**/*.{ts,tsx,js,jsx,cjs,mjs,json,json5,md,yaml,rs}" - ], - "excludes": [ - "**/node_modules", - "pnpm-lock.yaml", - "dist", - "**/target" - ], - "plugins": [ - "https://plugins.dprint.dev/typescript-0.78.0.wasm", - "https://plugins.dprint.dev/json-0.16.0.wasm", - "https://plugins.dprint.dev/markdown-0.14.1.wasm", - "https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab" - ] + "incremental": true, + "lineWidth": 100, + "typescript": { + "quoteStyle": "preferSingle", + "semiColons": "asi" + }, + "exec": { + "associations": "**/*.{rs}", + "rustfmt": "rustfmt --edition 2021", + "rustfmt.associations": "**/*.rs" + }, + "includes": [ + "**/*.{ts,tsx,js,jsx,cjs,mjs,json,json5,md,yaml,rs}" + ], + "excludes": [ + "**/node_modules", + "pnpm-lock.yaml", + "dist", + "**/target" + ], + "plugins": [ + "https://plugins.dprint.dev/typescript-0.78.0.wasm", + "https://plugins.dprint.dev/json-0.16.0.wasm", + "https://plugins.dprint.dev/markdown-0.14.1.wasm", + "https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab" + ] } diff --git a/example/.vscode/extensions.json b/example/.vscode/extensions.json index 648a8aa..61343e9 100644 --- a/example/.vscode/extensions.json +++ b/example/.vscode/extensions.json @@ -1,7 +1,7 @@ { - "recommendations": [ - "svelte.svelte-vscode", - "tauri-apps.tauri-vscode", - "rust-lang.rust-analyzer" - ] + "recommendations": [ + "svelte.svelte-vscode", + "tauri-apps.tauri-vscode", + "rust-lang.rust-analyzer" + ] } diff --git a/example/package.json b/example/package.json index e4af768..ccff630 100644 --- a/example/package.json +++ b/example/package.json @@ -1,28 +1,28 @@ { - "name": "taurpc-example", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview", - "check": "svelte-check --tsconfig ./tsconfig.json", - "tauri": "tauri" - }, - "dependencies": { - "@tauri-apps/api": "^1.3.0" - }, - "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^2.0.0", - "@tauri-apps/cli": "^1.3.1", - "@tsconfig/svelte": "^3.0.0", - "@types/node": "^18.7.10", - "svelte": "^3.54.0", - "svelte-check": "^3.0.0", - "svelte-preprocess": "^5.0.0", - "tslib": "^2.4.1", - "typescript": "^5.0.4", - "vite": "^4.2.1" - } + "name": "taurpc-example", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "check": "svelte-check --tsconfig ./tsconfig.json", + "tauri": "tauri" + }, + "dependencies": { + "@tauri-apps/api": "^1.3.0" + }, + "devDependencies": { + "@sveltejs/vite-plugin-svelte": "^2.0.0", + "@tauri-apps/cli": "^1.3.1", + "@tsconfig/svelte": "^3.0.0", + "@types/node": "^18.7.10", + "svelte": "^3.54.0", + "svelte-check": "^3.0.0", + "svelte-preprocess": "^5.0.0", + "tslib": "^2.4.1", + "typescript": "^5.0.4", + "vite": "^4.2.1" + } } diff --git a/example/src-tauri/tauri.conf.json b/example/src-tauri/tauri.conf.json index 5ceda52..1748626 100644 --- a/example/src-tauri/tauri.conf.json +++ b/example/src-tauri/tauri.conf.json @@ -1,42 +1,42 @@ { - "build": { - "beforeDevCommand": "pnpm dev", - "beforeBuildCommand": "pnpm build", - "devPath": "http://localhost:1420", - "distDir": "../dist", - "withGlobalTauri": false - }, - "package": { - "productName": "taurpc-example", - "version": "0.0.0" - }, - "tauri": { - "allowlist": { - "all": false, - "shell": { - "all": false, - "open": true - } - }, - "bundle": { - "active": true, - "targets": "all", - "identifier": "taurpc", - "icon": [ - "icons/icon.ico" - ] - }, - "security": { - "csp": null - }, - "windows": [ - { - "fullscreen": false, - "resizable": true, - "title": "taurpc-example", - "width": 800, - "height": 600 - } - ] - } + "build": { + "beforeDevCommand": "pnpm dev", + "beforeBuildCommand": "pnpm build", + "devPath": "http://localhost:1420", + "distDir": "../dist", + "withGlobalTauri": false + }, + "package": { + "productName": "taurpc-example", + "version": "0.0.0" + }, + "tauri": { + "allowlist": { + "all": false, + "shell": { + "all": false, + "open": true + } + }, + "bundle": { + "active": true, + "targets": "all", + "identifier": "taurpc", + "icon": [ + "icons/icon.ico" + ] + }, + "security": { + "csp": null + }, + "windows": [ + { + "fullscreen": false, + "resizable": true, + "title": "taurpc-example", + "width": 800, + "height": 600 + } + ] + } } diff --git a/example/src/main.ts b/example/src/main.ts index efab8e1..fb36356 100644 --- a/example/src/main.ts +++ b/example/src/main.ts @@ -1,7 +1,7 @@ import App from './App.svelte' const app = new App({ - target: document.getElementById('app'), + target: document.getElementById('app'), }) export default app diff --git a/example/tsconfig.json b/example/tsconfig.json index d16e247..1aeac98 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -1,33 +1,33 @@ { - "extends": "@tsconfig/svelte/tsconfig.json", - "compilerOptions": { - "ignoreDeprecations": "5.0", - "target": "ESNext", - "useDefineForClassFields": true, - "moduleResolution": "nodenext", - "module": "ESNext", - "resolveJsonModule": true, - "baseUrl": ".", - /** + "extends": "@tsconfig/svelte/tsconfig.json", + "compilerOptions": { + "ignoreDeprecations": "5.0", + "target": "ESNext", + "useDefineForClassFields": true, + "moduleResolution": "nodenext", + "module": "ESNext", + "resolveJsonModule": true, + "baseUrl": ".", + /** * Typecheck JS in `.svelte` and `.js` files by default. * Disable checkJs if you'd like to use dynamic types in JS. * Note that setting allowJs false does not prevent the use * of JS in `.svelte` files. */ - "allowJs": true, - "checkJs": true, - "isolatedModules": true - }, - "include": [ - "src/**/*.d.ts", - "src/**/*.ts", - "src/**/*.js", - "src/**/*.svelte", - "vite.config.ts" - ], - "references": [ - { - "path": "./tsconfig.node.json" - } - ] + "allowJs": true, + "checkJs": true, + "isolatedModules": true + }, + "include": [ + "src/**/*.d.ts", + "src/**/*.ts", + "src/**/*.js", + "src/**/*.svelte", + "vite.config.ts" + ], + "references": [ + { + "path": "./tsconfig.node.json" + } + ] } diff --git a/example/tsconfig.node.json b/example/tsconfig.node.json index 2c822ad..05764b1 100644 --- a/example/tsconfig.node.json +++ b/example/tsconfig.node.json @@ -1,10 +1,10 @@ { - "compilerOptions": { - "composite": true, - "module": "ESNext", - "moduleResolution": "Node" - }, - "include": [ - "vite.config.ts" - ] + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node" + }, + "include": [ + "vite.config.ts" + ] } diff --git a/example/vite.config.ts b/example/vite.config.ts index cf986cb..f6d2097 100644 --- a/example/vite.config.ts +++ b/example/vite.config.ts @@ -4,33 +4,33 @@ import { defineConfig } from 'vite' // https://vitejs.dev/config/ export default defineConfig(() => ({ - plugins: [ - svelte({ - preprocess: [ - sveltePreprocess({ - typescript: true, - }), - ], - }), - ], + plugins: [ + svelte({ + preprocess: [ + sveltePreprocess({ + typescript: true, + }), + ], + }), + ], - // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` - // prevent vite from obscuring rust errors - clearScreen: false, - // tauri expects a fixed port, fail if that port is not available - server: { - port: 1420, - strictPort: true, - }, - // to make use of `TAURI_DEBUG` and other env variables - // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand - envPrefix: ['VITE_', 'TAURI_'], - build: { - // Tauri supports es2021 - target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13', - // don't minify for debug builds - minify: !process.env.TAURI_DEBUG ? 'esbuild' : false, - // produce sourcemaps for debug builds - sourcemap: !!process.env.TAURI_DEBUG, - }, + // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` + // prevent vite from obscuring rust errors + clearScreen: false, + // tauri expects a fixed port, fail if that port is not available + server: { + port: 1420, + strictPort: true, + }, + // to make use of `TAURI_DEBUG` and other env variables + // https://tauri.studio/v1/api/config#buildconfig.beforedevcommand + envPrefix: ['VITE_', 'TAURI_'], + build: { + // Tauri supports es2021 + target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13', + // don't minify for debug builds + minify: !process.env.TAURI_DEBUG ? 'esbuild' : false, + // produce sourcemaps for debug builds + sourcemap: !!process.env.TAURI_DEBUG, + }, })) diff --git a/package.json b/package.json index d250a5c..04ae77e 100644 --- a/package.json +++ b/package.json @@ -1,46 +1,46 @@ { - "name": "TauRPC", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "build": "tsup", - "dev": "tsx watch src/index.ts", - "format": "dprint fmt", - "lint": "run-p lint:*", - "lint:format": "dprint check", - "lint:types": "tsc", - "lint:js": "eslint ." - }, - "keywords": [], - "author": "", - "license": "ISC", - "devDependencies": { - "@types/eslint": "^8.40.0", - "@types/node": "^20.2.5", - "@typescript-eslint/eslint-plugin": "^5.59.7", - "@typescript-eslint/parser": "^5.59.7", - "dprint": "^0.36.1", - "eslint": "^8.41.0", - "eslint-plugin-dprint": "^0.4.0", - "npm-run-all": "^4.1.5", - "tsup": "^6.7.0", - "tsx": "^3.12.7", - "typescript": "^5.0.4" - }, - "tsup": { - "entry": [ - "src/index.ts" - ], - "format": [ - "esm", - "cjs" - ], - "dts": { - "resolve": true - }, - "splitting": true, - "clean": true - }, - "packageManager": "pnpm@8.5.1" + "name": "TauRPC", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build": "tsup", + "dev": "tsx watch src/index.ts", + "format": "dprint fmt", + "lint": "run-p lint:*", + "lint:format": "dprint check", + "lint:types": "tsc", + "lint:js": "eslint ." + }, + "keywords": [], + "author": "", + "license": "ISC", + "devDependencies": { + "@types/eslint": "^8.40.0", + "@types/node": "^20.2.5", + "@typescript-eslint/eslint-plugin": "^5.59.7", + "@typescript-eslint/parser": "^5.59.7", + "dprint": "^0.36.1", + "eslint": "^8.41.0", + "eslint-plugin-dprint": "^0.4.0", + "npm-run-all": "^4.1.5", + "tsup": "^6.7.0", + "tsx": "^3.12.7", + "typescript": "^5.0.4" + }, + "tsup": { + "entry": [ + "src/index.ts" + ], + "format": [ + "esm", + "cjs" + ], + "dts": { + "resolve": true + }, + "splitting": true, + "clean": true + }, + "packageManager": "pnpm@8.5.1" } diff --git a/src/index.ts b/src/index.ts index 6af4f0f..1e1168b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ console.log('test') const test = (): string => { - return 'test4' + return 'test4' } export { test } diff --git a/tsconfig.json b/tsconfig.json index fed9be3..8a1a324 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,16 @@ { - "compilerOptions": { - "target": "es6", - "module": "esnext", - "moduleResolution": "node", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "isolatedModules": true - }, - "include": ["src", ".eslintrc.js"], - "exclude": ["node_modules", "dist"] + "compilerOptions": { + "target": "es6", + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "isolatedModules": true + }, + "include": ["src", ".eslintrc.js"], + "exclude": ["node_modules", "dist"] }