diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index a872868931..19edc805eb 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -968,23 +968,23 @@ describe('AppComponent', () => { // Initially, `isTransitoning` is true. expect(component.isTransitioning).toBe(true); - expect(toolbar.classes['transitioning']).toBe(true); + expect(toolbar.classes.transitioning).toBe(true); triggerDocViewerEvent('docRendered'); fixture.detectChanges(); expect(component.isTransitioning).toBe(false); - expect(toolbar.classes['transitioning']).toBeFalsy(); + expect(toolbar.classes.transitioning).toBeFalsy(); // While a document is being rendered, `isTransitoning` is set to true. triggerDocViewerEvent('docReady'); fixture.detectChanges(); expect(component.isTransitioning).toBe(true); - expect(toolbar.classes['transitioning']).toBe(true); + expect(toolbar.classes.transitioning).toBe(true); triggerDocViewerEvent('docRendered'); fixture.detectChanges(); expect(component.isTransitioning).toBe(false); - expect(toolbar.classes['transitioning']).toBeFalsy(); + expect(toolbar.classes.transitioning).toBeFalsy(); }); it('should update the sidenav state as soon as a new document is inserted (but not before)', () => { @@ -1031,15 +1031,15 @@ describe('AppComponent', () => { navigateTo('guide/pipes'); expect(component.pageId).toEqual('guide-pipes'); - expect(container.properties['id']).toEqual('guide-pipes'); + expect(container.properties.id).toEqual('guide-pipes'); navigateTo('news'); expect(component.pageId).toEqual('news'); - expect(container.properties['id']).toEqual('news'); + expect(container.properties.id).toEqual('news'); navigateTo(''); expect(component.pageId).toEqual('home'); - expect(container.properties['id']).toEqual('home'); + expect(container.properties.id).toEqual('home'); }); it('should not be affected by changes to the query', () => { @@ -1050,7 +1050,7 @@ describe('AppComponent', () => { navigateTo('guide/other?search=http'); expect(component.pageId).toEqual('guide-other'); - expect(container.properties['id']).toEqual('guide-other'); + expect(container.properties.id).toEqual('guide-other'); }); }); @@ -1125,7 +1125,7 @@ describe('AppComponent', () => { function checkHostClass(type: string, value: string) { const host = fixture.debugElement; - const classes: string = host.properties['className']; + const classes: string = host.properties.className; const classArray = classes.split(' ').filter(c => c.indexOf(`${type}-`) === 0); expect(classArray.length).toBeLessThanOrEqual(1, `"${classes}" should have only one class matching ${type}-*`); expect(classArray).toEqual([`${type}-${value}`], `"${classes}" should contain ${type}-${value}`); diff --git a/aio/src/app/app.component.ts b/aio/src/app/app.component.ts index 42826349bf..bc07be2930 100644 --- a/aio/src/app/app.component.ts +++ b/aio/src/app/app.component.ts @@ -147,7 +147,7 @@ export class AppComponent implements OnInit { // Compute the version picker list from the current version and the versions in the navigation map combineLatest([ this.navigationService.versionInfo, - this.navigationService.navigationViews.pipe(map(views => views['docVersions'])), + this.navigationService.navigationViews.pipe(map(views => views.docVersions)), ]).subscribe(([versionInfo, versions]) => { // TODO(pbd): consider whether we can lookup the stable and next versions from the internet const computedVersions: NavigationNode[] = [ @@ -167,10 +167,10 @@ export class AppComponent implements OnInit { }); this.navigationService.navigationViews.subscribe(views => { - this.footerNodes = views['Footer'] || []; - this.sideNavNodes = views['SideNav'] || []; - this.topMenuNodes = views['TopBar'] || []; - this.topMenuNarrowNodes = views['TopBarNarrow'] || this.topMenuNodes; + this.footerNodes = views.Footer || []; + this.sideNavNodes = views.SideNav || []; + this.topMenuNodes = views.TopBar || []; + this.topMenuNarrowNodes = views.TopBarNarrow || this.topMenuNodes; }); this.navigationService.versionInfo.subscribe(vi => this.versionInfo = vi); diff --git a/aio/src/app/custom-elements/code/pretty-printer.service.ts b/aio/src/app/custom-elements/code/pretty-printer.service.ts index 8df9665dc9..0f234dd787 100644 --- a/aio/src/app/custom-elements/code/pretty-printer.service.ts +++ b/aio/src/app/custom-elements/code/pretty-printer.service.ts @@ -20,13 +20,13 @@ export class PrettyPrinter { } private getPrettyPrintOne(): Promise { - const ppo = (window as any)['prettyPrintOne']; + const ppo = (window as any).prettyPrintOne; return ppo ? Promise.resolve(ppo) : // `prettyPrintOne` is not on `window`, which means `prettify.js` has not been loaded yet. // Import it; ad a side-effect it will add `prettyPrintOne` on `window`. import('assets/js/prettify.js' as any) .then( - () => (window as any)['prettyPrintOne'], + () => (window as any).prettyPrintOne, err => { const msg = `Cannot get prettify.js from server: ${err.message}`; this.logger.error(new Error(msg)); diff --git a/aio/src/app/custom-elements/contributor/contributor-list.component.spec.ts b/aio/src/app/custom-elements/contributor/contributor-list.component.spec.ts index 72f110ce29..ccf426558a 100644 --- a/aio/src/app/custom-elements/contributor/contributor-list.component.spec.ts +++ b/aio/src/app/custom-elements/contributor/contributor-list.component.spec.ts @@ -63,7 +63,7 @@ describe('ContributorListComponent', () => { it('should set the query to the "GDE" group when user selects "GDE"', () => { component = getComponent(); component.selectGroup('GDE'); - expect(locationService.searchResult['group']).toBe('GDE'); + expect(locationService.searchResult.group).toBe('GDE'); }); it('should set the query to the first group when user selects unknown name', () => { @@ -71,7 +71,7 @@ describe('ContributorListComponent', () => { component.selectGroup('GDE'); // a legit group that isn't the first component.selectGroup('foo'); // not a legit group name - expect(locationService.searchResult['group']).toBe('Angular'); + expect(locationService.searchResult.group).toBe('Angular'); }); //// Test Helpers //// diff --git a/aio/src/app/custom-elements/contributor/contributor-list.component.ts b/aio/src/app/custom-elements/contributor/contributor-list.component.ts index e6887d5ac9..fd0116fe97 100644 --- a/aio/src/app/custom-elements/contributor/contributor-list.component.ts +++ b/aio/src/app/custom-elements/contributor/contributor-list.component.ts @@ -29,7 +29,7 @@ export class ContributorListComponent implements OnInit { private locationService: LocationService) { } ngOnInit() { - const groupName = this.locationService.search()['group'] || ''; + const groupName = this.locationService.search().group || ''; // no need to unsubscribe because `contributors` completes this.contributorService.contributors .subscribe(grps => { diff --git a/aio/src/app/custom-elements/resource/resource-list.component.spec.ts b/aio/src/app/custom-elements/resource/resource-list.component.spec.ts index cfc2bbf554..11c31ff241 100644 --- a/aio/src/app/custom-elements/resource/resource-list.component.spec.ts +++ b/aio/src/app/custom-elements/resource/resource-list.component.spec.ts @@ -63,7 +63,7 @@ describe('ResourceListComponent', () => { it('should set the query to the "education" category when user selects "education"', () => { component = getComponent(); component.selectCategory('education'); - expect(locationService.searchResult['category']).toBe('education'); + expect(locationService.searchResult.category).toBe('education'); }); it('should set the query to the first category when user selects unknown name', () => { @@ -71,7 +71,7 @@ describe('ResourceListComponent', () => { component.selectCategory('education'); // a legit group that isn't the first component.selectCategory('foo'); // not a legit group name - expect(locationService.searchResult['category']).toBe('development'); + expect(locationService.searchResult.category).toBe('development'); }); //// Test Helpers //// diff --git a/aio/src/app/custom-elements/resource/resource-list.component.ts b/aio/src/app/custom-elements/resource/resource-list.component.ts index 6b48195fa8..63be0ec155 100644 --- a/aio/src/app/custom-elements/resource/resource-list.component.ts +++ b/aio/src/app/custom-elements/resource/resource-list.component.ts @@ -20,7 +20,7 @@ export class ResourceListComponent implements OnInit { } ngOnInit() { - const category = this.locationService.search()['category'] || ''; + const category = this.locationService.search().category || ''; // Not using async pipe because cats appear twice in template // No need to unsubscribe because categories observable completes. this.resourceService.categories.subscribe(cats => { diff --git a/aio/src/app/navigation/navigation.service.spec.ts b/aio/src/app/navigation/navigation.service.spec.ts index 028b357979..96fc80b95b 100644 --- a/aio/src/app/navigation/navigation.service.spec.ts +++ b/aio/src/app/navigation/navigation.service.spec.ts @@ -86,7 +86,7 @@ describe('NavigationService', () => { ]; beforeEach(() => { - navService.navigationViews.subscribe(views => view = views['sideNav']); + navService.navigationViews.subscribe(views => view = views.sideNav); httpMock.expectOne({}).flush({sideNav}); }); @@ -254,7 +254,7 @@ describe('NavigationService', () => { {...v, ...{ tooltip: v.title + '.'}}) ); - navService.navigationViews.subscribe(views => actualDocVersions = views['docVersions']); + navService.navigationViews.subscribe(views => actualDocVersions = views.docVersions); }); it('should extract the docVersions', () => { diff --git a/aio/src/app/search/search-box/search-box.component.ts b/aio/src/app/search/search-box/search-box.component.ts index 10b90866a2..741df09dd1 100644 --- a/aio/src/app/search/search-box/search-box.component.ts +++ b/aio/src/app/search/search-box/search-box.component.ts @@ -41,7 +41,7 @@ export class SearchBoxComponent implements AfterViewInit { * When we first show this search box we trigger a search if there is a search query in the URL */ ngAfterViewInit() { - const query = this.locationService.search()['search']; + const query = this.locationService.search().search; if (query) { this.query = this.decodeQuery(query); this.doSearch(); diff --git a/aio/src/app/shared/deployment.service.ts b/aio/src/app/shared/deployment.service.ts index 3a77b91c93..651f27cf46 100644 --- a/aio/src/app/shared/deployment.service.ts +++ b/aio/src/app/shared/deployment.service.ts @@ -11,7 +11,7 @@ export class Deployment { * The deployment mode set from the environment provided at build time; * or overridden by the `mode` query parameter: e.g. `...?mode=archive` */ - mode: string = this.location.search()['mode'] || environment.mode; + mode: string = this.location.search().mode || environment.mode; constructor(private location: LocationService) {} } diff --git a/aio/src/app/shared/ga.service.ts b/aio/src/app/shared/ga.service.ts index 65318f2a20..ec557cf2e9 100644 --- a/aio/src/app/shared/ga.service.ts +++ b/aio/src/app/shared/ga.service.ts @@ -14,7 +14,7 @@ export class GaService { private previousUrl: string; constructor(@Inject(WindowToken) private window: Window) { - this.ga('create', environment['gaId'] , 'auto'); + this.ga('create', environment.gaId , 'auto'); } locationChanged(url: string) { @@ -34,7 +34,7 @@ export class GaService { } ga(...args: any[]) { - const gaFn = (this.window as any)['ga']; + const gaFn = (this.window as any).ga; if (gaFn) { gaFn(...args); } diff --git a/aio/tslint.json b/aio/tslint.json index 07c0e2e9c2..fd04237249 100644 --- a/aio/tslint.json +++ b/aio/tslint.json @@ -62,7 +62,6 @@ "ignore-params" ], "no-redundant-jsdoc": true, - "no-string-literal": false, "no-switch-case-fall-through": true, "no-var-requires": false, "object-literal-key-quotes": false,