From a775364bfbb8f6a7d253d74d191dc5364c6e0238 Mon Sep 17 00:00:00 2001 From: Roger Far Date: Tue, 18 Oct 2022 10:55:37 -0600 Subject: [PATCH] Add prettier. --- client/.eslintrc.json | 25 +++++---------------- client/.prettierignore | 2 ++ client/angular.json | 18 ++++----------- client/package-lock.json | 22 ++++++++++++++++++ client/package.json | 6 +++-- client/src/app/torrent-status.pipe.ts | 1 - client/src/environments/environment.prod.ts | 2 +- client/src/environments/environment.ts | 2 +- client/src/main.ts | 5 +++-- client/src/polyfills.ts | 3 +-- client/tsconfig.app.json | 9 ++------ client/tsconfig.json | 5 +---- 12 files changed, 47 insertions(+), 53 deletions(-) create mode 100644 client/.prettierignore diff --git a/client/.eslintrc.json b/client/.eslintrc.json index 47c17dd..ad61851 100644 --- a/client/.eslintrc.json +++ b/client/.eslintrc.json @@ -1,23 +1,14 @@ { "root": true, - "ignorePatterns": [ - "projects/**/*" - ], + "ignorePatterns": ["projects/**/*"], "overrides": [ { - "files": [ - "*.ts" - ], + "files": ["*.ts"], "parserOptions": { - "project": [ - "tsconfig.json" - ], + "project": ["tsconfig.json"], "createDefaultProgram": true }, - "extends": [ - "plugin:@angular-eslint/recommended", - "plugin:@angular-eslint/template/process-inline-templates" - ], + "extends": ["plugin:@angular-eslint/recommended", "plugin:@angular-eslint/template/process-inline-templates"], "rules": { "@angular-eslint/directive-selector": [ "error", @@ -38,12 +29,8 @@ } }, { - "files": [ - "*.html" - ], - "extends": [ - "plugin:@angular-eslint/template/recommended" - ], + "files": ["*.html"], + "extends": ["plugin:@angular-eslint/template/recommended"], "rules": {} } ] diff --git a/client/.prettierignore b/client/.prettierignore new file mode 100644 index 0000000..f915cb5 --- /dev/null +++ b/client/.prettierignore @@ -0,0 +1,2 @@ +.angular +.vscode \ No newline at end of file diff --git a/client/angular.json b/client/angular.json index 85c98d3..f086f8d 100644 --- a/client/angular.json +++ b/client/angular.json @@ -45,13 +45,8 @@ "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "src/styles.scss" - ], + "assets": ["src/favicon.ico", "src/assets"], + "styles": ["src/styles.scss"], "scripts": [] }, "configurations": { @@ -111,10 +106,7 @@ "lint": { "builder": "@angular-eslint/builder:lint", "options": { - "lintFilePatterns": [ - "src/**/*.ts", - "src/**/*.html" - ] + "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"] } } } @@ -122,8 +114,6 @@ }, "cli": { "analytics": false, - "schematicCollections": [ - "@angular-eslint/schematics" - ] + "schematicCollections": ["@angular-eslint/schematics"] } } diff --git a/client/package-lock.json b/client/package-lock.json index 62594a4..fecedc5 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -43,6 +43,7 @@ "@typescript-eslint/eslint-plugin": "5.37.0", "@typescript-eslint/parser": "5.37.0", "eslint": "^8.23.1", + "prettier": "^2.7.1", "typescript": "~4.8.4" } }, @@ -10305,6 +10306,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", @@ -19872,6 +19888,12 @@ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true }, + "prettier": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", + "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "dev": true + }, "pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/client/package.json b/client/package.json index 8901069..2ed80ec 100644 --- a/client/package.json +++ b/client/package.json @@ -7,7 +7,8 @@ "build": "ng build", "watch": "ng build --watch --configuration development", "update": "ng update --force --allow-dirty @angular/cli @angular/core @angular/cdk @angular/flex-layout", - "lint": "ng lint" + "lint": "ng lint", + "prettier": "prettier --write \"./**/*.{ts,html,json}\"" }, "private": true, "dependencies": { @@ -46,6 +47,7 @@ "@typescript-eslint/eslint-plugin": "5.37.0", "@typescript-eslint/parser": "5.37.0", "eslint": "^8.23.1", + "prettier": "^2.7.1", "typescript": "~4.8.4" } -} \ No newline at end of file +} diff --git a/client/src/app/torrent-status.pipe.ts b/client/src/app/torrent-status.pipe.ts index 4bba89d..0190168 100644 --- a/client/src/app/torrent-status.pipe.ts +++ b/client/src/app/torrent-status.pipe.ts @@ -9,7 +9,6 @@ export class TorrentStatusPipe implements PipeTransform { constructor(private pipe: FileSizePipe) {} transform(torrent: Torrent): string { - if (torrent.error) { return torrent.error; } diff --git a/client/src/environments/environment.prod.ts b/client/src/environments/environment.prod.ts index 3612073..c966979 100644 --- a/client/src/environments/environment.prod.ts +++ b/client/src/environments/environment.prod.ts @@ -1,3 +1,3 @@ export const environment = { - production: true + production: true, }; diff --git a/client/src/environments/environment.ts b/client/src/environments/environment.ts index f56ff47..66998ae 100644 --- a/client/src/environments/environment.ts +++ b/client/src/environments/environment.ts @@ -3,7 +3,7 @@ // The list of file replacements can be found in `angular.json`. export const environment = { - production: false + production: false, }; /* diff --git a/client/src/main.ts b/client/src/main.ts index c7b673c..d9a2e7e 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -8,5 +8,6 @@ if (environment.production) { enableProdMode(); } -platformBrowserDynamic().bootstrapModule(AppModule) - .catch(err => console.error(err)); +platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); diff --git a/client/src/polyfills.ts b/client/src/polyfills.ts index 429bb9e..e4555ed 100644 --- a/client/src/polyfills.ts +++ b/client/src/polyfills.ts @@ -45,8 +45,7 @@ /*************************************************************************************************** * Zone JS is required by default for Angular itself. */ -import 'zone.js'; // Included with Angular CLI. - +import 'zone.js'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS diff --git a/client/tsconfig.app.json b/client/tsconfig.app.json index 82d91dc..ff396d4 100644 --- a/client/tsconfig.app.json +++ b/client/tsconfig.app.json @@ -5,11 +5,6 @@ "outDir": "./out-tsc/app", "types": [] }, - "files": [ - "src/main.ts", - "src/polyfills.ts" - ], - "include": [ - "src/**/*.d.ts" - ] + "files": ["src/main.ts", "src/polyfills.ts"], + "include": ["src/**/*.d.ts"] } diff --git a/client/tsconfig.json b/client/tsconfig.json index 9796775..b5a7d6a 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -19,10 +19,7 @@ "strictNullChecks": false, "target": "es2020", "module": "es2020", - "lib": [ - "es2020", - "dom" - ] + "lib": ["es2020", "dom"] }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false,