Skip to content

Commit

Permalink
chore(devtools): add shared typescript config (#943)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil authored Feb 6, 2025
1 parent 88b916d commit 07b88f5
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 67 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=packages/core/package.json,target=packages/core/package.json \
--mount=type=bind,source=packages/crisp/package.json,target=packages/crisp/package.json \
--mount=type=bind,source=packages/debounce/package.json,target=packages/debounce/package.json \
--mount=type=bind,source=packages/devtools/typescript/package.json,target=packages/devtools/typescript/package.json \
--mount=type=bind,source=packages/email/package.json,target=packages/email/package.json \
--mount=type=bind,source=packages/identite/package.json,target=packages/identite/package.json \
--mount=type=bind,source=packages/insee/package.json,target=packages/insee/package.json \
Expand All @@ -25,6 +26,7 @@ RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=packages/core/package.json,target=packages/core/package.json \
--mount=type=bind,source=packages/crisp/package.json,target=packages/crisp/package.json \
--mount=type=bind,source=packages/debounce/package.json,target=packages/debounce/package.json \
--mount=type=bind,source=packages/devtools/typescript/package.json,target=packages/devtools/typescript/package.json \
--mount=type=bind,source=packages/email/package.json,target=packages/email/package.json \
--mount=type=bind,source=packages/identite/package.json,target=packages/identite/package.json \
--mount=type=bind,source=packages/insee/package.json,target=packages/insee/package.json \
Expand Down
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"main": "src/index.js",
"workspaces": [
"packages/devtools/typescript",
"packages/core",
"packages/crisp",
"packages/debounce",
Expand Down Expand Up @@ -53,6 +54,7 @@
]
},
"dependencies": {
"@gouvfr-lasuite/proconnect.devtools.typescript": "workspace:*",
"@gouvfr-lasuite/proconnect.core": "workspace:*",
"@gouvfr-lasuite/proconnect.debounce": "workspace:*",
"@gouvfr-lasuite/proconnect.crisp": "workspace:*",
Expand Down
11 changes: 2 additions & 9 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"outDir": "./dist",
"rootDir": "src",
"types": ["node", "./types"],
"module": "NodeNext",
"moduleResolution": "nodenext",
"verbatimModuleSyntax": true,
"paths": {
"#src/*": ["./src/*"]
}
"types": ["node", "./types"]
},
"extends": "@tsconfig/node22/tsconfig.json",
"extends": "@gouvfr-lasuite/proconnect.devtools.typescript/base/tsconfig.json",
"references": []
}
6 changes: 1 addition & 5 deletions packages/crisp/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"outDir": "./dist",
"types": ["node"],
"module": "NodeNext",
"moduleResolution": "nodenext",
"verbatimModuleSyntax": true,
"paths": {
"#src/*": ["./src/*"]
}
},
"extends": "@tsconfig/node22/tsconfig.json",
"extends": "@gouvfr-lasuite/proconnect.devtools.typescript/base/tsconfig.json",
"include": ["src", "test"],
"references": []
}
4 changes: 3 additions & 1 deletion packages/debounce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"license": "MIT",
"sideEffects": false,
"type": "module",
"imports": {},
"imports": {
"#src/types": "./src/types/index.ts"
},
"exports": {
"./api": {
"require": "./dist/api/index.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/debounce/src/api/single-validation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//

import type { DebounceSuccessResponse } from "#src/types/index.js";
import type { DebounceSuccessResponse } from "#src/types";
import axios, { type AxiosRequestConfig, type AxiosResponse } from "axios";

//
Expand Down
11 changes: 2 additions & 9 deletions packages/debounce/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"outDir": "./dist",
"rootDir": "src",
"types": ["node"],
"module": "NodeNext",
"moduleResolution": "nodenext",
"verbatimModuleSyntax": true,
"paths": {
"#src/*": ["./src/*"]
}
"types": ["node"]
},
"extends": "@tsconfig/node22/tsconfig.json",
"extends": "@gouvfr-lasuite/proconnect.devtools.typescript/base/tsconfig.json",
"references": []
}
26 changes: 26 additions & 0 deletions packages/devtools/typescript/base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "ProConnect Base",
"extends": "@tsconfig/strictest/tsconfig.json",
"compilerOptions": {
"checkJs": false,
"composite": true,
"esModuleInterop": true,
// TODO(douglasduteil): remove this line
// We might want to acticate exactOptionalPropertyTypes
"exactOptionalPropertyTypes": false,
"ignoreDeprecations": "5.0",
"isolatedModules": true,
"lib": ["ESNext"],
"module": "NodeNext",
"moduleResolution": "nodenext",
"noImplicitReturns": false,
// TODO(douglasduteil): remove this line
// We might want to acticate noUncheckedIndexedAccess
"noUncheckedIndexedAccess": false,
"preserveWatchOutput": true,
"target": "ESNext",
"types": [],
"verbatimModuleSyntax": true,
}
}
10 changes: 10 additions & 0 deletions packages/devtools/typescript/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@gouvfr-lasuite/proconnect.devtools.typescript",
"version": "0.0.0",
"private": true,
"type": "module",
"files": [],
"dependencies": {
"@tsconfig/strictest": "2.0.5"
}
}
13 changes: 2 additions & 11 deletions packages/email/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"composite": true,
"esModuleInterop": true,
Expand All @@ -11,21 +10,13 @@
"module": "Preserve",
"moduleResolution": "Bundler",
"noEmitOnError": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"plugins": [{ "name": "@kitajs/ts-html-plugin" }],
"preserveSymlinks": true,
"preserveWatchOutput": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"strictNullChecks": true,
"target": "ESNext",
"types": ["vite/client"],
"verbatimModuleSyntax": true
"types": ["vite/client"]
},
"extends": "@gouvfr-lasuite/proconnect.devtools.typescript/base/tsconfig.json",
"files": [],
"include": ["src/**/*.ts", "src/**/*.tsx", ".storybook/**/*.tsx"],
"references": []
Expand Down
12 changes: 2 additions & 10 deletions packages/identite/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"module": "NodeNext",
"moduleResolution": "nodenext",
"outDir": "./dist",
"resolveJsonModule": true,
"rootDir": "src",
"types": ["node"],
"verbatimModuleSyntax": true,
"paths": {
"#src/*": ["./src/*"]
}
"types": ["node"]
},
"extends": "@tsconfig/node22/tsconfig.json",
"extends": "@gouvfr-lasuite/proconnect.devtools.typescript/base/tsconfig.json",
"references": [
{ "path": "../core/tsconfig.lib.json" },
{ "path": "../insee/tsconfig.lib.json" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//

import { codesEffectifs } from "#src/data";
import type { TrancheEffectifs } from "#src/types/tranche-effectifs.js";
import type { TrancheEffectifs } from "#src/types";

//

Expand Down
11 changes: 2 additions & 9 deletions packages/insee/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"outDir": "./dist",
"rootDir": "src",
"types": ["node"],
"module": "NodeNext",
"moduleResolution": "nodenext",
"verbatimModuleSyntax": true,
"paths": {
"#src/*": ["./src/*"]
}
"types": ["node"]
},
"extends": "@tsconfig/node22/tsconfig.json",
"extends": "@gouvfr-lasuite/proconnect.devtools.typescript/base/tsconfig.json",
"references": []
}
17 changes: 6 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,23 @@
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"jsx": "react-jsx",
"jsxImportSource": "@kitajs/html",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "react-jsx",
"jsxImportSource": "@kitajs/html",
"module": "Preserve",
"moduleResolution": "Bundler",
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "./build",
"resolveJsonModule": true,
"rootDir": ".",
"verbatimModuleSyntax": true
"resolveJsonModule": true
},
"exclude": ["packages/*", "build/*"],
"exclude": ["packages/*", "build/*", "dist/*"],
"include": ["src"],
"references": [
{ "path": "./packages/core/tsconfig.lib.json" },
{ "path": "./packages/email/tsconfig.lib.json" },
{ "path": "./packages/identite/tsconfig.lib.json" },
{ "path": "./packages/insee/tsconfig.lib.json" }
],
"extends": "@tsconfig/node22/tsconfig.json"
"extends": "@gouvfr-lasuite/proconnect.devtools.typescript/base/tsconfig.json"
}

0 comments on commit 07b88f5

Please sign in to comment.