refactor(docs-infra): fix docs examples for tslint rules related to object properties (#38143)

This commit updates the docs examples to be compatible with the
`no-string-literal`, `object-literal-key-quotes` and
`object-literal-shorthand` tslint rules.

This is in preparation of updating the docs examples `tslint.json` to
match the one generated for new Angular CLI apps in a future commit.

PR Close #38143
This commit is contained in:
George Kalpakas
2020-07-30 13:03:14 +03:00
committed by Alex Rickabaugh
parent d4a723a464
commit ff72da60d3
44 changed files with 78 additions and 88 deletions

View File

@ -40,8 +40,8 @@ export class ConfigComponent {
this.configService.getConfig_1()
// #docregion v1, v1_callback
.subscribe((data: Config) => this.config = {
heroesUrl: data['heroesUrl'],
textfile: data['textfile']
heroesUrl: data.heroesUrl,
textfile: data.textfile
});
// #enddocregion v1_callback
}

View File

@ -16,7 +16,7 @@ import { HttpErrorHandler, HandleError } from '../http-error-handler.service';
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': 'my-auth-token'
Authorization: 'my-auth-token'
})
};
// #enddocregion http-options

View File

@ -22,13 +22,13 @@ import './testing/http-client.spec.ts';
bootstrap();
//
function bootstrap () {
if (window['jasmineRef']) {
function bootstrap() {
if ((window as any).jasmineRef) {
location.reload();
return;
} else {
window.onload(undefined);
window['jasmineRef'] = jasmine.getEnv();
(window as any).jasmineRef = jasmine.getEnv();
}
// First, initialize the Angular testing environment.

View File

@ -1,3 +1,3 @@
import jasmineRequire from 'jasmine-core/lib/jasmine-core/jasmine.js';
window['jasmineRequire'] = jasmineRequire;
(window as any).jasmineRequire = jasmineRequire;

View File

@ -73,7 +73,7 @@ describe('HttpClient testing', () => {
// Make an HTTP GET request with specific header
httpClient.get<Data>(testUrl, {
headers: new HttpHeaders({'Authorization': 'my-auth-token'})
headers: new HttpHeaders({Authorization: 'my-auth-token'})
})
.subscribe(data =>
expect(data).toEqual(testData)