diff --git a/apps/app-sandbox-rnative/tsconfig.app.json b/apps/app-sandbox-rnative/tsconfig.app.json index 473e08218..ee18dffc5 100644 --- a/apps/app-sandbox-rnative/tsconfig.app.json +++ b/apps/app-sandbox-rnative/tsconfig.app.json @@ -2,14 +2,21 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "dist", - "types": ["node", "react-native"], + "types": [ + "node", + "react-native" + ], "rootDir": "src", "jsx": "react-jsx", - "lib": ["dom"], + "lib": [ + "dom" + ], "tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo", "baseUrl": "." }, - "files": ["../../node_modules/@nx/react-native/typings/svg.d.ts"], + "files": [ + "../../node_modules/@nx/react-native/typings/svg.d.ts" + ], "exclude": [ "out-tsc", "dist", @@ -19,7 +26,12 @@ "src/**/*.test.jsx", "src/test-setup.ts" ], - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"], + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.js", + "src/**/*.jsx" + ], "references": [ { "path": "../../libs/ui-rnative/tsconfig.lib.json" @@ -31,4 +43,4 @@ "path": "../../libs/design-core/tsconfig.lib.json" } ] -} +} \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs index 9d1ea4978..2b65cb55e 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,5 +1,4 @@ import nx from '@nx/eslint-plugin'; -import tsParser from '@typescript-eslint/parser'; import storybook from 'eslint-plugin-storybook'; import { defineConfig } from 'eslint/config'; import importPlugin from 'eslint-plugin-import'; @@ -25,9 +24,6 @@ export const sharedConfig = defineConfig( }, }, defineGlobalRules({ - languageOptions: { - parser: tsParser, - }, rules: { /** * React diff --git a/eslint.shared.mjs b/eslint.shared.mjs index d638b7f85..727ded0b5 100644 --- a/eslint.shared.mjs +++ b/eslint.shared.mjs @@ -31,6 +31,13 @@ const globalIgnorePatterns = [ '**/vitest.config.*.timestamp*', ]; +const tsParserOptions = { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, +}; + export const definedGlobalIgnores = globalIgnores(globalIgnorePatterns); /** @@ -40,6 +47,10 @@ export const definedGlobalIgnores = globalIgnores(globalIgnorePatterns); */ export const defineGlobalRules = (config) => ({ name: 'all-files-rules', + languageOptions: { + ...config.languageOptions, + ...tsParserOptions, + }, ...config, files: allFilePatterns, ignores: globalIgnorePatterns, @@ -54,6 +65,10 @@ export const defineGlobalRules = (config) => ({ export const defineProdRules = (config) => ({ name: 'production-files-only-rules', ...config, + languageOptions: { + ...config.languageOptions, + ...tsParserOptions, + }, files: [...prodFilePatterns, ...(config.files ?? [])], ignores: [ ...devFilePatterns, @@ -70,6 +85,10 @@ export const defineProdRules = (config) => ({ export const defineDevRules = (config) => ({ name: 'development-files-only-rules', ...config, + languageOptions: { + ...config.languageOptions, + ...tsParserOptions, + }, files: [...devFilePatterns, ...(config.files ?? [])], ignores: [ ...globalIgnorePatterns, diff --git a/libs/design-core/automations/designTokensEtl.ts b/libs/design-core/automations/designTokensEtl.ts index b50cf6e17..3b8ad3ddf 100644 --- a/libs/design-core/automations/designTokensEtl.ts +++ b/libs/design-core/automations/designTokensEtl.ts @@ -64,7 +64,9 @@ StyleDictionary.registerFormat({ mainKey = `@media (min-width: theme("screens.${currentBreakpoint}"))`; } - const output = { [mainKey]: {} }; + const output: Record> = { + [mainKey]: {}, + }; dictionary.allTokens.forEach((token: TransformedToken) => { const tokenName = sanitizeTokenName(token.name).replace(/ /g, '-'); diff --git a/libs/design-core/automations/generate-symbols.mts b/libs/design-core/automations/generate-symbols.ts similarity index 100% rename from libs/design-core/automations/generate-symbols.mts rename to libs/design-core/automations/generate-symbols.ts diff --git a/libs/design-core/project.json b/libs/design-core/project.json index 3d54140b8..56e4d5fae 100644 --- a/libs/design-core/project.json +++ b/libs/design-core/project.json @@ -56,7 +56,7 @@ "generate-symbols-react": { "executor": "nx:run-commands", "options": { - "command": "npx tsx libs/design-core/automations/generate-symbols.mts --templatePath libs/ui-react/src/utils/icon-template.ts --outputPath libs/ui-react/src/lib/Symbols" + "command": "npx tsx libs/design-core/automations/generate-symbols.ts --templatePath libs/ui-react/src/utils/icon-template.ts --outputPath libs/ui-react/src/lib/Symbols" }, "dependsOn": [ "^build" @@ -65,7 +65,7 @@ "generate-symbols-react-native": { "executor": "nx:run-commands", "options": { - "command": "npx tsx libs/design-core/automations/generate-symbols.mts --templatePath libs/ui-rnative/src/utils/icon-template.ts --outputPath libs/ui-rnative/src/lib/Symbols --isReactNative true" + "command": "npx tsx libs/design-core/automations/generate-symbols.ts --templatePath libs/ui-rnative/src/utils/icon-template.ts --outputPath libs/ui-rnative/src/lib/Symbols --isReactNative true" }, "dependsOn": [ "^build" diff --git a/libs/design-core/src/lib/themes/js/utils/extractCryptoGradients.ts b/libs/design-core/src/lib/themes/js/utils/extractCryptoGradients.ts index 187d84ac0..c62a953ef 100644 --- a/libs/design-core/src/lib/themes/js/utils/extractCryptoGradients.ts +++ b/libs/design-core/src/lib/themes/js/utils/extractCryptoGradients.ts @@ -19,14 +19,14 @@ export const extractCryptoGradients = (mode: 'dark' | 'light') => { ...acc, [colorKey]: [ { - color: cryptoColors[colorKey as CryptoColorKey], + color: cryptoColors[colorKey], }, { - color: cryptoTransparentColors[colorKey as CryptoColorKey], + color: cryptoTransparentColors[colorKey], }, ], }; }, - {} as any, + {} as { [key in CryptoColorKey]: { color: string }[] }, ); }; diff --git a/libs/design-core/tsconfig.json b/libs/design-core/tsconfig.json index c23e61c80..ffcee43ef 100644 --- a/libs/design-core/tsconfig.json +++ b/libs/design-core/tsconfig.json @@ -5,6 +5,12 @@ "references": [ { "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./tsconfig.tools.json" } ] -} +} \ No newline at end of file diff --git a/libs/design-core/tsconfig.lib.json b/libs/design-core/tsconfig.lib.json index ea6945f0c..66dfe332f 100644 --- a/libs/design-core/tsconfig.lib.json +++ b/libs/design-core/tsconfig.lib.json @@ -9,12 +9,28 @@ "module": "esnext", "moduleResolution": "bundler", "forceConsistentCasingInFileNames": true, - "types": ["node"] + "types": [ + "node" + ] }, - "include": ["src/**/*.ts"], + "exclude": [ + "out-tsc", + "dist", + "**/*.test.ts", + "**/*.test.tsx", + "**/*.test.js", + "**/*.test.jsx" + ], + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.json" + ], "references": [ { "path": "../utils-shared/tsconfig.lib.json" } ] -} +} \ No newline at end of file diff --git a/libs/design-core/tsconfig.spec.json b/libs/design-core/tsconfig.spec.json new file mode 100644 index 000000000..08c97bd66 --- /dev/null +++ b/libs/design-core/tsconfig.spec.json @@ -0,0 +1,38 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "allowJs": true, + "noEmit": true, + "outDir": "./out-tsc/vitest", + "types": [ + "vitest/globals", + "vitest/importMeta", + "vite/client", + "node", + "vitest" + ], + "lib": [ + "es2022", + "dom" + ], + "jsx": "react-jsx" + }, + "include": [ + "vite.config.ts", + "vitest.config.ts", + "eslint.config.mjs", + "automations/**/*.test.ts", + "automations/**/*.test.tsx", + "tools/**/*.test.tsx", + "src/**/*.test.ts", + "src/**/*.test.tsx", + "src/**/*.test.js", + "src/**/*.test.jsx", + "src/**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} \ No newline at end of file diff --git a/libs/design-core/tsconfig.tools.json b/libs/design-core/tsconfig.tools.json new file mode 100644 index 000000000..1933b8e85 --- /dev/null +++ b/libs/design-core/tsconfig.tools.json @@ -0,0 +1,36 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "noEmit": true, + "outDir": "out-tsc/tools", + "module": "esnext", + "moduleResolution": "bundler", + "jsx": "preserve", + "lib": [ + "DOM", + "DOM.Iterable", + "ESNext" + ] + }, + "exclude": [ + "src/**/*.test.ts", + "src/**/*.test.js", + "src/**/*.test.tsx", + "src/**/*.test.jsx" + ], + "include": [ + "automations/**/*.ts", + "tools/**/*.ts", + "vitest.config.ts", + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "files": [ + "../../node_modules/@nx/react/typings/styled-jsx.d.ts", + "../../node_modules/@nx/react/typings/cssmodule.d.ts", + "../../node_modules/@nx/react/typings/image.d.ts" + ] +} \ No newline at end of file diff --git a/libs/ui-react-visualization/tsconfig.lib.json b/libs/ui-react-visualization/tsconfig.lib.json index beeda8949..3b3d8a347 100644 --- a/libs/ui-react-visualization/tsconfig.lib.json +++ b/libs/ui-react-visualization/tsconfig.lib.json @@ -3,7 +3,10 @@ "compilerOptions": { "outDir": "dist", "emitDeclarationOnly": false, - "types": ["node", "vite/client"], + "types": [ + "node", + "vite/client" + ], "rootDir": "src", "jsx": "react-jsx", "tsBuildInfoFile": "dist/tsconfig.lib.tsbuildinfo" @@ -16,9 +19,7 @@ "**/*.test.js", "**/*.test.jsx", "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.test.js", @@ -49,4 +50,4 @@ "path": "../design-core/tsconfig.lib.json" } ] -} +} \ No newline at end of file diff --git a/libs/ui-react-visualization/tsconfig.spec.json b/libs/ui-react-visualization/tsconfig.spec.json index 5acfca8c1..f42004e6c 100644 --- a/libs/ui-react-visualization/tsconfig.spec.json +++ b/libs/ui-react-visualization/tsconfig.spec.json @@ -1,6 +1,8 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "allowJs": true, + "noEmit": true, "outDir": "./out-tsc/vitest", "types": [ "vitest/globals", @@ -17,9 +19,8 @@ }, "include": [ "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", + "eslint.config.mjs", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.test.js", @@ -31,4 +32,4 @@ "path": "./tsconfig.lib.json" } ] -} +} \ No newline at end of file diff --git a/libs/ui-react-visualization/tsconfig.tools.json b/libs/ui-react-visualization/tsconfig.tools.json index 812bf0cb6..0b3e4b926 100644 --- a/libs/ui-react-visualization/tsconfig.tools.json +++ b/libs/ui-react-visualization/tsconfig.tools.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "noEmit": true, "outDir": "out-tsc/storybook", "module": "esnext", "moduleResolution": "bundler", @@ -24,7 +25,9 @@ "src/**/*.stories.tsx", ".storybook/**/*.ts", ".storybook/**/*.tsx", - "src/**/*.mdx" + "src/**/*.mdx", + "jest.config.ts", + "vitest.config.ts", ], "references": [ { diff --git a/libs/ui-react/tsconfig.lib.json b/libs/ui-react/tsconfig.lib.json index 073b95970..8de2dcda2 100644 --- a/libs/ui-react/tsconfig.lib.json +++ b/libs/ui-react/tsconfig.lib.json @@ -21,9 +21,7 @@ "**/*.test.js", "**/*.test.jsx", "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.test.js", diff --git a/libs/ui-react/tsconfig.spec.json b/libs/ui-react/tsconfig.spec.json index 3f4b8b88e..4d51f3584 100644 --- a/libs/ui-react/tsconfig.spec.json +++ b/libs/ui-react/tsconfig.spec.json @@ -1,6 +1,8 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "allowJs": true, + "noEmit": true, "outDir": "./out-tsc/vitest", "types": [ "vitest/globals", @@ -17,9 +19,9 @@ }, "include": [ "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", + "jest.config.ts", + "eslint.config.mjs", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.test.js", diff --git a/libs/ui-react/tsconfig.tools.json b/libs/ui-react/tsconfig.tools.json index 39c52af22..017a9e45b 100644 --- a/libs/ui-react/tsconfig.tools.json +++ b/libs/ui-react/tsconfig.tools.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "noEmit": true, "outDir": "out-tsc/storybook", "module": "esnext", "moduleResolution": "bundler", @@ -29,7 +30,7 @@ "src/**/*.figma.tsx", ".storybook/**/*.js", ".storybook/**/*.ts", - ".storybook/**/*.tsx" + ".storybook/**/*.tsx", ], "references": [ { diff --git a/libs/ui-rnative-visualization/tsconfig.spec.json b/libs/ui-rnative-visualization/tsconfig.spec.json index e60847e14..a8404cf93 100644 --- a/libs/ui-rnative-visualization/tsconfig.spec.json +++ b/libs/ui-rnative-visualization/tsconfig.spec.json @@ -1,6 +1,8 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "allowJs": true, + "noEmit": true, "outDir": "./out-tsc/vitest", "types": [ "node" @@ -13,6 +15,9 @@ "jsx": "react-jsx" }, "include": [ + "jest.config.ts", + "jest.setup.ts", + "eslint.config.mjs", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.test.js", @@ -24,4 +29,4 @@ "path": "./tsconfig.lib.json" } ] -} +} \ No newline at end of file diff --git a/libs/ui-rnative-visualization/tsconfig.tools.json b/libs/ui-rnative-visualization/tsconfig.tools.json index f4f9db327..2caaf832a 100644 --- a/libs/ui-rnative-visualization/tsconfig.tools.json +++ b/libs/ui-rnative-visualization/tsconfig.tools.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "noEmit": true, "outDir": "out-tsc/storybook", "module": "esnext", "moduleResolution": "bundler", diff --git a/libs/ui-rnative/tsconfig.spec.json b/libs/ui-rnative/tsconfig.spec.json index e2a86172c..91f620445 100644 --- a/libs/ui-rnative/tsconfig.spec.json +++ b/libs/ui-rnative/tsconfig.spec.json @@ -1,9 +1,12 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "allowJs": true, + "noEmit": true, "outDir": "./out-tsc/vitest", "types": [ "node", + "jest", ], "module": "ESNext", "lib": [ @@ -17,11 +20,14 @@ "src/**/*.test.tsx", "src/**/*.test.js", "src/**/*.test.jsx", - "src/**/*.d.ts" + "src/**/*.d.ts", + "jest.config.ts", + "jest.setup.ts", + "eslint.config.mjs", ], "references": [ { "path": "./tsconfig.lib.json" } ] -} +} \ No newline at end of file diff --git a/libs/ui-rnative/tsconfig.tools.json b/libs/ui-rnative/tsconfig.tools.json index 19e6302c1..a1ae9e4bc 100644 --- a/libs/ui-rnative/tsconfig.tools.json +++ b/libs/ui-rnative/tsconfig.tools.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "noEmit": true, "outDir": "out-tsc/storybook", "module": "esnext", "moduleResolution": "bundler", diff --git a/libs/utils-shared/src/lib/context/createSafeContext.tsx b/libs/utils-shared/src/lib/context/createSafeContext.tsx index ffd973264..140d41242 100644 --- a/libs/utils-shared/src/lib/context/createSafeContext.tsx +++ b/libs/utils-shared/src/lib/context/createSafeContext.tsx @@ -41,7 +41,7 @@ export function createSafeContext( ); } - return (defaultContext || {}) as ContextValue; + return (defaultContext ?? {}) as ContextValue; } return [Provider, useSafeContext] as const; diff --git a/libs/utils-shared/tsconfig.lib.json b/libs/utils-shared/tsconfig.lib.json index 75d627167..4b30598f7 100644 --- a/libs/utils-shared/tsconfig.lib.json +++ b/libs/utils-shared/tsconfig.lib.json @@ -8,15 +8,18 @@ "emitDeclarationOnly": false, "jsx": "react-jsx", "forceConsistentCasingInFileNames": true, - "types": ["node"] + "types": [ + "node" + ] }, - "include": ["src/**/*.ts", "src/**/*.tsx"], + "include": [ + "src/**/*.ts", + "src/**/*.tsx" + ], "references": [], "exclude": [ "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.test.tsx", @@ -26,4 +29,4 @@ "src/**/*.test.jsx", "src/**/*.spec.jsx" ] -} +} \ No newline at end of file diff --git a/libs/utils-shared/tsconfig.spec.json b/libs/utils-shared/tsconfig.spec.json index 5681373bd..5832a1c04 100644 --- a/libs/utils-shared/tsconfig.spec.json +++ b/libs/utils-shared/tsconfig.spec.json @@ -1,6 +1,8 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "allowJs": true, + "noEmit": true, "outDir": "./out-tsc/vitest", "types": [ "vitest/globals", @@ -16,9 +18,8 @@ }, "include": [ "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", + "eslint.config.mjs", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.test.tsx", @@ -34,4 +35,4 @@ "path": "./tsconfig.lib.json" } ] -} +} \ No newline at end of file