From fc3c461011998607fa6132884a5bca4161882500 Mon Sep 17 00:00:00 2001 From: puku0x Date: Thu, 16 Dec 2021 00:59:16 +0900 Subject: [PATCH] feat(js): update complier options for strict mode --- packages/js/src/generators/library/library.spec.ts | 12 ++++++++++-- packages/js/src/utils/project-generator.ts | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/js/src/generators/library/library.spec.ts b/packages/js/src/generators/library/library.spec.ts index eca0d346d16c9..ba7ca5849d087 100644 --- a/packages/js/src/generators/library/library.spec.ts +++ b/packages/js/src/generators/library/library.spec.ts @@ -131,7 +131,9 @@ describe('lib', () => { "forceConsistentCasingInFileNames": true, "module": "CommonJS", "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": true, "strict": true, }, "extends": "../../tsconfig.base.json", @@ -250,7 +252,7 @@ describe('lib', () => { }); }); - describe('--strict', () => { + describe('--no-strict', () => { it('should update the projects tsconfig with strict false', async () => { await libraryGenerator(tree, { ...defaultOptions, @@ -259,10 +261,16 @@ describe('lib', () => { }); const tsconfigJson = readJson(tree, '/libs/my-lib/tsconfig.json'); - expect(tsconfigJson.compilerOptions?.strict).not.toBeDefined(); expect( tsconfigJson.compilerOptions?.forceConsistentCasingInFileNames ).not.toBeDefined(); + expect(tsconfigJson.compilerOptions?.strict).not.toBeDefined(); + expect( + tsconfigJson.compilerOptions?.noImplicitOverride + ).not.toBeDefined(); + expect( + tsconfigJson.compilerOptions?.noPropertyAccessFromIndexSignature + ).not.toBeDefined(); expect( tsconfigJson.compilerOptions?.noImplicitReturns ).not.toBeDefined(); diff --git a/packages/js/src/utils/project-generator.ts b/packages/js/src/utils/project-generator.ts index 410529d95dcb6..cd1d2cb3387af 100644 --- a/packages/js/src/utils/project-generator.ts +++ b/packages/js/src/utils/project-generator.ts @@ -143,6 +143,8 @@ function updateTsConfig(tree: Tree, options: NormalizedSchema) { ...json.compilerOptions, forceConsistentCasingInFileNames: true, strict: true, + noImplicitOverride: true, + noPropertyAccessFromIndexSignature: true, noImplicitReturns: true, noFallthroughCasesInSwitch: true, };