From dbf057856f39f28ba9421f3948c3aa84754b181c Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:03:19 -0700 Subject: [PATCH] Enable more type checking settings --- build/intl-linter/utils/rule.ts | 8 +- package-lock.json | 113 ++++++++++-- package.json | 2 +- ts/state/smart/MessageDetail.tsx | 2 +- ts/util/lint/exceptions.json | 28 +++ tsconfig.json | 284 +++++++++++++++++++++++++------ 6 files changed, 367 insertions(+), 70 deletions(-) diff --git a/build/intl-linter/utils/rule.ts b/build/intl-linter/utils/rule.ts index f4bad3bb5dea..14d243c07fcd 100644 --- a/build/intl-linter/utils/rule.ts +++ b/build/intl-linter/utils/rule.ts @@ -1,13 +1,15 @@ // Copyright 2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import type { MessageFormatElement } from '@formatjs/icu-messageformat-parser'; -import { Location } from '@formatjs/icu-messageformat-parser'; +import type { + MessageFormatElement, + Location, +} from '@formatjs/icu-messageformat-parser'; import type { Visitor } from './traverse'; import { traverse } from './traverse'; export type Element = MessageFormatElement; -export { Location }; +export type { Location }; export type Context = { messageId: string; diff --git a/package-lock.json b/package-lock.json index d1352c1a8896..6fe6656f4e16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -248,7 +248,7 @@ "stylelint-use-logical-spec": "5.0.0", "svgo": "3.0.2", "terser-webpack-plugin": "5.1.1", - "ts-node": "8.3.0", + "ts-node": "10.9.2", "typed-scss-modules": "4.1.1", "typescript": "5.3.3", "unzipper": "0.10.14", @@ -2755,6 +2755,28 @@ "node": ">=0.1.90" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@csstools/css-parser-algorithms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.1.1.tgz", @@ -10484,6 +10506,30 @@ "node": ">=10.13.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, "node_modules/@tus/file-store": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@tus/file-store/-/file-store-1.4.0.tgz", @@ -16167,6 +16213,12 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-env": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-5.2.0.tgz", @@ -34827,25 +34879,58 @@ } }, "node_modules/ts-node": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.3.0.tgz", - "integrity": "sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "source-map-support": "^0.5.6", - "yn": "^3.0.0" + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" }, "bin": { - "ts-node": "dist/bin.js" - }, - "engines": { - "node": ">=4.2.0" + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" }, "peerDependencies": { - "typescript": ">=2.0" + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" } }, "node_modules/ts-node/node_modules/diff": { @@ -35800,6 +35885,12 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "node_modules/v8-to-istanbul": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", diff --git a/package.json b/package.json index 7152843558bc..5afb11c404f4 100644 --- a/package.json +++ b/package.json @@ -332,7 +332,7 @@ "stylelint-use-logical-spec": "5.0.0", "svgo": "3.0.2", "terser-webpack-plugin": "5.1.1", - "ts-node": "8.3.0", + "ts-node": "10.9.2", "typed-scss-modules": "4.1.1", "typescript": "5.3.3", "unzipper": "0.10.14", diff --git a/ts/state/smart/MessageDetail.tsx b/ts/state/smart/MessageDetail.tsx index 0236f49a305d..f267c1391ed9 100644 --- a/ts/state/smart/MessageDetail.tsx +++ b/ts/state/smart/MessageDetail.tsx @@ -22,7 +22,7 @@ import { useGlobalModalActions } from '../ducks/globalModals'; import { useLightboxActions } from '../ducks/lightbox'; import { useStoriesActions } from '../ducks/stories'; -export { Contact } from '../../components/conversation/MessageDetail'; +export type { Contact } from '../../components/conversation/MessageDetail'; export type OwnProps = Pick< MessageDetailProps, 'contacts' | 'errors' | 'message' | 'receivedAt' diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 086e33b8af5a..d409e376c030 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -15,6 +15,34 @@ "updated": "2018-09-18T19:19:27.699Z", "reasonDetail": "Part of runtime library for C++ transpiled code" }, + { + "rule": "eval", + "path": "node_modules/@cspotcode/source-map-support/source-map-support.js", + "line": " // Most eval() calls are in this format", + "reasonCategory": "usageTrusted", + "updated": "2024-09-26T18:39:25.816Z" + }, + { + "rule": "eval", + "path": "node_modules/@cspotcode/source-map-support/source-map-support.js", + "line": " // Parse nested eval() calls using recursion", + "reasonCategory": "usageTrusted", + "updated": "2024-09-26T18:39:25.816Z" + }, + { + "rule": "eval", + "path": "node_modules/@cspotcode/source-map-support/source-map-support.js", + "line": " // passed to eval() ending in \"//# sourceURL=...\" will return the source file", + "reasonCategory": "usageTrusted", + "updated": "2024-09-26T18:39:25.816Z" + }, + { + "rule": "eval", + "path": "node_modules/@cspotcode/source-map-support/source-map-support.js", + "line": " // Code called using eval() needs special handling", + "reasonCategory": "usageTrusted", + "updated": "2024-09-26T18:39:25.816Z" + }, { "rule": "eval", "path": "node_modules/@jest/fake-timers/node_modules/@sinonjs/commons/lib/function-name.test.js", diff --git a/tsconfig.json b/tsconfig.json index e1cdb81c2988..12ea5e514aaf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,66 +1,242 @@ { + "include": ["ts/**/*", "app/**/*", "package.json", "build/intl-linter/**/*"], "compilerOptions": { - // Basic Options - "target": "es2020", // Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. - "module": "commonjs", // Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. - // Specify library files to be included in the compilation. - "lib": [ - "dom", // Required to access `window` - "dom.iterable", - "es2022", - "esnext.disposable" // For `playwright` - ], + /* + * Visit https://aka.ms/tsconfig to read more about this file + */ + + /** + * Projects + */ + + /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ "incremental": true, - // "allowJs": true, // Allow javascript files to be compiled. - // "checkJs": true, // Report errors in .js files. - "jsx": "react", // Specify JSX code generation: 'preserve', 'react-native', or 'react'. - // "declaration": true, // Generates corresponding '.d.ts' file. - // "sourceMap": true, // Generates corresponding '.map' file. - // "outFile": "./", // Concatenate and emit output to single file. - // "outDir": "./", // Redirect output structure to the directory. - "rootDir": "./", // Specify the root directory of input files. Use to control the output directory structure with --outDir. - // "removeComments": true, // Do not emit comments to output. - // "noEmit": true, // Do not emit outputs. - // "importHelpers": true, // Import emit helpers from 'tslib'. - // "downlevelIteration": true, // Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. - // "isolatedModules": true, // Transpile each file as a separate module (similar to 'ts.transpileModule'). + /* Enable constraints that allow a TypeScript project to be used with project references. */ + "composite": true, + /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "tsBuildInfoFile": "./.tsbuildinfo", + /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSourceOfProjectReferenceRedirect": true, + /* Opt a project out of multi-project reference checking when editing. */ + // "disableSolutionSearching": true, + /* Reduce the number of projects loaded automatically by TypeScript. */ + // "disableReferencedProjectLoad": true, - // Strict Type-Checking Options - "strict": true, // Enable all strict type-checking options. + /** + * Language and Environment + */ - // As a temporary measure - "useUnknownInCatchVariables": false, - // Temp: The `assertDev()` function doesn't run in production so we can't rely on this - "allowUnreachableCode": true, + /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "target": "ES2020", + /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "lib": [ + "DOM", // Required to access `window` + "DOM.Iterable", + "ES2022", + "ESNext.Disposable" // For `playwright` + ], + /* Specify what JSX code is generated. */ + "jsx": "react", + /* Enable experimental support for legacy experimental decorators. */ + // "experimentalDecorators": true, + /* Emit design-type metadata for decorated declarations in source files. */ + // "emitDecoratorMetadata": true, + /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFactory": "", + /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxFragmentFactory": "", + /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "jsxImportSource": "", + /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "reactNamespace": "", + /* Disable including any library files, including the default lib.d.ts. */ + // "noLib": true, + /* Emit ECMAScript-standard-compliant class fields. */ + "useDefineForClassFields": true, + /* Control what method is used to detect module-format JS files. */ + // "moduleDetection": "auto", - // Additional Checks - "noUnusedLocals": true, // Report errors on unused locals. - "noUnusedParameters": true, // Report errors on unused parameters. - "noImplicitOverride": true, // Require explicit "override" keyword in subclasses. - "noImplicitReturns": true, // Report error when not all code paths in function return a value. - "noFallthroughCasesInSwitch": true, // Report errors for fallthrough cases in switch statement. + /** + * Modules + */ - // Module Resolution Options - "moduleResolution": "node", // Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). + /* Specify what module code is generated. */ + "module": "ES2022", + /* Specify the root folder within your source files. */ + "rootDir": "./", + /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "Node", + /* Specify the base directory to resolve non-relative module names. */ + // "baseUrl": "./", + /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "paths": {}, + /* Allow multiple folders to be treated as one when resolving modules. */ + // "rootDirs": [], + /* Specify multiple folders that act like './node_modules/@types'. */ + // "typeRoots": [], + /* Specify type package names to be included without being referenced in a source file. */ + // "types": [], + /* Allow accessing UMD globals from modules. */ + // "allowUmdGlobalAccess": true, + /* List of file name suffixes to search when resolving a module. */ + // "moduleSuffixes": [], + /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "allowImportingTsExtensions": true, + /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonExports": true, + /* Use the package.json 'imports' field when resolving imports. */ + // "resolvePackageJsonImports": true, + /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "customConditions": [], + /* Check side effect imports. */ + // "noUncheckedSideEffectImports": true, // TODO: Enable after upgrading to TypeScript 5.6 + /* Enable importing .json files. */ "resolveJsonModule": true, - // "baseUrl": "./", // Base directory to resolve non-absolute module names. - // "paths": {}, // A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. - // "rootDirs": [], // List of root folders whose combined content represents the structure of the project at runtime. - // "typeRoots": [], // List of folders to include type definitions from. - // "types": [], // Type declaration files to be included in compilation. - // "allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export. This does not affect code emit, just typechecking. - "esModuleInterop": true // Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. - // "preserveSymlinks": true, // Do not resolve the real path of symlinks. + /* Enable importing files with any extension, provided a declaration file is present. */ + // "allowArbitraryExtensions": true, + /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + // "noResolve": true, - // Source Map Options - // "sourceRoot": "./", // Specify the location where debugger should locate TypeScript files instead of source locations. - // "mapRoot": "./", // Specify the location where debugger should locate map files instead of generated locations. - // "inlineSourceMap": true, // Emit a single file with source maps instead of having a separate file. - // "inlineSources": true, // Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. + /** + * JavaScript Support + */ - // Experimental Options - // "experimentalDecorators": true, // Enables experimental support for ES7 decorators. - // "emitDecoratorMetadata": true, // Enables experimental support for emitting type metadata for decorators. + /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "allowJs": true, + /* Enable error reporting in type-checked JavaScript files. */ + // "checkJs": true, + /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + // "maxNodeModuleJsDepth": 1, + + /** + * Emit + */ + + /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declaration": true, + /* Create sourcemaps for d.ts files. */ + // "declarationMap": true, + /* Only output d.ts files and not JavaScript files. */ + // "emitDeclarationOnly": true, + /* Create source map files for emitted JavaScript files. */ + // "sourceMap": true, + /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSourceMap": true, + /* Disable emitting files from a compilation. */ + "noEmit": true, + /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outFile": "./", + /* Specify an output folder for all emitted files. */ + // "outDir": "./", + /* Disable emitting comments. */ + // "removeComments": true, + /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importHelpers": true, + /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "downlevelIteration": true, + /* Specify the root path for debuggers to find the reference source code. */ + // "sourceRoot": "", + /* Specify the location where debugger should locate map files instead of generated locations. */ + // "mapRoot": "", + /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "inlineSources": true, + /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "emitBOM": true, + /* Set the newline character for emitting files. */ + // "newLine": "crlf", + /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "stripInternal": true, + /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitHelpers": true, + /* Disable emitting files if any type checking errors are reported. */ + // "noEmitOnError": true, + /* Disable erasing 'const enum' declarations in generated code. */ + // "preserveConstEnums": true, + /* Specify the output directory for generated declaration files. */ + // "declarationDir": "./", + + /** + * Interop Constraints + */ + + /* Ensure that each file can be safely transpiled without relying on other imports. */ + "isolatedModules": true, + /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "verbatimModuleSyntax": true, + /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */ + // "isolatedDeclarations": true, // TODO: Enable after upgrading to TypeScript 5.5 + /* Allow 'import x from y' when a module doesn't have a default export. */ + // "allowSyntheticDefaultImports": true, + /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "esModuleInterop": true, + /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + // "preserveSymlinks": true, + /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true, + + /** + * Type Checking + */ + + /* Enable all strict type-checking options. */ + "strict": true, + /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "noImplicitAny": true, // (default: strict) + /* When type checking, take into account 'null' and 'undefined'. */ + "strictNullChecks": true, // (default: strict) + /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + "strictFunctionTypes": true, // (default: strict) + /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + "strictBindCallApply": true, // (default: strict) + /* Check for class properties that are declared but not set in the constructor. */ + "strictPropertyInitialization": true, // (default: strict) + /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */ + // "strictBuiltinIteratorReturn": true, // TODO: Enable after upgrading to TypeScript 5.6 + /* Enable error reporting when 'this' is given the type 'any'. */ + "noImplicitThis": true, // (default: strict) + /* Default catch clause variables as 'unknown' instead of 'any'. */ + "useUnknownInCatchVariables": false, // TODO: Migration needed + /* Ensure 'use strict' is always emitted. */ + "alwaysStrict": true, // (default: strict) + /* Enable error reporting when local variables aren't read. */ + "noUnusedLocals": true, + /* Raise an error when a function parameter isn't read. */ + "noUnusedParameters": true, + /* Interpret optional property types as written, rather than adding 'undefined'. */ + "exactOptionalPropertyTypes": false, // TODO: Major migration needed + /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noImplicitReturns": true, + /* Enable error reporting for fallthrough cases in switch statements. */ + "noFallthroughCasesInSwitch": true, + /* Add 'undefined' to a type when accessed using an index. */ + "noUncheckedIndexedAccess": false, // TODO: Major migration needed + /* Ensure overriding members in derived classes are marked with an override modifier. */ + "noImplicitOverride": true, + /* Enforces using indexed accessors for keys declared using an indexed type. */ + "noPropertyAccessFromIndexSignature": false, // TODO: Migration needed + /* Disable error reporting for unused labels. */ + "allowUnusedLabels": false, + /* Disable error reporting for unreachable code. */ + "allowUnreachableCode": true, // TODO: Turn off when `assertDev` is removed + + /** + * Completeness + */ + + /* Skip type checking .d.ts files that are included with TypeScript. */ + // "skipDefaultLibCheck": true, + /* Skip type checking all .d.ts files. */ + "skipLibCheck": true }, - "include": ["ts/**/*", "app/**/*", "package.json", "build/intl-linter/**/*"] + + /** + * ts-node + */ + "ts-node": { + // Override TypeScript options for `ts-node` only + "compilerOptions": { + // Necessary for `ts-node` to work with CommonJS modules until we migrate to package.json#type: "module" + "module": "CommonJS" + } + } }