build(docs-infra): update the `object-literal-key-quotes` tslint rule to align with CLI (#39018)

This commit updates the `object-literal-key-quotes` 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:
George Kalpakas 2020-09-29 18:26:19 +03:00 committed by Joey Perrott
parent 2cc3ac0299
commit a7e1eb5312
4 changed files with 135 additions and 133 deletions

View File

@ -782,7 +782,7 @@ describe('AppComponent', () => {
it('should grab focus when the / key is pressed', () => { it('should grab focus when the / key is pressed', () => {
const searchBox: SearchBoxComponent = fixture.debugElement.query(By.directive(SearchBoxComponent)).componentInstance; const searchBox: SearchBoxComponent = fixture.debugElement.query(By.directive(SearchBoxComponent)).componentInstance;
spyOn(searchBox, 'focus'); spyOn(searchBox, 'focus');
window.document.dispatchEvent(new KeyboardEvent('keyup', { 'key': '/' })); window.document.dispatchEvent(new KeyboardEvent('keyup', { key: '/' }));
fixture.detectChanges(); fixture.detectChanges();
expect(searchBox.focus).toHaveBeenCalled(); expect(searchBox.focus).toHaveBeenCalled();
}); });
@ -791,7 +791,7 @@ describe('AppComponent', () => {
const searchBox: SearchBoxComponent = fixture.debugElement.query(By.directive(SearchBoxComponent)).componentInstance; const searchBox: SearchBoxComponent = fixture.debugElement.query(By.directive(SearchBoxComponent)).componentInstance;
spyOn(searchBox, 'focus'); spyOn(searchBox, 'focus');
component.showSearchResults = true; component.showSearchResults = true;
window.document.dispatchEvent(new KeyboardEvent('keyup', { 'key': 'Escape' })); window.document.dispatchEvent(new KeyboardEvent('keyup', { key: 'Escape' }));
fixture.detectChanges(); fixture.detectChanges();
expect(searchBox.focus).toHaveBeenCalled(); expect(searchBox.focus).toHaveBeenCalled();
}); });
@ -1311,42 +1311,42 @@ class TestHttpClient {
// tslint:disable:quotemark // tslint:disable:quotemark
navJson = { navJson = {
"TopBar": [ TopBar: [
{ {
"url": "features", url: 'features',
"title": "Features" title: 'Features',
}, },
{ {
"url": "no-title", url: 'no-title',
"title": "No Title" title: 'No Title',
}, },
], ],
"SideNav": [ SideNav: [
{ {
"title": "Core", title: 'Core',
"tooltip": "Learn the core capabilities of Angular", tooltip: 'Learn the core capabilities of Angular',
"children": [ children: [
{ {
"url": "guide/pipes", url: 'guide/pipes',
"title": "Pipes", title: 'Pipes',
"tooltip": "Pipes transform displayed values within a template." tooltip: 'Pipes transform displayed values within a template.',
}, },
{ {
"url": "guide/bags", url: 'guide/bags',
"title": "Bags", title: 'Bags',
"tooltip": "Pack your bags for a code adventure." tooltip: 'Pack your bags for a code adventure.',
} },
] ],
}, },
{ {
"url": "api", url: 'api',
"title": "API", title: 'API',
"tooltip": "Details of the Angular classes and values." tooltip: 'Details of the Angular classes and values.',
} },
], ],
"docVersions": TestHttpClient.docVersions, docVersions: TestHttpClient.docVersions,
"__versionInfo": TestHttpClient.versionInfo, __versionInfo: TestHttpClient.versionInfo,
}; };
get(url: string) { get(url: string) {

View File

@ -223,77 +223,77 @@ class TestApiService {
// tslint:disable:quotemark // tslint:disable:quotemark
const apiSections: ApiSection[] = [ const apiSections: ApiSection[] = [
{ {
"name": "common", name: 'common',
"title": "common", title: 'common',
"path": "api/common", path: 'api/common',
"deprecated": false, deprecated: false,
"items": [ items: [
{ {
"name": "class_1", name: 'class_1',
"title": "Class 1", title: 'Class 1',
"path": "api/common/class_1", path: 'api/common/class_1',
"docType": "class", docType: 'class',
"stability": "experimental", stability: 'experimental',
"securityRisk": false, securityRisk: false,
}, },
{ {
"name": "class_2", name: 'class_2',
"title": "Class 2", title: 'Class 2',
"path": "api/common/class_2", path: 'api/common/class_2',
"docType": "class", docType: 'class',
"stability": "stable", stability: 'stable',
"securityRisk": false, securityRisk: false,
}, },
{ {
"name": "directive_1", name: 'directive_1',
"title": "Directive 1", title: 'Directive 1',
"path": "api/common/directive_1", path: 'api/common/directive_1',
"docType": "directive", docType: 'directive',
"stability": "stable", stability: 'stable',
"securityRisk": true, securityRisk: true,
}, },
{ {
"name": "pipe_1", name: 'pipe_1',
"title": "Pipe 1", title: 'Pipe 1',
"path": "api/common/pipe_1", path: 'api/common/pipe_1',
"docType": "pipe", docType: 'pipe',
"stability": "stable", stability: 'stable',
"securityRisk": true, securityRisk: true,
}, },
] ],
}, },
{ {
"name": "core", name: 'core',
"title": "core", title: 'core',
"path": "api/core", path: 'api/core',
"deprecated": false, deprecated: false,
"items": [ items: [
{ {
"name": "class_3", name: 'class_3',
"title": "Class 3", title: 'Class 3',
"path": "api/core/class_3", path: 'api/core/class_3',
"docType": "class", docType: 'class',
"stability": "experimental", stability: 'experimental',
"securityRisk": false, securityRisk: false,
}, },
{ {
"name": "function_1", name: 'function_1',
"title": "Function 1", title: 'Function 1',
"path": "api/core/function 1", path: 'api/core/function 1',
"docType": "function", docType: 'function',
"stability": "deprecated", stability: 'deprecated',
"securityRisk": true, securityRisk: true,
}, },
{ {
"name": "const_1", name: 'const_1',
"title": "Const 1", title: 'Const 1',
"path": "api/core/const_1", path: 'api/core/const_1',
"docType": "const", docType: 'const',
"stability": "stable", stability: 'stable',
"securityRisk": false, securityRisk: false,
} },
] ],
} },
]; ];
function getApiSections() { return apiSections; } function getApiSections() { return apiSections; }

View File

@ -86,62 +86,61 @@ describe('ResourceService', () => {
}); });
function getTestResources() { function getTestResources() {
// tslint:disable:quotemark
return { return {
"Cat 3": { 'Cat 3': {
"order": 3, order: 3,
"subCategories": { subCategories: {
"Cat3 SubCat1": { 'Cat3 SubCat1': {
"order": 2, order: 2,
"resources": { resources: {
"Cat3 SubCat1 Res1": { 'Cat3 SubCat1 Res1': {
"desc": "Meetup in Barcelona, Spain. ", desc: 'Meetup in Barcelona, Spain. ',
"title": "Angular Beers", title: 'Angular Beers',
"url": "http://www.meetup.com/AngularJS-Beers/" url: 'http://www.meetup.com/AngularJS-Beers/',
}, },
"Cat3 SubCat1 Res2": { 'Cat3 SubCat1 Res2': {
"desc": "Angular Camps in Barcelona, Spain.", desc: 'Angular Camps in Barcelona, Spain.',
"title": "Angular Camp", title: 'Angular Camp',
"url": "http://angularcamp.org/" url: 'http://angularcamp.org/',
} },
} },
}, },
"Cat3 SubCat2": { 'Cat3 SubCat2': {
"order": 1, order: 1,
"resources": { resources: {
"Cat3 SubCat2 Res1": { 'Cat3 SubCat2 Res1': {
"desc": "A community index of components and libraries", desc: 'A community index of components and libraries',
"title": "Catalog of Angular Components & Libraries", title: 'Catalog of Angular Components & Libraries',
"url": "https://a/b/c" url: 'https://a/b/c',
}
}
},
}
},
"Cat 1": {
"order": 1,
"subCategories": {
"Cat1 SubCat1": {
"order": 1,
"resources": {
"S S S": {
"desc": "SSS",
"title": "Sssss",
"url": "http://s/s/s"
}, },
"A A A": { },
"desc": "AAA",
"title": "Aaaa",
"url": "http://a/a/a"
},
"Z Z Z": {
"desc": "ZZZ",
"title": "Zzzzz",
"url": "http://z/z/z"
}
}
}, },
}, },
} },
'Cat 1': {
order: 1,
subCategories: {
'Cat1 SubCat1': {
order: 1,
resources: {
'S S S': {
desc: 'SSS',
title: 'Sssss',
url: 'http://s/s/s',
},
'A A A': {
desc: 'AAA',
title: 'Aaaa',
url: 'http://a/a/a',
},
'Z Z Z': {
desc: 'ZZZ',
title: 'Zzzzz',
url: 'http://z/z/z',
},
},
},
},
},
}; };
} }

View File

@ -64,7 +64,10 @@
"no-redundant-jsdoc": true, "no-redundant-jsdoc": true,
"no-switch-case-fall-through": true, "no-switch-case-fall-through": true,
"no-var-requires": false, "no-var-requires": false,
"object-literal-key-quotes": false, "object-literal-key-quotes": [
true,
"as-needed"
],
"only-arrow-functions": false, "only-arrow-functions": false,
"quotemark": [ "quotemark": [
true, true,