Skip to content

Commit

Permalink
chore: improved tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Oct 11, 2023
1 parent 9652991 commit d697e48
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 94 deletions.
4 changes: 3 additions & 1 deletion packages/audit-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/index.mjs"
},
"./server": {
"types": "./dist/server.d.ts",
"require": "./dist/server.js",
"import": "./dist/server.mjs"
},
Expand Down Expand Up @@ -39,7 +41,7 @@
"bundle": false,
"platform": "node",
"treeshake": true,
"target": "node16",
"target": "node18",
"silent": true,
"format": [
"cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/audit-logger/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import superjson from "superjson";
import type { AuditLogActions } from "./index";
import { captureException } from "@sentry/node";
import { AuditLog as _AuditLog } from "@snailycad/types";
import type { AuditLog as _AuditLog } from "@snailycad/types";

export * from "./types/action-types";
export * from "./types/actions";
Expand Down
12 changes: 4 additions & 8 deletions packages/audit-logger/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
"declaration": true,
"resolveJsonModule": true
},
"exclude": ["dist", "node_modules"]
"moduleResolution": "Bundler",
"module": "ESNext",
"noEmit": true
}
}
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"bundle": false,
"platform": "node",
"treeshake": true,
"target": "node16",
"target": "node18",
"silent": true,
"format": [
"cjs",
Expand Down
11 changes: 4 additions & 7 deletions packages/config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
"declaration": true
},
"exclude": ["dist", "node_modules"]
"moduleResolution": "Bundler",
"module": "ESNext",
"noEmit": true
}
}
4 changes: 3 additions & 1 deletion packages/permissions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/index.mjs"
},
"./permissions": {
"types": "./dist/permissions.d.ts",
"require": "./dist/permissions.js",
"import": "./dist/permissions.mjs"
},
Expand Down Expand Up @@ -42,7 +44,7 @@
"dts": true,
"bundle": false,
"platform": "node",
"target": "node16",
"target": "node18",
"treeshake": true,
"silent": true,
"format": [
Expand Down
12 changes: 4 additions & 8 deletions packages/permissions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
"declaration": true,
"skipLibCheck": true
},
"exclude": ["dist", "node_modules"]
"moduleResolution": "Bundler",
"module": "ESNext",
"noEmit": true
}
}
4 changes: 3 additions & 1 deletion packages/schemas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/index.mjs"
},
"./dist/*": {
"types": "./dist/*.d.ts",
"require": "./dist/*.js",
"import": "./dist/*.mjs"
},
Expand Down Expand Up @@ -39,7 +41,7 @@
"dts": true,
"bundle": false,
"platform": "node",
"target": "node16",
"target": "node18",
"treeshake": true,
"silent": true,
"minify": true,
Expand Down
13 changes: 4 additions & 9 deletions packages/schemas/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
"declaration": true,
"skipLibCheck": true,
"importHelpers": true
},
"exclude": ["dist", "node_modules"]
"moduleResolution": "Bundler",
"module": "ESNext",
"noEmit": true
}
}
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"dts": true,
"bundle": false,
"platform": "node",
"target": "node16",
"target": "node18",
"silent": true,
"treeshake": true,
"format": [
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type * as Prisma from "./prisma/index";
import type * as Types from "./index.js";
import { GetEmsFdActiveDeputy } from "./api.js";
import { GetActiveOfficerData } from "./api.js";
import type { GetEmsFdActiveDeputy } from "./api.js";
import type { GetActiveOfficerData } from "./api.js";

export * from "./api/admin.js";
export * from "./api/dispatch.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Permissions } from "@snailycad/permissions";
import type * as Prisma from "./prisma/index";
import type * as Enums from "./enums";
import { CadFeatureOptions } from "./lib/cad-feature";
import type { CadFeatureOptions } from "./lib/cad-feature";

export * from "./enums";
export * from "./lib/cad-feature";
Expand Down Expand Up @@ -402,7 +402,7 @@ type _Record = Prisma.Record & {
release?: Partial<RecordRelease> | null;
call911?: Pick<Call911, "caseNumber"> | null;
};
export { _Record as Record };
export type { _Record as Record };

export type RecordRelease = Prisma.RecordRelease & {
releasedBy: Citizen | null;
Expand Down
12 changes: 4 additions & 8 deletions packages/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
"declaration": true,
"skipLibCheck": true
},
"exclude": ["dist", "node_modules"]
"moduleResolution": "Bundler",
"module": "ESNext",
"noEmit": true
}
}
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"dts": true,
"bundle": false,
"platform": "node",
"target": "node16",
"target": "node18",
"silent": true,
"treeshake": true,
"format": [
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/editor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ declare module "slate" {

export * from "./types";
export { slateDataToString } from "./slate-data-to-string";
export { Descendant };
export type { Descendant };
2 changes: 1 addition & 1 deletion packages/utils/src/editor/slate-data-to-string.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */

import { Editor, Element as SlateElement, Descendant } from "slate";
import { Editor, Element as SlateElement, type Descendant } from "slate";

export function slateDataToString(data: Descendant[] | null) {
const string: string[] = [];
Expand Down
38 changes: 19 additions & 19 deletions packages/utils/src/typeguards.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import {
ValueType,
Value,
VehicleValue,
WeaponValue,
StatusValue,
DepartmentValue,
DivisionValue,
EmployeeValue,
DriversLicenseCategoryValue,
Officer,
CombinedLeoUnit,
EmsFdDeputy,
QualificationValue,
CallTypeValue,
PenalCode,
AnyValue,
ValueWithValueObj,
AddressValue,
EmergencyVehicleValue,
CombinedEmsFdUnit,
type Value,
type VehicleValue,
type WeaponValue,
type StatusValue,
type DepartmentValue,
type DivisionValue,
type EmployeeValue,
type DriversLicenseCategoryValue,
type Officer,
type CombinedLeoUnit,
type EmsFdDeputy,
type QualificationValue,
type CallTypeValue,
type PenalCode,
type AnyValue,
type ValueWithValueObj,
type AddressValue,
type EmergencyVehicleValue,
type CombinedEmsFdUnit,
} from "@snailycad/types";

export function isPenalCodeValue(value: AnyValue): value is PenalCode {
Expand Down
14 changes: 4 additions & 10 deletions packages/utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"target": "ESNext",
"module": "CommonJS",
"moduleResolution": "node",
"declaration": true,
"skipLibCheck": true,
"importHelpers": true,
"esModuleInterop": true
},
"exclude": ["dist", "node_modules"]
"moduleResolution": "Bundler",
"module": "ESNext",
"noEmit": true
}
}
33 changes: 21 additions & 12 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
{
"exclude": ["dist", "node_modules", ".dev-data", ".data"],
"compilerOptions": {
"strict": true /* Enable all strict type-checking options. */,
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
"strictNullChecks": true /* Enable strict null checks. */,
"strictFunctionTypes": true /* Enable strict checking of function types. */,
"strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */,
"strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
/* Basic Options */
"esModuleInterop": true,
"skipLibCheck": true,
"verbatimModuleSyntax": false,
"target": "es2022",
"verbatimModuleSyntax": true,
"allowJs": true,
"resolveJsonModule": true,
"moduleDetection": "force",

/* Strict */
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"pretty": true,

/* Additional Checks */
Expand All @@ -18,7 +27,7 @@
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
"noUncheckedIndexedAccess": true /* Include 'undefined' in index signature results */,
"allowUnreachableCode": false
},
"exclude": ["dist", "node_modules", ".dev-data", ".data"]
"allowUnreachableCode": false,
"lib": ["es2022"]
}
}

0 comments on commit d697e48

Please sign in to comment.