From 56753edbcdae873323cad730776f9a266c06c73c Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sun, 9 Jun 2024 10:59:42 -0700 Subject: [PATCH] tsconfig: Organize and sort options consistently. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Organize and sort the options in tsconfig.json according to the way they’re listed at https://www.typescriptlang.org/tsconfig/. Signed-off-by: Anders Kaseorg --- tsconfig.json | 45 +++++++++++++++++++--------------------- web/shared/tsconfig.json | 32 ++++++++++++++-------------- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 2654700d81..51e4c368b6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,48 +1,45 @@ { "compilerOptions": { + /* Type Checking */ + "exactOptionalPropertyTypes": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noUncheckedIndexedAccess": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, + + /* Modules */ + "moduleResolution": "node", "paths": { "*": ["./web/src/types/*"], }, + "resolveJsonModule": true, "types": ["@types/jquery.validation"], - /* TypeScript 3.4 added the --incremental flag but its API is not - * currently public so ts-loader cannot use it yet. - * Tracking issue: https://github.com/microsoft/TypeScript/issues/29978 - */ - // "incremental": true, - - /* Basic options */ + /* Emit */ "noEmit": true, - "target": "ESNext", - "esModuleInterop": true, - "moduleResolution": "node", - "resolveJsonModule": true, - /* Strict type-checking */ - "strict": true, - "exactOptionalPropertyTypes": true, + /* Interop Constraints */ + "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "isolatedModules": true, - "noImplicitOverride": true, - "noUncheckedIndexedAccess": true, - /* Additional checks */ - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, + /* Language and Environment */ + "target": "ESNext", }, "exclude": [ - /* Type stubs are not part of the top-level project. */ + // Type stubs are not part of the top-level project. "web/src/types", - /* Skip walking large generated directories. */ + // Skip walking large generated directories. "docs/_build", "static/webpack-bundles", "var", "zulip-py3-venv", - /* Even though allowJs defaults to false, typescript-eslint forces it to true. */ + // Even though allowJs defaults to false, typescript-eslint forces it to true. "**/*.js", ], } diff --git a/web/shared/tsconfig.json b/web/shared/tsconfig.json index 22da0f8de4..cdec0229f8 100644 --- a/web/shared/tsconfig.json +++ b/web/shared/tsconfig.json @@ -1,32 +1,32 @@ { "compilerOptions": { - /* Language and Environment */ - "target": "esnext", + /* Type Checking */ + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "strict": true, /* Modules */ - "rootDir": "src", "moduleResolution": "node", + "rootDir": "src", + + /* Emit */ + "declaration": true, + "outDir": "lib", + "sourceMap": true, /* JavaScript Support */ "allowJs": true, - /* Emit */ - "declaration": true, - "sourceMap": true, - "outDir": "lib", - /* Interop Constraints */ - "isolatedModules": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, + "isolatedModules": true, - /* Type Checking */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "noImplicitOverride": true, + /* Language and Environment */ + "target": "esnext", }, "include": ["src"], }