Skip to content

Commit

Permalink
feat(js): update complier options for strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
puku0x committed Dec 15, 2021
1 parent 385512a commit fc3c461
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/js/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ describe('lib', () => {
"forceConsistentCasingInFileNames": true,
"module": "CommonJS",
"noFallthroughCasesInSwitch": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noPropertyAccessFromIndexSignature": true,
"strict": true,
},
"extends": "../../tsconfig.base.json",
Expand Down Expand Up @@ -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,
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions packages/js/src/utils/project-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ function updateTsConfig(tree: Tree, options: NormalizedSchema) {
...json.compilerOptions,
forceConsistentCasingInFileNames: true,
strict: true,
noImplicitOverride: true,
noPropertyAccessFromIndexSignature: true,
noImplicitReturns: true,
noFallthroughCasesInSwitch: true,
};
Expand Down

0 comments on commit fc3c461

Please sign in to comment.