diff --git a/exporters/js/tsconfig.json b/exporters/js/tsconfig.json index 47838b39ae..f08d7ccd8a 100644 --- a/exporters/js/tsconfig.json +++ b/exporters/js/tsconfig.json @@ -1,33 +1,5 @@ { - "compileOnSave": true, - "compilerOptions": { - "baseUrl": ".", - "outDir": "./dist", - "sourceMap": true, - "declaration": true, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "module": "es2015", - "target": "es2015", - "noEmit": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "resolveJsonModule": true, - "noImplicitReturns": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "alwaysStrict": true, - "forceConsistentCasingInFileNames": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "strictFunctionTypes": true, - "noImplicitAny": true, - "esModuleInterop": true, - "typeRoots": ["../../node_modules/@types"], - "lib": ["es2015", "dom", "dom.iterable"], - "types": ["node", "jest", "@testing-library/jest-dom"] - }, + "extends": "../../configs/typescript-config-spirit/dom", "include": ["./src/**/*"], "exclude": ["./node_modules", "./dist/**/*"] } diff --git a/exporters/scss/tsconfig.json b/exporters/scss/tsconfig.json index 47838b39ae..f08d7ccd8a 100644 --- a/exporters/scss/tsconfig.json +++ b/exporters/scss/tsconfig.json @@ -1,33 +1,5 @@ { - "compileOnSave": true, - "compilerOptions": { - "baseUrl": ".", - "outDir": "./dist", - "sourceMap": true, - "declaration": true, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "module": "es2015", - "target": "es2015", - "noEmit": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "resolveJsonModule": true, - "noImplicitReturns": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "alwaysStrict": true, - "forceConsistentCasingInFileNames": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "strictFunctionTypes": true, - "noImplicitAny": true, - "esModuleInterop": true, - "typeRoots": ["../../node_modules/@types"], - "lib": ["es2015", "dom", "dom.iterable"], - "types": ["node", "jest", "@testing-library/jest-dom"] - }, + "extends": "../../configs/typescript-config-spirit/dom", "include": ["./src/**/*"], "exclude": ["./node_modules", "./dist/**/*"] } diff --git a/exporters/tokens/tsconfig.json b/exporters/tokens/tsconfig.json index 47838b39ae..f08d7ccd8a 100644 --- a/exporters/tokens/tsconfig.json +++ b/exporters/tokens/tsconfig.json @@ -1,33 +1,5 @@ { - "compileOnSave": true, - "compilerOptions": { - "baseUrl": ".", - "outDir": "./dist", - "sourceMap": true, - "declaration": true, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "module": "es2015", - "target": "es2015", - "noEmit": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "resolveJsonModule": true, - "noImplicitReturns": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "alwaysStrict": true, - "forceConsistentCasingInFileNames": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "strictFunctionTypes": true, - "noImplicitAny": true, - "esModuleInterop": true, - "typeRoots": ["../../node_modules/@types"], - "lib": ["es2015", "dom", "dom.iterable"], - "types": ["node", "jest", "@testing-library/jest-dom"] - }, + "extends": "../../configs/typescript-config-spirit/dom", "include": ["./src/**/*"], "exclude": ["./node_modules", "./dist/**/*"] } diff --git a/packages/analytics/tsconfig.json b/packages/analytics/tsconfig.json index b55100bbf7..593597e632 100644 --- a/packages/analytics/tsconfig.json +++ b/packages/analytics/tsconfig.json @@ -1,31 +1,8 @@ { - "compileOnSave": true, + "extends": "../../configs/typescript-config-spirit/base", "compilerOptions": { - "moduleResolution": "node", - "baseUrl": ".", - "outDir": "./dist", - "sourceMap": true, - "declaration": true, - "noEmit": true, - "removeComments": true, - "noEmitOnError": true, - "forceConsistentCasingInFileNames": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "strictFunctionTypes": true, - "resolveJsonModule": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noImplicitReturns": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "noImplicitAny": true, - "esModuleInterop": true, - "skipLibCheck": true, - "typeRoots": ["../../node_modules/@types"], - "types": ["node", "jest"], + // Specify what module code is generated. + // @see: https://www.typescriptlang.org/tsconfig/#module "module": "es2020" }, "include": ["./src/**/*"], diff --git a/packages/codemods/tsconfig.json b/packages/codemods/tsconfig.json index 2faa1cec55..778d21686e 100644 --- a/packages/codemods/tsconfig.json +++ b/packages/codemods/tsconfig.json @@ -1,31 +1,6 @@ { - "compileOnSave": true, + "extends": "../../configs/typescript-config-spirit/base", "compilerOptions": { - "moduleResolution": "node", - "baseUrl": ".", - "sourceMap": true, - "declaration": true, - "noEmit": true, - "removeComments": true, - "noEmitOnError": true, - "forceConsistentCasingInFileNames": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "strictFunctionTypes": true, - "resolveJsonModule": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noImplicitReturns": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "noImplicitAny": true, - "esModuleInterop": true, - "skipLibCheck": true, - "typeRoots": ["../../node_modules/@types"], - "types": ["node", "jest"], - "module": "es2020", "target": "es2020" }, "include": ["./src/**/*"], diff --git a/packages/common/tsconfig.json b/packages/common/tsconfig.json index 7fddbedf05..a859184ea2 100644 --- a/packages/common/tsconfig.json +++ b/packages/common/tsconfig.json @@ -1,32 +1,5 @@ { - "compileOnSave": true, - "compilerOptions": { - "moduleResolution": "node", - "baseUrl": ".", - "sourceMap": true, - "declaration": true, - "noEmit": true, - "removeComments": true, - "noEmitOnError": true, - "forceConsistentCasingInFileNames": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "strictFunctionTypes": true, - "resolveJsonModule": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noImplicitReturns": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "noImplicitAny": true, - "esModuleInterop": true, - "skipLibCheck": true, - "typeRoots": ["../../node_modules/@types"], - "types": ["node", "jest"], - "module": "es2020" - }, + "extends": "../../configs/typescript-config-spirit/base", "include": ["./", "./.eslintrc.js"], "exclude": ["./node_modules"] } diff --git a/packages/design-tokens/tsconfig.json b/packages/design-tokens/tsconfig.json index 60b58ca314..8c7369eb29 100644 --- a/packages/design-tokens/tsconfig.json +++ b/packages/design-tokens/tsconfig.json @@ -1,8 +1,4 @@ { - "compilerOptions": { - "types": ["node"], - "noEmit": true, - "moduleResolution": "node" - }, + "extends": "../../configs/typescript-config-spirit/base", "include": ["src/**/*"] } diff --git a/packages/form-validations/config/tsconfig.prod.json b/packages/form-validations/config/tsconfig.prod.json index 0d760cfd02..ffbbbe8b52 100644 --- a/packages/form-validations/config/tsconfig.prod.json +++ b/packages/form-validations/config/tsconfig.prod.json @@ -1,8 +1,6 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "module": "es2015", - "target": "es2015", "noEmit": false }, "exclude": ["../docs/**/*", "../src/**/__tests__/**/*"] diff --git a/packages/form-validations/tsconfig.json b/packages/form-validations/tsconfig.json index 4e34b044ee..d0fc04495b 100644 --- a/packages/form-validations/tsconfig.json +++ b/packages/form-validations/tsconfig.json @@ -1,32 +1,13 @@ { - "compileOnSave": true, + "extends": "../../configs/typescript-config-spirit/dom", "compilerOptions": { - "baseUrl": ".", + // Specify an output folder for all emitted files. + // @see: https://www.typescriptlang.org/tsconfig/#outDir "outDir": "./dist/js", - "sourceMap": true, - "declaration": true, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "module": "es2015", - "target": "es2015", - "noEmit": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "resolveJsonModule": true, - "noImplicitReturns": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "alwaysStrict": true, - "forceConsistentCasingInFileNames": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "strictFunctionTypes": true, - "noImplicitAny": true, - "esModuleInterop": true, - "typeRoots": ["../../node_modules/@types"], - "lib": ["es2015", "dom", "dom.iterable"], - "types": ["node", "jest", "@testing-library/jest-dom"] + + // Enable error reporting when 'this' is given the type 'any'. + // @see: https://www.typescriptlang.org/tsconfig/#noImplicitThis + "noImplicitThis": false }, "include": ["./src/**/*"], "exclude": ["./node_modules", "./dist/**/*"] diff --git a/packages/web-react/tsconfig.json b/packages/web-react/tsconfig.json index c74262afcd..02d6d170cf 100644 --- a/packages/web-react/tsconfig.json +++ b/packages/web-react/tsconfig.json @@ -1,31 +1,17 @@ { - "compileOnSave": true, + "extends": "../../configs/typescript-config-spirit/dom", "compilerOptions": { - "baseUrl": ".", - "outDir": "./dist", - "sourceMap": true, - "declaration": true, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "noEmit": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "resolveJsonModule": true, - "noImplicitReturns": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "alwaysStrict": true, + // Specify what JSX code is generated. + // @see: https://www.typescriptlang.org/tsconfig/#jsx "jsx": "react", - "forceConsistentCasingInFileNames": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "strictFunctionTypes": true, - "noImplicitAny": true, - "esModuleInterop": true, - "skipLibCheck": true, - "lib": ["es2016", "dom", "dom.iterable"], - "types": ["jest", "node"] + + // Specify what module code is generated. + // @see: https://www.typescriptlang.org/tsconfig/#module + "module": "nodenext", + + // Specify how TypeScript looks up a file from a given module specifier. + // @see: https://www.typescriptlang.org/tsconfig/#moduleResolution + "moduleResolution": "nodenext" }, "include": ["./src/**/*"], "exclude": ["./node_modules", "./dist/**/*"] diff --git a/packages/web/config/tsconfig.prod.json b/packages/web/config/tsconfig.prod.json index 0d760cfd02..686db09bfd 100644 --- a/packages/web/config/tsconfig.prod.json +++ b/packages/web/config/tsconfig.prod.json @@ -1,9 +1,8 @@ { "extends": "../tsconfig.json", "compilerOptions": { - "module": "es2015", - "target": "es2015", "noEmit": false }, + "include": ["../src/js/*"], "exclude": ["../docs/**/*", "../src/**/__tests__/**/*"] } diff --git a/packages/web/src/js/utils/ComponentFunctions.ts b/packages/web/src/js/utils/ComponentFunctions.ts index eb1ab41038..7f3e40446d 100644 --- a/packages/web/src/js/utils/ComponentFunctions.ts +++ b/packages/web/src/js/utils/ComponentFunctions.ts @@ -15,7 +15,7 @@ const onClickHandler = ( event: Event, aim: Aim = 'target', ) => { - EventHandler.on(element, 'click', function handleClick() { + EventHandler.on(element, 'click', function handleClick(this: unknown) { const target = getTriggerOrTarget(getElement(this), aim); const instance = component.getOrCreateInstance(target); diff --git a/packages/web/tsconfig.json b/packages/web/tsconfig.json index 4e34b044ee..f08d7ccd8a 100644 --- a/packages/web/tsconfig.json +++ b/packages/web/tsconfig.json @@ -1,33 +1,5 @@ { - "compileOnSave": true, - "compilerOptions": { - "baseUrl": ".", - "outDir": "./dist/js", - "sourceMap": true, - "declaration": true, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "module": "es2015", - "target": "es2015", - "noEmit": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "resolveJsonModule": true, - "noImplicitReturns": true, - "allowUnreachableCode": false, - "allowSyntheticDefaultImports": true, - "alwaysStrict": true, - "forceConsistentCasingInFileNames": true, - "noUnusedParameters": false, - "noUnusedLocals": true, - "strictFunctionTypes": true, - "noImplicitAny": true, - "esModuleInterop": true, - "typeRoots": ["../../node_modules/@types"], - "lib": ["es2015", "dom", "dom.iterable"], - "types": ["node", "jest", "@testing-library/jest-dom"] - }, + "extends": "../../configs/typescript-config-spirit/dom", "include": ["./src/**/*"], "exclude": ["./node_modules", "./dist/**/*"] }