]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
fix code style issues
authorFrank Strieter <fs@co-it.eu>
Wed, 23 Mar 2022 07:33:19 +0000 (08:33 +0100)
committerFrank Strieter <fs@co-it.eu>
Wed, 23 Mar 2022 08:39:55 +0000 (09:39 +0100)
solve merge conflicts

format code

format code

format code

.github/workflows/project-actions.yml
src-ui/angular.json
src-ui/jest.config.js
src-ui/package.json
src-ui/setup-jest.ts
src-ui/src/app/components/common/edit-dialog/edit-dialog.component.ts
src-ui/src/app/components/common/input/check/check.component.ts
src-ui/test-config.helper.ts

index 9c1acfaa9041e3a0aa50057d365b00a4227aee3f..2cf98bf4b8d25975206ec556da1859a8c3f3eb73 100644 (file)
@@ -8,9 +8,6 @@ on:
     types:
       - opened
       - reopened
-    branches:
-      - main
-      - dev
 
 # map fields with customized labels
 env:
index 6edccee5b62beabf0e71d8c9938cb2bb59d579b9..16cc2070e2698e8e1e41942722990ab3fe3436d4 100644 (file)
        "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
        "version": 1,
        "newProjectRoot": "projects",
-  "projects": {
-    "paperless-ui": {
-      "projectType": "application",
-      "schematics": {
-        "@schematics/angular:component": {
-          "style": "scss"
-        }
-      },
-      "root": "",
-      "sourceRoot": "src",
-      "prefix": "app",
-      "i18n": {
-        "sourceLocale": "en-US",
-        "locales": {
-          "cs-CZ": "src/locale/messages.cs_CZ.xlf",
-          "da-DK": "src/locale/messages.da_DK.xlf",
-          "de-DE": "src/locale/messages.de_DE.xlf",
-          "en-GB": "src/locale/messages.en_GB.xlf",
-          "es-ES": "src/locale/messages.es_ES.xlf",
-          "fr-FR": "src/locale/messages.fr_FR.xlf",
-          "it-IT": "src/locale/messages.it_IT.xlf",
-          "lb-LU": "src/locale/messages.lb_LU.xlf",
-          "nl-NL": "src/locale/messages.nl_NL.xlf",
-          "pl-PL": "src/locale/messages.pl_PL.xlf",
-          "pt-BR": "src/locale/messages.pt_BR.xlf",
-          "pt-PT": "src/locale/messages.pt_PT.xlf",
-          "ro-RO": "src/locale/messages.ro_RO.xlf",
-          "ru-RU": "src/locale/messages.ru_RU.xlf",
-          "sl-SI": "src/locale/messages.sl_SI.xlf",
-          "sr-CS": "src/locale/messages.sr_CS.xlf",
-          "sv-SE": "src/locale/messages.sv_SE.xlf",
-          "zh-CN": "src/locale/messages.zh_CN.xlf"
-        }
-      },
-      "architect": {
-        "build": {
-          "builder": "@angular-devkit/build-angular:browser",
-          "options": {
-            "outputPath": "dist/paperless-ui",
-            "outputHashing": "none",
-            "index": "src/index.html",
-            "main": "src/main.ts",
-            "polyfills": "src/polyfills.ts",
-            "tsConfig": "tsconfig.app.json",
-            "localize": true,
-            "assets": [
-              "src/favicon.ico",
-              "src/apple-touch-icon.png",
-              "src/assets",
-              "src/manifest.webmanifest",
-              {
-                "glob": "pdf.worker.min.js",
-                "input": "node_modules/pdfjs-dist/build/",
-                "output": "/assets/js/"
-              }
-            ],
-            "styles": [
-              "src/styles.scss"
-            ],
-            "scripts": [],
-            "allowedCommonJsDependencies": [
-              "ng2-pdf-viewer"
-            ],
-            "vendorChunk": true,
-            "extractLicenses": false,
-            "buildOptimizer": false,
-            "sourceMap": true,
-            "optimization": false,
-            "namedChunks": true
-          },
-          "configurations": {
-            "production": {
-              "fileReplacements": [
-                {
-                  "replace": "src/environments/environment.ts",
-                  "with": "src/environments/environment.prod.ts"
-                }
-              ],
-              "outputPath": "../src/documents/static/frontend/",
-              "optimization": true,
-              "outputHashing": "none",
-              "sourceMap": false,
-              "namedChunks": false,
-              "extractLicenses": true,
-              "vendorChunk": false,
-              "buildOptimizer": true,
-              "budgets": [
-                {
-                  "type": "initial",
-                  "maximumWarning": "2mb",
-                  "maximumError": "5mb"
-                },
-                {
-                  "type": "anyComponentStyle",
-                  "maximumWarning": "6kb",
-                  "maximumError": "10kb"
-                }
-              ]
-            },
-            "en-US": {
-              "localize": [
-                "en-US"
-              ]
-            }
-          },
-          "defaultConfiguration": ""
-        },
-        "serve": {
-          "builder": "@angular-devkit/build-angular:dev-server",
-          "options": {
-            "browserTarget": "paperless-ui:build:en-US"
-          },
-          "configurations": {
-            "production": {
-              "browserTarget": "paperless-ui:build:production"
-            }
-          }
-        },
-        "extract-i18n": {
-          "builder": "@angular-devkit/build-angular:extract-i18n",
-          "options": {
-            "browserTarget": "paperless-ui:build"
-          }
-        },
-        "test": {
-          "builder": "@angular-builders/jest:run",
-          "options": {
-            "tsConfig": "tsconfig.spec.json",
-            "assets": [
-              "src/favicon.ico",
-              "src/apple-touch-icon.png",
-              "src/assets",
-              "src/manifest.webmanifest"
-            ],
-            "styles": [
-              "src/styles.scss"
-            ],
-            "scripts": []
-          }
-        },
-        "e2e": {
-          "builder": "@cypress/schematic:cypress",
-          "options": {
-            "devServerTarget": "paperless-ui:serve",
-            "watch": true,
-            "headless": false
-          },
-          "configurations": {
-            "production": {
-              "devServerTarget": "paperless-ui:serve:production"
-            }
-          }
-        },
-        "cypress-run": {
-          "builder": "@cypress/schematic:cypress",
-          "options": {
-            "devServerTarget": "paperless-ui:serve"
-          },
-          "configurations": {
-            "production": {
-              "devServerTarget": "paperless-ui:serve:production"
-            }
-          }
-        },
-        "cypress-open": {
-          "builder": "@cypress/schematic:cypress",
-          "options": {
-            "watch": true,
-            "headless": false
-          }
-        }
-      }
-    }
-  },
-  "defaultProject": "paperless-ui"
+       "projects": {
+               "paperless-ui": {
+                       "projectType": "application",
+                       "schematics": {
+                               "@schematics/angular:component": {
+                                       "style": "scss"
+                               }
+                       },
+                       "root": "",
+                       "sourceRoot": "src",
+                       "prefix": "app",
+                       "i18n": {
+                               "sourceLocale": "en-US",
+                               "locales": {
+                                       "cs-CZ": "src/locale/messages.cs_CZ.xlf",
+                                       "da-DK": "src/locale/messages.da_DK.xlf",
+                                       "de-DE": "src/locale/messages.de_DE.xlf",
+                                       "en-GB": "src/locale/messages.en_GB.xlf",
+                                       "es-ES": "src/locale/messages.es_ES.xlf",
+                                       "fr-FR": "src/locale/messages.fr_FR.xlf",
+                                       "it-IT": "src/locale/messages.it_IT.xlf",
+                                       "lb-LU": "src/locale/messages.lb_LU.xlf",
+                                       "nl-NL": "src/locale/messages.nl_NL.xlf",
+                                       "pl-PL": "src/locale/messages.pl_PL.xlf",
+                                       "pt-BR": "src/locale/messages.pt_BR.xlf",
+                                       "pt-PT": "src/locale/messages.pt_PT.xlf",
+                                       "ro-RO": "src/locale/messages.ro_RO.xlf",
+                                       "ru-RU": "src/locale/messages.ru_RU.xlf",
+                                       "sl-SI": "src/locale/messages.sl_SI.xlf",
+                                       "sr-CS": "src/locale/messages.sr_CS.xlf",
+                                       "sv-SE": "src/locale/messages.sv_SE.xlf",
+                                       "zh-CN": "src/locale/messages.zh_CN.xlf"
+                               }
+                       },
+                       "architect": {
+                               "build": {
+                                       "builder": "@angular-devkit/build-angular:browser",
+                                       "options": {
+                                               "outputPath": "dist/paperless-ui",
+                                               "outputHashing": "none",
+                                               "index": "src/index.html",
+                                               "main": "src/main.ts",
+                                               "polyfills": "src/polyfills.ts",
+                                               "tsConfig": "tsconfig.app.json",
+                                               "localize": true,
+                                               "assets": [
+                                                       "src/favicon.ico",
+                                                       "src/apple-touch-icon.png",
+                                                       "src/assets",
+                                                       "src/manifest.webmanifest", {
+                                                               "glob": "pdf.worker.min.js",
+                                                               "input": "node_modules/pdfjs-dist/build/",
+                                                               "output": "/assets/js/"
+                                                       }
+                                               ],
+                                               "styles": [
+                                                       "src/styles.scss"
+                                               ],
+                                               "scripts": [],
+                                               "allowedCommonJsDependencies": [
+                                                       "ng2-pdf-viewer"
+                                               ],
+                                               "vendorChunk": true,
+                                               "extractLicenses": false,
+                                               "buildOptimizer": false,
+                                               "sourceMap": true,
+                                               "optimization": false,
+                                               "namedChunks": true
+                                       },
+                                       "configurations": {
+                                               "production": {
+                                                       "fileReplacements": [
+                                                               {
+                                                                       "replace": "src/environments/environment.ts",
+                                                                       "with": "src/environments/environment.prod.ts"
+                                                               }
+                                                       ],
+                                                       "outputPath": "../src/documents/static/frontend/",
+                                                       "optimization": true,
+                                                       "outputHashing": "none",
+                                                       "sourceMap": false,
+                                                       "namedChunks": false,
+                                                       "extractLicenses": true,
+                                                       "vendorChunk": false,
+                                                       "buildOptimizer": true,
+                                                       "budgets": [
+                                                               {
+                                                                       "type": "initial",
+                                                                       "maximumWarning": "2mb",
+                                                                       "maximumError": "5mb"
+                                                               },
+                                                               {
+                                                                       "type": "anyComponentStyle",
+                                                                       "maximumWarning": "6kb",
+                                                                       "maximumError": "10kb"
+                                                               }
+                                                       ]
+                                               },
+                                               "en-US": {
+                                                       "localize": ["en-US"]
+                                               }
+                                       },
+                                       "defaultConfiguration": ""
+                               },
+                               "serve": {
+                                       "builder": "@angular-devkit/build-angular:dev-server",
+                                       "options": {
+                                               "browserTarget": "paperless-ui:build:en-US"
+                                       },
+                                       "configurations": {
+                                               "production": {
+                                                       "browserTarget": "paperless-ui:build:production"
+                                               }
+                                       }
+                               },
+                               "extract-i18n": {
+                                       "builder": "@angular-devkit/build-angular:extract-i18n",
+                                       "options": {
+                                               "browserTarget": "paperless-ui:build"
+                                       }
+                               },
+                               "test": {
+                                       "builder": "@angular-builders/jest:run",
+                                       "options": {
+                                               "tsConfig": "tsconfig.spec.json",
+                                               "assets": [
+                                                       "src/favicon.ico",
+                                                       "src/apple-touch-icon.png",
+                                                       "src/assets",
+                                                       "src/manifest.webmanifest"
+                                               ],
+                                               "styles": [
+                                                       "src/styles.scss"
+                                               ],
+                                               "scripts": []
+                                       }
+                               },
+                               "e2e": {
+                                       "builder": "@cypress/schematic:cypress",
+                                       "options": {
+                                               "devServerTarget": "paperless-ui:serve",
+                                               "watch": true,
+                                               "headless": false
+                                       },
+                                       "configurations": {
+                                               "production": {
+                                                       "devServerTarget": "paperless-ui:serve:production"
+                                               }
+                                       }
+                               },
+                               "cypress-run": {
+                                       "builder": "@cypress/schematic:cypress",
+                                       "options": {
+                                               "devServerTarget": "paperless-ui:serve"
+                                       },
+                                       "configurations": {
+                                               "production": {
+                                                       "devServerTarget": "paperless-ui:serve:production"
+                                               }
+                                       }
+                               },
+                               "cypress-open": {
+                                       "builder": "@cypress/schematic:cypress",
+                                       "options": {
+                                               "watch": true,
+                                               "headless": false
+                                       }
+                               }
+                       }
+               }
+       },
+       "defaultProject": "paperless-ui"
 }
index 45ef68959654da81daf1821c88f8a79de92d376b..23de7b188ca5d8706adccb87c5a855c4ff206157 100644 (file)
@@ -1,8 +1,8 @@
 module.exports = {
   moduleNameMapper: {
-    "@core/(.*)": "<rootDir>/src/app/core/$1",
+    '@core/(.*)': '<rootDir>/src/app/core/$1',
   },
-  preset: "jest-preset-angular",
-  setupFilesAfterEnv: ["<rootDir>/setup-jest.ts"],
-  testPathIgnorePatterns: ["/node_modules/", "/cypress/"],
-};
+  preset: 'jest-preset-angular',
+  setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
+  testPathIgnorePatterns: ['/node_modules/', '/cypress/'],
+}
index 6683b997d4fef4e5ee5132f744ef0e1c4e5aecd3..38602c730747c5b5fbb742b31dc1d058edd40aa9 100644 (file)
@@ -9,7 +9,7 @@
     "lint": "ng lint",
     "e2e": "ng e2e",
     "cy:run": "cypress run",
-    "e2e:ci": "concurrently \"npm run start\" \"wait-on http-get://localhost:4200 && npm run cy:run\" --kill-others --success first"
+    "e2e:ci": "concurrently 'npm run start' 'wait-on http-get://localhost:4200 && npm run cy:run' --kill-others --success first"
   },
   "private": true,
   "dependencies": {
index c581590b264304c2e0ad67986db5b7169b89ddaf..5ada7e7c6bf08db4695b9c74020a87a74c0299f0 100644 (file)
@@ -1,30 +1,30 @@
-import 'jest-preset-angular/setup-jest';
+import 'jest-preset-angular/setup-jest'
 
 /* global mocks for jsdom */
 const mock = () => {
-  let storage: { [key: string]: string } = {};
+  let storage: { [key: string]: string } = {}
   return {
     getItem: (key: string) => (key in storage ? storage[key] : null),
     setItem: (key: string, value: string) => (storage[key] = value || ''),
     removeItem: (key: string) => delete storage[key],
     clear: () => (storage = {}),
-  };
-};
+  }
+}
 
-Object.defineProperty(window, 'localStorage', { value: mock() });
-Object.defineProperty(window, 'sessionStorage', { value: mock() });
+Object.defineProperty(window, 'localStorage', { value: mock() })
+Object.defineProperty(window, 'sessionStorage', { value: mock() })
 Object.defineProperty(window, 'getComputedStyle', {
   value: () => ['-webkit-appearance'],
-});
+})
 
 Object.defineProperty(document.body.style, 'transform', {
   value: () => {
     return {
       enumerable: true,
       configurable: true,
-    };
+    }
   },
-});
+})
 
 /* output shorter and more meaningful Zone error stack traces */
-// Error.stackTraceLimit = 2;
+// Error.stackTraceLimit = 2
index 1ba9c53ec140629eda3cd9cd2d4229d66fcf04cf..92b16a93dc62a8fd762ec8fc34d903f264baef05 100644 (file)
@@ -19,27 +19,27 @@ export abstract class EditDialogComponent<T extends ObjectWithId>
   ) {}
 
   @Input()
-  dialogMode: string = 'create';
+  dialogMode: string = 'create'
 
   @Input()
-  object: T;
+  object: T
 
   @Output()
-  success = new EventEmitter();
+  success = new EventEmitter()
 
-  networkActive = false;
+  networkActive = false
 
-  closeEnabled = false;
+  closeEnabled = false
 
-  error = null;
+  error = null
 
-  abstract getForm(): FormGroup;
+  abstract getForm(): FormGroup
 
-  objectForm: FormGroup = this.getForm();
+  objectForm: FormGroup = this.getForm()
 
   ngOnInit(): void {
     if (this.object != null) {
-      this.objectForm.patchValue(this.object);
+      this.objectForm.patchValue(this.object)
     }
 
     // wait to enable close button so it doesnt steal focus from input since its the first clickable element in the DOM
@@ -49,34 +49,34 @@ export abstract class EditDialogComponent<T extends ObjectWithId>
   }
 
   getCreateTitle() {
-    return $localize`Create new item`;
+    return $localize`Create new item`
   }
 
   getEditTitle() {
-    return $localize`Edit item`;
+    return $localize`Edit item`
   }
 
   getSaveErrorMessage(error: string) {
-    return $localize`Could not save element: ${error}`;
+    return $localize`Could not save element: ${error}`
   }
 
   getTitle() {
     switch (this.dialogMode) {
       case 'create':
-        return this.getCreateTitle();
+        return this.getCreateTitle()
       case 'edit':
-        return this.getEditTitle();
+        return this.getEditTitle()
       default:
         break
     }
   }
 
   getMatchingAlgorithms() {
-    return MATCHING_ALGORITHMS;
+    return MATCHING_ALGORITHMS
   }
 
   get patternRequired(): boolean {
-    return this.objectForm?.value.matching_algorithm !== MATCH_AUTO;
+    return this.objectForm?.value.matching_algorithm !== MATCH_AUTO
   }
 
   save() {
@@ -90,7 +90,7 @@ export abstract class EditDialogComponent<T extends ObjectWithId>
         serverResponse = this.service.create(newObject)
         break
       case 'edit':
-        serverResponse = this.service.update(newObject);
+        serverResponse = this.service.update(newObject)
       default:
         break
     }
@@ -108,6 +108,6 @@ export abstract class EditDialogComponent<T extends ObjectWithId>
   }
 
   cancel() {
-    this.activeModal.close();
+    this.activeModal.close()
   }
 }
index bf99b3c6adb220f017dc70d7625e41f66e476643..f4a6e527ebafb29a9a579df8c8c42f600b19ad2d 100644 (file)
@@ -17,6 +17,6 @@ import { AbstractInputComponent } from '../abstract-input'
 })
 export class CheckComponent extends AbstractInputComponent<boolean> {
   constructor() {
-    super();
+    super()
   }
 }
index 4bec94ea4f804cb6098778e9420a9edc7b85d0ab..f38cdfb26812fbf91431a42a74359994c7ccaab9 100644 (file)
@@ -1,21 +1,24 @@
-import { TestBed } from '@angular/core/testing';
+import { TestBed } from '@angular/core/testing'
 
 type CompilerOptions = Partial<{
-  providers: any[];
-  useJit: boolean;
-  preserveWhitespaces: boolean;
-}>;
-export type ConfigureFn = (testBed: typeof TestBed) => void;
+  providers: any[]
+  useJit: boolean
+  preserveWhitespaces: boolean
+}>
+export type ConfigureFn = (testBed: typeof TestBed) => void
 
-export const configureTests = (configure: ConfigureFn, compilerOptions: CompilerOptions = {}) => {
+export const configureTests = (
+  configure: ConfigureFn,
+  compilerOptions: CompilerOptions = {}
+) => {
   const compilerConfig: CompilerOptions = {
     preserveWhitespaces: false,
     ...compilerOptions,
-  };
+  }
 
-  const configuredTestBed = TestBed.configureCompiler(compilerConfig);
+  const configuredTestBed = TestBed.configureCompiler(compilerConfig)
 
-  configure(configuredTestBed);
+  configure(configuredTestBed)
 
-  return configuredTestBed.compileComponents().then(() => configuredTestBed);
-};
+  return configuredTestBed.compileComponents().then(() => configuredTestBed)
+}