Simplify entire template

This commit is contained in:
Igor Barcik 2024-03-04 14:57:00 +01:00
parent 0db84248a4
commit ef0c6e9c99
25 changed files with 242 additions and 7477 deletions

View File

@ -1,13 +0,0 @@
module.exports = {
env: { browser: true, es2020: true },
plugins: ["prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/stylistic-type-checked",
"prettier",
],
rules: { "prettier/prettier": "error" },
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
};

View File

@ -1,13 +0,0 @@
module.exports = {
env: { browser: true, es2020: true },
plugins: ["prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/stylistic-type-checked",
"prettier",
],
rules: { "prettier/prettier": "error" },
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
};

View File

@ -1,22 +1,22 @@
{ {
"arrowParens": "always", "arrowParens": "always",
"bracketSameLine": false, "bracketSameLine": false,
"endOfLine": "lf",
"printWidth": 130,
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "all",
"bracketSpacing": true, "bracketSpacing": true,
"embeddedLanguageFormatting": "auto", "embeddedLanguageFormatting": "auto",
"endOfLine": "lf",
"experimentalTernaries": false, "experimentalTernaries": false,
"htmlWhitespaceSensitivity": "css", "htmlWhitespaceSensitivity": "css",
"insertPragma": false, "insertPragma": false,
"jsxSingleQuote": true, "jsxSingleQuote": true,
"printWidth": 130,
"proseWrap": "preserve", "proseWrap": "preserve",
"quoteProps": "as-needed", "quoteProps": "as-needed",
"requirePragma": false, "requirePragma": false,
"semi": true,
"singleAttributePerLine": false, "singleAttributePerLine": false,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "all",
"useTabs": false, "useTabs": false,
"vueIndentScriptAndStyle": false "vueIndentScriptAndStyle": false
} }

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"liveServer.settings.multiRootWorkspaceName": "adientlab-launcher",
"cmake.configureOnOpen": false
}

BIN
bun.lockb

Binary file not shown.

View File

@ -1,25 +1,26 @@
{ {
"name": "client", "dependencies": {
"private": true, "react": "^18.2.0",
"version": "0.0.0", "react-dom": "^18.2.0"
"type": "module", },
"scripts": { "devDependencies": {
"dev": "vite", "@tsconfig/vite-react": "^3.0.0",
"build": "tsc && vite build", "@types/react": "^18.2.56",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "@types/react-dom": "^18.2.19",
"preview": "vite preview" "@vitejs/plugin-react": "^4.2.1",
}, "eslint-plugin-react": "^7.33.2",
"dependencies": { "eslint-plugin-react-hooks": "^4.6.0",
"react": "^18.2.0", "eslint-plugin-react-refresh": "^0.4.5",
"react-dom": "^18.2.0" "vite": "^5.1.4"
}, },
"devDependencies": { "name": "client",
"@types/react": "^18.2.56", "private": true,
"@types/react-dom": "^18.2.19", "scripts": {
"@vitejs/plugin-react": "^4.2.1", "build": "tsc && vite build",
"eslint-plugin-react": "^7.33.2", "dev": "vite",
"eslint-plugin-react-hooks": "^4.6.0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"eslint-plugin-react-refresh": "^0.4.5", "preview": "vite preview"
"vite": "^5.1.4" },
} "type": "module",
"version": "0.0.0"
} }

8
client/postcss.config.js Normal file
View File

@ -0,0 +1,8 @@
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: [tailwindcss(), autoprefixer()],
};
export default config;

View File

@ -1,8 +1,38 @@
import { useEffect, useState } from "react";
import { remult } from "remult";
import { LauncherEntry } from "@root/../shared/LauncherEntry";
const launcherRepo = remult.repo(LauncherEntry);
function App() { function App() {
const [apps, setApps] = useState<LauncherEntry[]>([]);
useEffect(() => {
launcherRepo.find().then(setApps);
}, []);
return ( return (
<> <>
<div id='message_bar'>Message</div> {apps.map((app) => (
<div id='apps'>Apps</div> <a
href={app.url}
target='_blank'
rel='noreferrer'
style={{
textDecoration: "none",
color: "white",
backgroundColor: "green",
padding: "10px",
margin: "10px",
display: "inline-block",
}}
key={app.id}
>
<div key={app.id}>
<h1>{app.name}</h1>
<p>{app.description}</p>
<img src={app.iconUrl} alt={app.name} style={{ width: "128px", height: "128px" }} />
</div>
</a>
))}
</> </>
); );
} }

View File

@ -0,0 +1,4 @@
export default {
content: ["./src/**/*.{js,ts,jsx,tsx}"],
plugins: [require("daisyui")],
};

View File

@ -1,15 +1,39 @@
{ {
// What should be compiled
"include": [
"src/**/*",
],
// Single files that should be compiled
"files": [
"vite.config.ts",
],
"compilerOptions": { "compilerOptions": {
"target": "ESNext", // Specifying ECMAScript targets for the compiler
"target": "ESNext",
"module": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
// Enabling options for better interoperability and module handling
"moduleResolution": "Bundler",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
// Configuring behavior for JSX, specific to React
"jsx": "react-jsx", // Transform JSX for React 17+ JSX Transform
// Strengthening type-checking and ensuring consistency
"strict": true, // Enable all strict type-checking options
"strictNullChecks": true, // Enable strict null checks
"noUnusedLocals": true, // Disallow unused local variables
"noUnusedParameters": true, // Disallow unused function parameters
"noFallthroughCasesInSwitch": true, // Prevent fallthrough cases in switch statements
"forceConsistentCasingInFileNames": true, // Ensure consistent file naming
// Improving project robustness
"isolatedModules": true, // Ensure correct transpiling of files
"noErrorTruncation": true, // Show full type error messages
"useDefineForClassFields": true, // Align class field behavior with the standard
// Configuring project build process
"allowJs": true, // Allow JavaScript files to be imported
"skipLibCheck": true, // Skip type checking of declaration files
"noEmit": true, // Vite handles the emitting of files
"paths": {
"@root/*": ["./*"],
"@/*": ["./src/*"]
} // Allow absolute imports from src. Create a path alias for the root directory - @root
}, },
// Extend the base configuration // Specifying folders and files to include in compilation
"extends": "../tsconfig-base.json", "include": ["src/**/*", "server/index.ts", "server/services"],
// Excluding certain directories from the compilation
"exclude": ["node_modules"]
} }

View File

@ -7,5 +7,10 @@
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"strict": true "strict": true
}, },
"include": ["vite.config.ts"] "include": [
"vite.config.ts",
],
"ts-node": {
"esm": true
}
} }

View File

@ -1,9 +1,19 @@
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
import { defineConfig } from "vite"; import { defineConfig, loadEnv } from "vite";
import path from "path";
// https://vitejs.dev/config/ // https://vitejs.dev/config/
/** @type {import('vite').UserConfig} */
export default defineConfig({ export default ({ mode }) => {
server: { proxy: { "/api": "http://localhost:3000" } }, process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
plugins: [react()], return defineConfig({
}); resolve: {
alias: {
"@root": path.resolve(__dirname, "./"),
"@": path.resolve(__dirname, "./src"),
},
},
plugins: [react()],
server: { proxy: { "/api": "http://localhost:3000" } },
});
};

View File

@ -4,14 +4,14 @@ import tseslint from "typescript-eslint";
/** @type {import('eslint').Linter.FlatConfig[]} */ /** @type {import('eslint').Linter.FlatConfig[]} */
export default [ export default [
eslintPluginJs.configs.recommended, eslintPluginJs.configs.recommended,
...tseslint.configs.recommendedTypeChecked, ...tseslint.configs.recommended,
...tseslint.configs.stylisticTypeChecked, ...tseslint.configs.stylistic,
eslintPluginPrettierRecommended, eslintPluginPrettierRecommended,
{ {
ignores: ["node_modules/", "dist/", "build/", "coverage/", "public/", "**/eslint.config.js"], ignores: ["node_modules/", "dist/", "build/", "coverage/", "public/", "**/eslint.config.js"],
languageOptions: { languageOptions: {
parserOptions: { parserOptions: {
project: ["./shared/tsconfig.json", "./server/tsconfig.json", "./client/tsconfig.json"], project: ["tsconfig.json", "./client/tsconfig.json"],
tsconfigRootDir: "./", tsconfigRootDir: "./",
}, },
}, },

7100
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,26 +1,32 @@
{ {
"name": "nodejs-sandbox", "dependencies": {
"version": "1.0.0", "remult": "^0.25.5"
},
"description": "", "description": "",
"devDependencies": {
"@types/eslint": "^8.56.5",
"@types/node": "^20.11.24",
"autoprefixer": "^10.4.17",
"daisyui": "latest",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"postcss": "^8.4.35",
"prettier": "^3.2.5",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"tsx": "^4.7.1",
"typescript": "^5.3.3",
"typescript-eslint": "^7.1.0"
},
"license": "MIT", "license": "MIT",
"type": "module", "name": "nodejs-sandbox",
"private": true, "private": true,
"type": "module",
"version": "1.0.0",
"workspaces": [ "workspaces": [
"client", "client",
"server", "server",
"shared" "shared"
], ]
"dependencies": {
"remult": "^0.24.1"
},
"devDependencies": {
"@types/eslint": "^8.56.5",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"tsx": "4.7.0",
"typescript": "^5.3.3",
"typescript-eslint": "^7.1.0"
}
} }

View File

@ -1,21 +1,6 @@
import { remultExpress } from "remult/remult-express"; import { remultExpress } from "remult/remult-express";
import { createKnexDataProvider } from "remult/remult-knex"; import { LauncherEntry } from "../shared/LauncherEntry";
import { LauncherEntry } from "shared/LauncherEntry";
export const api = remultExpress({ export const api = remultExpress({
dataProvider: createKnexDataProvider({
client: "mssql",
connection: {
server: "192.168.55.10",
database: "test",
user: "sa",
password: "zaq1@WSX",
options: {
enableArithAbort: true,
encrypt: false,
instanceName: `sqlexpress`,
},
},
}),
entities: [LauncherEntry], entities: [LauncherEntry],
}); });

View File

@ -1,24 +0,0 @@
import express, { Router } from "express";
export const auth = Router();
auth.use(express.json());
auth.post("/api/signIn", (req, res) => {
const validUsers = [
{ id: "1", name: "Manager", roles: ["admin"] },
{ id: "2", name: "SalesRep" },
];
const user = validUsers.find((user) => user.name === req.body.username);
if (user) {
req.session.user = user;
res.json(user);
} else {
res.sendStatus(403);
}
});
auth.post("/api/signOut", (req, res) => {
req.session.user = null;
res.json("signed out");
});

View File

@ -1,28 +1,16 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import express from "express"; import express from "express";
import session from "cookie-session";
import { auth } from "./auth.js";
import { api } from "./api.js";
import swaggerUi from "swagger-ui-express"; import swaggerUi from "swagger-ui-express";
import { api } from "./api.js";
const app = express(); const app = express();
app.set("trust proxy", 1);
app.use((req, res, next) => {
session({
secret: "shhhhhhhhhhh",
sameSite: req.secure ? "none" : undefined,
})(req, res, next);
});
app.use(auth);
app.use(api); app.use(api);
const openApiDocument = api.openApiDoc({ title: "My API" }); const openApiDocument = api.openApiDoc({ title: "My API" });
app.get("/api/openApi.json", (req, res) => res.json(openApiDocument)); app.get("/api/openApi.json", (_, res) => res.json(openApiDocument));
app.use("/api/docs", swaggerUi.serve, swaggerUi.setup(openApiDocument)); app.use("/api/docs", swaggerUi.serve, swaggerUi.setup(openApiDocument));
app.listen(3000, () => { app.listen(3000, () => {
console.log("Server started"); console.log("Server started");
console.log("OpenAPI spec at http://localhost:3000/api/openApi.json");
console.log("Swagger UI at http://localhost:3000/api/docs/");
}); });

View File

@ -1,10 +1,4 @@
{ {
"name": "server",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "tsx watch index.ts"
},
"dependencies": { "dependencies": {
"cookie-session": "^2.0.0", "cookie-session": "^2.0.0",
"express": "^4.18.2", "express": "^4.18.2",
@ -17,5 +11,11 @@
"@types/cookie-session": "^2.0.48", "@types/cookie-session": "^2.0.48",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/swagger-ui-express": "^4.1.6" "@types/swagger-ui-express": "^4.1.6"
} },
"name": "server",
"private": true,
"scripts": {
"dev": "tsx watch index.ts"
},
"version": "0.0.0"
} }

View File

@ -1,6 +0,0 @@
{
"include": [
"./**/*.ts"
],
"extends": "./tsconfig-base.json",
}

View File

@ -2,10 +2,20 @@ import { Entity, Fields } from "remult";
@Entity("LauncherEntry", { allowApiCrud: true, dbName: "core.launcher" }) @Entity("LauncherEntry", { allowApiCrud: true, dbName: "core.launcher" })
export class LauncherEntry { export class LauncherEntry {
@Fields.uuid() @Fields.autoIncrement()
id!: string; id!: string;
@Fields.string() @Fields.string()
url!: string; url!: string;
@Fields.string() @Fields.string()
name!: string; name!: string;
@Fields.string()
description?: string;
@Fields.string()
iconUrl?: string;
@Fields.boolean()
enabled = true;
@Fields.createdAt()
createdDate!: Date;
@Fields.updatedAt()
modifiedDate!: Date;
} }

View File

@ -1,101 +0,0 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
"experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "NodeNext", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* 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. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": 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. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

View File

@ -1,101 +0,0 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
"composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
"experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "NodeNext", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* 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. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": 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. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

View File

@ -1,7 +1,54 @@
{ {
// This is based on https://bun.sh/docs/typescript#suggested-compileroptions
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Bun",
"docs": "https://bun.sh/docs/typescript",
"compilerOptions": { "compilerOptions": {
"experimentalDecorators": true, // Enable latest features
"esModuleInterop": true, "lib": [
"composite": true "ESNext"
],
"target": "ESNext",
"module": "NodeNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "NodeNext",
"allowImportingTsExtensions": true,
// "verbatimModuleSyntax": true, // It breaks importing CommonJS modules
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags
"noUnusedLocals": true,
"noUnusedParameters": true,
// "noPropertyAccessFromIndexSignature": true // Ugly method of accessing properties `obj['prop']`
// My rules
"experimentalDecorators": true, // remult required
"paths": {
"@shared/*": [
"./shared/*"
],
"@server/*": [
"./server/*"
],
"@client/*": [
"./client/*"
]
}
}, },
"include": [
"shared/**/*",
"server/**/*",
],
"exclude": [
"node_modules",
"dist",
"build",
"coverage",
"client"
]
} }