Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rxjs-suffix-subjects throws error in console #88

Closed
emzet opened this issue Mar 22, 2019 · 3 comments
Closed

rxjs-suffix-subjects throws error in console #88

emzet opened this issue Mar 22, 2019 · 3 comments

Comments

@emzet
Copy link

emzet commented Mar 22, 2019

When run ng lint, this outputs in console for some files, all subjects have required suffix so at the end it succeed, but outputs this ugly errors in console.

Error:

The 'rxjs-suffix-subjects' rule threw an error in '[PROJECT_PATH]/src/app/modules/deals/deals-filters/deals-filter-full/deals-filter-full.component.ts':
TypeError: Cannot read property 'flags' of undefined
    at Object.getCheckFlags ([PROJECT_PATH]node_modules\typescript\lib\typescript.js:12135:23)
    at getTypeOfSymbol ([PROJECT_PATH]node_modules\typescript\lib\typescript.js:35850:20)
    at getTypeOfNode ([PROJECT_PATH]node_modules\typescript\lib\typescript.js:56817:24)
    at Object.getTypeAtLocation ([PROJECT_PATH]node_modules\typescript\lib\typescript.js:30859:31)
    at [PROJECT_PATH]node_modules\rxjs-tslint-rules\dist\rules\rxjsSuffixSubjectsRule.js:57:36
    at Array.forEach (<anonymous>)
    at Rule.applyWithProgram ([PROJECT_PATH]node_modules\rxjs-tslint-rules\dist\rules\rxjsSuffixSubjectsRule.js:56:21)
    at Linter.applyRule ([PROJECT_PATH]node_modules\tslint\lib\linter.js:211:29)
    at [PROJECT_PATH]node_modules\tslint\lib\linter.js:155:85
    at Object.flatMap ([PROJECT_PATH]node_modules\tslint\lib\utils.js:160:29)
    at Linter.getAllFailures ([PROJECT_PATH]node_modules\tslint\lib\linter.js:155:32)
    at Linter.lint ([PROJECT_PATH]node_modules\tslint\lib\linter.js:110:33)
    at lint ([PROJECT_PATH]node_modules\@angular-devkit\build-angular\src\tslint\index.js:145:20)
    at Observable.rxjs_1.Observable.obs [as _subscribe] ([PROJECT_PATH]node_modules\@angular-devkit\build-angular\src\tslint\index.js:61:37)
    at Observable._trySubscribe ([PROJECT_PATH]node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Observable.js:44:25)
    at Observable.subscribe ([PROJECT_PATH]node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Observable.js:30:22)

All files pass linting.

Rule config:

"rxjs-suffix-subjects": {
  "options": {
    "parameters": true,
    "properties": true,
    "suffix": "Sub",
    "variables": true
  }
}

Environment:

Angular CLI: 7.3.6
Node: 11.12.0
OS: win32 x64
Angular: 7.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.6
@angular-devkit/build-angular     0.13.6
@angular-devkit/build-optimizer   0.13.6
@angular-devkit/build-webpack     0.13.6
@angular-devkit/core              7.3.6
@angular-devkit/schematics        7.3.6
@angular/cli                      7.3.6
@ngtools/webpack                  7.3.6
@schematics/angular               7.3.6
@schematics/update                0.13.6
rxjs                              6.4.0
typescript                        3.2.4
webpack                           4.29.0
@cartant cartant added the bug label Mar 22, 2019
@cartant
Copy link
Owner

cartant commented Mar 22, 2019

Can you include one of the files that effects the error?

@emzet
Copy link
Author

emzet commented Mar 25, 2019

So this affects only 6 big files in project, each has >500 lines of code, but this one is small, hope it helps.

File:

import { RouterStateSerializer } from '@ngrx/router-store';
import { Params, RouterStateSnapshot } from '@angular/router';



/**
 * The RouterStateSerializer takes the current RouterStateSnapshot
 * and returns any pertinent information needed. The snapshot contains
 * all information about the state of the router at the given point in time.
 * The entire snapshot is complex and not always needed. In this case, you only
 * need the URL and query parameters from the snapshot in the store. Other items could be
 * returned such as route parameters and static route data.
 */
export interface RouterStateUrl {
  url: string;
  queryParams: Params;
}

export class CustomRouterStateSerializer implements RouterStateSerializer<RouterStateUrl> {
  serialize(routerState: RouterStateSnapshot): RouterStateUrl {
    const { url } = routerState;
    const queryParams = routerState.root.queryParams;

    return { url, queryParams };
  }
}

Error:

> ng lint

Linting "[PROJECT_NAME]"...
The 'rxjs-suffix-subjects' rule threw an error in '[PROJECT_PATH]/src/app/custom/custom-router-state-serializer.ts':
TypeError: Cannot read property 'flags' of undefined
    at Object.getCheckFlags ([PROJECT_PATH]\node_modules\typescript\lib\typescript.js:12135:23)
    at getTypeOfSymbol ([PROJECT_PATH]\node_modules\typescript\lib\typescript.js:35850:20)
    at getTypeOfNode ([PROJECT_PATH]\node_modules\typescript\lib\typescript.js:56817:24)
    at Object.getTypeAtLocation ([PROJECT_PATH]\node_modules\typescript\lib\typescript.js:30859:31)
    at [PROJECT_PATH]\node_modules\rxjs-tslint-rules\dist\rules\rxjsSuffixSubjectsRule.js:57:36
    at Array.forEach (<anonymous>)
    at Rule.applyWithProgram ([PROJECT_PATH]\node_modules\rxjs-tslint-rules\dist\rules\rxjsSuffixSubjectsRule.js:56:21)
    at Linter.applyRule ([PROJECT_PATH]\node_modules\tslint\lib\linter.js:211:29)
    at [PROJECT_PATH]\node_modules\tslint\lib\linter.js:155:85
    at Object.flatMap ([PROJECT_PATH]\node_modules\tslint\lib\utils.js:160:29)
    at Linter.getAllFailures ([PROJECT_PATH]\node_modules\tslint\lib\linter.js:155:32)
    at Linter.lint ([PROJECT_PATH]\node_modules\tslint\lib\linter.js:110:33)
    at lint ([PROJECT_PATH]\node_modules\@angular-devkit\build-angular\src\tslint\index.js:145:20)
    at Observable.rxjs_1.Observable.obs [as _subscribe] ([PROJECT_PATH]\node_modules\@angular-devkit\build-angular\src\tslint\index.js:61:37)
    at Observable._trySubscribe ([PROJECT_PATH]\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Observable.js:44:25)
    at Observable.subscribe ([PROJECT_PATH]\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Observable.js:30:22)

All files pass linting.

cartant added a commit that referenced this issue Mar 26, 2019
@cartant
Copy link
Owner

cartant commented Mar 26, 2019

This should be fixed in 4.19.1. Thanks for the detailed bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants