compodoc icon indicating copy to clipboard operation
compodoc copied to clipboard

[BUG] Functional guards are listed in Miscellaneous section

Open pfpoujol opened this issue 1 year ago • 0 comments

Overview of the issue

In angular doc :

Class-based Route guards are deprecated in favor of functional guards.

So wrote a functional guard like in the doc but it is interpreted as simple variable and listed in Miscellaneous section. image

Operating System, Node.js, npm, compodoc version(s)

Windows 10 Node.js v18.17.1 npm v9.6.7 Compodoc v1.1.21

Angular configuration, a package.json file in the root folder
{
  "private": true,
  "dependencies": {
    "@angular/animations": "~15.2.0",
    "@angular/common": "~15.2.0",
    "@angular/core": "~15.2.0",
    "@angular/fire": "^7.5.0",
    "@angular/forms": "~15.2.0",
    "@angular/platform-browser": "~15.2.0",
    "@angular/platform-browser-dynamic": "~15.2.0",
    "@angular/router": "~15.2.0",
    "@capacitor/camera": "^5.0.2",
    "@capacitor/core": "^5.0.3",
    "@capacitor/device": "^5.0.4",
    "@capacitor/filesystem": "^5.0.2",
    "@capacitor/haptics": "5.0.2",
    "@capacitor/keyboard": "5.0.2",
    "@capacitor/network": "^5.0.2",
    "@capacitor/splash-screen": "^5.0.2",
    "@capacitor/status-bar": "5.0.2",
    "@ionic/angular": "^7.0.3",
    "@ionic/angular-toolkit": "^9.0.0",
    "@ionic/pwa-elements": "^3.1.1",
    "@ionic/storage-angular": "^4.0.0",
    "@ngneat/transloco": "^4.2.7",
    "@ngneat/transloco-locale": "^4.1.0",
    "@ngrx/component-store": "15.3.0",
    "@ngrx/effects": "15.3.0",
    "@ngrx/entity": "15.3.0",
    "@ngrx/router-store": "15.3.0",
    "@ngrx/store": "15.3.0",
    "firebase": "^9.14.0",
    "firebase-admin": "^11.10.1",
    "firebase-functions": "^4.4.1",
    "ionicons": "^7.0.0",
    "openid-client": "^5.6.1",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~15.2.0",
    "@angular-devkit/core": "~15.2.0",
    "@angular-devkit/schematics": "~15.2.0",
    "@angular-eslint/eslint-plugin": "16.0.3",
    "@angular-eslint/eslint-plugin-template": "16.0.3",
    "@angular-eslint/template-parser": "16.0.3",
    "@angular/cli": "~15.2.0",
    "@angular/compiler": "~15.2.0",
    "@angular/compiler-cli": "~15.2.0",
    "@angular/language-service": "~15.2.0",
    "@capacitor/android": "^5.0.3",
    "@capacitor/cli": "^5.0.3",
    "@capacitor/ios": "^5.0.3",
    "@compodoc/compodoc": "^1.1.19",
    "@cypress/webpack-dev-server": "^2.0.0",
    "@ngrx/schematics": "15.3.0",
    "@ngrx/store-devtools": "15.3.0",
    "@nx/angular": "16.3.2",
    "@nx/cypress": "16.3.2",
    "@nx/devkit": "16.3.2",
    "@nx/esbuild": "16.10.0",
    "@nx/eslint-plugin": "16.3.2",
    "@nx/jest": "16.10.0",
    "@nx/js": "16.10.0",
    "@nx/linter": "16.3.2",
    "@nx/node": "16.10.0",
    "@nx/web": "16.3.2",
    "@nx/workspace": "16.3.2",
    "@nxext/ionic-angular": "16.2.0",
    "@schematics/angular": "~15.2.0",
    "@simondotm/nx-firebase": "^2.1.2",
    "@twittwer/compodoc": "^1.10.0",
    "@types/jest": "29.4.4",
    "@types/node": "18.7.1",
    "@typescript-eslint/eslint-plugin": "5.58.0",
    "@typescript-eslint/parser": "5.58.0",
    "cypress": "12.11.0",
    "cypress-browser-permissions": "^1.1.0",
    "esbuild": "^0.17.17",
    "eslint": "~8.15.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "firebase-functions-test": "^3.1.0",
    "firebase-tools": "^12.7.0",
    "jasmine-marbles": "~0.9.1",
    "jest": "29.4.3",
    "jest-auto-spies": "^3.0.0",
    "jest-environment-jsdom": "29.4.3",
    "jest-environment-node": "^29.4.1",
    "jest-preset-angular": "13.1.1",
    "kill-port": "^2.0.1",
    "nx": "16.3.2",
    "nx-cloud": "16.0.5",
    "prettier": "^2.6.2",
    "ts-jest": "29.1.0",
    "ts-node": "10.9.1",
    "typescript": "~4.9.5"
  }
}
Compodoc installed globally or locally ?

Compodoc is installed locally

If possible sourcecode of the file where it breaks
import {CanActivateFn, Router} from '@angular/router';
import {inject} from "@angular/core";
import {select, Store} from "@ngrx/store";
import {selectAuthIsLoaded, selectIsNoAuthenticated} from "./+state/auth/auth.selectors";
import {map, skipWhile, switchMap} from "rxjs";

export const authGuard: CanActivateFn = (route) => {
 const router = inject(Router);
 const store = inject(Store);
 const path = route.data['redirectTo'] as string;
 if(!path) {
   throw new Error('The redirectTo path is missing, please read the comment above.');
 }
 return store.pipe(
   select(selectAuthIsLoaded),
   skipWhile(loaded => !loaded),
   switchMap( () => store.select(selectIsNoAuthenticated).pipe(map(isNotAuthenticated => {
     if (isNotAuthenticated) {
       return router.createUrlTree([path]);
     }
     return true;
     }))
   )
 )
};
If possible your terminal logs before the error

1.1.21

TypeScript version used by Compodoc : 5.0.2

Node.js version : v18.17.1

Operating system : Windows 10

[11:17:10] No configuration file found, switching to CLI flags.

[11:17:10] Using tsconfig file : C:\Users\Pierre-FlorentPoujol\Workspace\stella-surgical\libs\shared\data-access\auth\tsconfig.lib.json

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/index.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/auth.guard.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/shared-data-access-auth.module.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/services/auth-psc.service.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/services/auth.service.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/services/second-factor.service.ts [11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.actions.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.effects.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.model.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.reducer.ts

[11:17:10] Including : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.selectors.ts

[11:17:10] Searching package.json file

[11:17:10] Error during C:\Users\Pierre-FlorentPoujol\Workspace\stella-surgical\libs\shared\data-access\auth\package.json read

[11:17:10] Continuing without package.json file [11:17:10] Searching README.md, CHANGELOG.md, CONTRIBUTING.md, LICENSE.md, TODO.md files

[11:17:10] README.md file found

[11:17:10] Error during C:\Users\Pierre-FlorentPoujol\Workspace\stella-surgical\libs\shared\data-access\auth\CHANGELOG read

[11:17:10] Continuing without CHANGELOG.md file

[11:17:10] Error during C:\Users\Pierre-FlorentPoujol\Workspace\stella-surgical\libs\shared\data-access\auth\CONTRIBUTING read [11:17:10] Continuing without CONTRIBUTING.md file

[11:17:10] Error during C:\Users\Pierre-FlorentPoujol\Workspace\stella-surgical\libs\shared\data-access\auth\LICENSE read

[11:17:10] Continuing without LICENSE.md file

[11:17:10] Error during C:\Users\Pierre-FlorentPoujol\Workspace\stella-surgical\libs\shared\data-access\auth\TODO read

[11:17:10] Continuing without TODO.md file

[11:17:10] Get dependencies data

[11:17:10] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/index.ts

[11:17:10] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/auth.guard.ts

[11:17:10] found : authGuard

[11:17:10] found : unauthGuard

[11:17:10] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/shared-data-access-auth.module.ts

[11:17:10] ignore : SharedDataAccessAuthModule [11:17:10] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/services/auth-psc.service.ts

[11:17:10] found : AuthPscService

[11:17:10] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/services/auth.service.ts

[11:17:10] found : AuthService

[11:17:10] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/services/second-factor.service.ts

[11:17:11] found : SecondFactorService

[11:17:11] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.actions.ts

[11:17:11] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.effects.ts

[11:17:11] ignore : AuthEffects [11:17:11] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.model.ts

[11:17:11] ignore : AuthUser [11:17:11] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.reducer.ts

[11:17:11] ignore : AuthState

[11:17:11] parsing : C:/Users/Pierre-FlorentPoujol/Workspace/stella-surgical/libs/shared/data-access/auth/src/lib/+state/auth/auth.selectors.ts

[11:17:11]

[11:17:11] Project statistics [11:17:11] - injectable : 3

[11:17:11] -------------------

[11:17:11] Prepare components

[11:17:11] Prepare modules

[11:17:11] Prepare injectables

[11:17:11] Prepare miscellaneous

[11:17:11] Graph generation disabled

[11:17:11] Process pages

[11:17:11] Process page : AuthPscService

[11:17:11] Process page : AuthService

[11:17:11] Process page : SecondFactorService

[11:17:11] Process page : index

[11:17:11] Process page : modules

[11:17:11] Process page : overview

[11:17:11] Process page : variables

[11:17:11] Process menu...

[11:17:16] Copy main resources

[11:17:16] Documentation generated in ........\dist\compodoc\shared-data-access-auth/ in 6.058 seconds using gitbook theme [11:17:16] Serving documentation from ........\dist\compodoc\shared-data-access-auth/ at http://127.0.0.1:8080

Motivation for or Use Case

My guards ar listed at the wrong place.

Reproduce the error

Writing a functional guards instead of a Class-based guards

Related issues

None

Suggest a Fix

None

pfpoujol avatar Nov 09 '23 10:11 pfpoujol