@layerzerolabs/typescript-configuration 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +14 -0
- package/tsconfig.base.json +51 -0
- package/tsconfig.bundler.json +30 -0
- package/tsconfig.frontend.json +25 -0
- package/tsconfig.next.json +23 -0
- package/tsconfig.node.json +30 -0
- package/tsconfig.react.json +27 -0
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@layerzerolabs/typescript-configuration",
|
|
3
|
+
"version": "0.0.9",
|
|
4
|
+
"private": false,
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@types/node": "^22.13.13",
|
|
7
|
+
"@types/react": "^19.0.12",
|
|
8
|
+
"@types/react-dom": "^19.0.4"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "restricted",
|
|
12
|
+
"registry": "https://registry.npmjs.org/"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Default",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
// JavaScript Language Level Configuration
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"target": "ES2022",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"checkJs": false,
|
|
11
|
+
|
|
12
|
+
// Module Configuration
|
|
13
|
+
"module": "CommonJS",
|
|
14
|
+
"moduleResolution": "Node",
|
|
15
|
+
|
|
16
|
+
// Source Map and Declaration Settings
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"declarationMap": true,
|
|
20
|
+
"incremental": true,
|
|
21
|
+
"composite": false,
|
|
22
|
+
"inlineSources": false,
|
|
23
|
+
|
|
24
|
+
// Strict Type Checking
|
|
25
|
+
"strict": true,
|
|
26
|
+
"noImplicitAny": true,
|
|
27
|
+
"isolatedModules": false,
|
|
28
|
+
"noImplicitThis": true,
|
|
29
|
+
"useUnknownInCatchVariables": true,
|
|
30
|
+
"alwaysStrict": true,
|
|
31
|
+
"strictNullChecks": true,
|
|
32
|
+
|
|
33
|
+
// Code Quality Checks
|
|
34
|
+
"noUnusedLocals": true,
|
|
35
|
+
"noUnusedParameters": true,
|
|
36
|
+
"noFallthroughCasesInSwitch": true,
|
|
37
|
+
"forceConsistentCasingInFileNames": true,
|
|
38
|
+
|
|
39
|
+
// Module Interop Settings
|
|
40
|
+
"allowSyntheticDefaultImports": true,
|
|
41
|
+
"esModuleInterop": true,
|
|
42
|
+
"skipLibCheck": true,
|
|
43
|
+
|
|
44
|
+
// Decorator Support
|
|
45
|
+
"experimentalDecorators": true,
|
|
46
|
+
"emitDecoratorMetadata": true,
|
|
47
|
+
|
|
48
|
+
// Development Experience
|
|
49
|
+
"preserveWatchOutput": true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Bundler",
|
|
4
|
+
/**
|
|
5
|
+
* Use this configuration for:
|
|
6
|
+
* - Packages that use bundlers (tsup, webpack, etc.)
|
|
7
|
+
* - Libraries that will be bundled before being consumed
|
|
8
|
+
*
|
|
9
|
+
* Note on module resolution:
|
|
10
|
+
* The bundler/ESNext configuration provides better compatibility with
|
|
11
|
+
* both ESM and CommonJS modules. Modern bundlers can handle both
|
|
12
|
+
* formats efficiently, making this the ideal choice for packages
|
|
13
|
+
* that will be bundled.
|
|
14
|
+
*
|
|
15
|
+
* Common indicators:
|
|
16
|
+
* - Presence of tsup.config.ts
|
|
17
|
+
* - Package is a shared library
|
|
18
|
+
*
|
|
19
|
+
* Do NOT use this for:
|
|
20
|
+
* - Direct Node.js applications without bundling
|
|
21
|
+
* - Scripts that run directly with node
|
|
22
|
+
* Use tsconfig.node.json instead for those cases
|
|
23
|
+
*/
|
|
24
|
+
"extends": "./tsconfig.node.json",
|
|
25
|
+
"compilerOptions": {
|
|
26
|
+
// Modern bundler settings
|
|
27
|
+
"module": "ESNext",
|
|
28
|
+
"moduleResolution": "bundler"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Frontend Base",
|
|
4
|
+
/**
|
|
5
|
+
* Use this configuration for:
|
|
6
|
+
* - Frontend/browser-based applications and libraries
|
|
7
|
+
* - React components and UI libraries
|
|
8
|
+
* - Any code that runs in the browser
|
|
9
|
+
*
|
|
10
|
+
* Note on module resolution:
|
|
11
|
+
* We use ESNext/bundler because frontend code is always bundled
|
|
12
|
+
* and modern frontend tooling (webpack, vite, etc.) works best
|
|
13
|
+
* with this configuration.
|
|
14
|
+
*/
|
|
15
|
+
"extends": "./tsconfig.base.json",
|
|
16
|
+
"compilerOptions": {
|
|
17
|
+
// Frontend-specific module settings
|
|
18
|
+
"module": "ESNext",
|
|
19
|
+
"moduleResolution": "bundler",
|
|
20
|
+
|
|
21
|
+
// Browser-specific settings
|
|
22
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
23
|
+
"target": "ESNext"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Next.js",
|
|
4
|
+
/**
|
|
5
|
+
* Use this configuration for:
|
|
6
|
+
* - Next.js applications only
|
|
7
|
+
* - Any package that needs Next.js-specific types
|
|
8
|
+
*
|
|
9
|
+
* Note:
|
|
10
|
+
* This extends tsconfig.react.json, inheriting all React and frontend
|
|
11
|
+
* settings, while adding Next.js-specific configurations like the
|
|
12
|
+
* Next.js TypeScript plugin.
|
|
13
|
+
*
|
|
14
|
+
* For regular React applications or components that aren't using
|
|
15
|
+
* Next.js, use tsconfig.react.json instead.
|
|
16
|
+
*/
|
|
17
|
+
"extends": "./tsconfig.react.json",
|
|
18
|
+
"compilerOptions": {
|
|
19
|
+
// Next.js Specific
|
|
20
|
+
"plugins": [{ "name": "next" }]
|
|
21
|
+
},
|
|
22
|
+
"include": ["next-env.d.ts", "next.config.js", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Node",
|
|
4
|
+
/**
|
|
5
|
+
* Use this configuration for:
|
|
6
|
+
* - Direct Node.js applications and scripts
|
|
7
|
+
* - Server applications that run with node directly
|
|
8
|
+
* - CLI tools and scripts that aren't bundled
|
|
9
|
+
*
|
|
10
|
+
* Note on module resolution:
|
|
11
|
+
* We use NodeNext because it follows Node.js's native
|
|
12
|
+
* module resolution rules, which is ideal for applications
|
|
13
|
+
* that run directly with node without bundling.
|
|
14
|
+
*
|
|
15
|
+
* If your package uses a bundler (e.g., has tsup.config.ts),
|
|
16
|
+
* use tsconfig.bundler.json instead.
|
|
17
|
+
*/
|
|
18
|
+
"extends": "./tsconfig.base.json",
|
|
19
|
+
"compilerOptions": {
|
|
20
|
+
// Node-specific module settings
|
|
21
|
+
"module": "NodeNext",
|
|
22
|
+
"moduleResolution": "NodeNext",
|
|
23
|
+
|
|
24
|
+
// Node.js Environment
|
|
25
|
+
"types": ["node"],
|
|
26
|
+
|
|
27
|
+
// Output Configuration
|
|
28
|
+
"removeComments": true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "React",
|
|
4
|
+
/**
|
|
5
|
+
* Use this configuration for:
|
|
6
|
+
* - React applications and components
|
|
7
|
+
* - Packages that use React's JSX syntax
|
|
8
|
+
* - UI libraries built with React
|
|
9
|
+
*
|
|
10
|
+
* Note:
|
|
11
|
+
* This extends tsconfig.frontend.json, so it inherits the bundler
|
|
12
|
+
* module resolution settings. This is appropriate since React
|
|
13
|
+
* applications are always bundled for the browser.
|
|
14
|
+
*
|
|
15
|
+
* For Next.js applications specifically, use tsconfig.next.json
|
|
16
|
+
* which adds Next.js-specific configurations.
|
|
17
|
+
*/
|
|
18
|
+
"extends": "./tsconfig.frontend.json",
|
|
19
|
+
"compilerOptions": {
|
|
20
|
+
// React Specific
|
|
21
|
+
"jsx": "preserve",
|
|
22
|
+
"jsxImportSource": "react",
|
|
23
|
+
|
|
24
|
+
// Add React types
|
|
25
|
+
"types": ["react", "react-dom"]
|
|
26
|
+
}
|
|
27
|
+
}
|