Closed emzet closed 5 years ago
Can you include one of the files that effects the error?
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.
This should be fixed in 4.19.1. Thanks for the detailed bug report.
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:
Rule config:
Environment: