build(docs-infra): remove the `no-string-literal` tslint rule to align with CLI (#39018)
This commit removes the `no-string-literal: false` tslint rule to more closely align `tslint.json` with the one generated by the latest Angular CLI for new apps. PR Close #39018
This commit is contained in:
parent
be98a45dd9
commit
2cc3ac0299
|
@ -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}`);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -20,13 +20,13 @@ export class PrettyPrinter {
|
|||
}
|
||||
|
||||
private getPrettyPrintOne(): Promise<PrettyPrintOne> {
|
||||
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));
|
||||
|
|
|
@ -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 ////
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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 ////
|
||||
|
|
|
@ -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 => {
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue