Skip to content

Commit

Permalink
meta(types): remove unused types, stricter types
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispuska committed Jan 6, 2025
1 parent eecc9a1 commit 31fc04b
Show file tree
Hide file tree
Showing 20 changed files with 346 additions and 140 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test:u": "NODE_ENV=test vitest run --update",
"test:update": "NODE_ENV=test vitest run --update",
"test:watch": "NODE_ENV=test vitest",
"ts:watch": "tsc --noEmit --incremental --watch --project ./packages/workshop/tsconfig.json"
"tsc:watch": "tsc --noEmit --incremental --watch --project ./tsconfig.json"
},
"workspaces": [
"packages/*"
Expand All @@ -28,12 +28,12 @@
"devDependencies": {
"@babel/eslint-parser": "^7.25.9",
"@testing-library/react": "^16.1.0",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "8.18.2",
"@typescript-eslint/parser": "^8.18.2",
"@types/node": "^22.10.5",
"@typescript-eslint/eslint-plugin": "8.19.0",
"@typescript-eslint/parser": "^8.19.0",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/coverage-v8": "^2.1.8",
"concurrently": "^9.1.1",
"concurrently": "^9.1.2",
"eslint": "^9.17.0",
"eslint-config-next": "^15.1.3",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -44,7 +44,7 @@
"react-dom": "^19.0.0",
"prettier": "^3.4.2",
"typescript": "^5.7.2",
"vite": "^6.0.6",
"vite": "^6.0.7",
"vitest": "^2.1.8"
},
"trustedDependencies": [
Expand Down
38 changes: 38 additions & 0 deletions packages/benchmarks/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"compilerOptions": {
"allowJs": false,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "ES2022",
"useDefineForClassFields": true,
"verbatimModuleSyntax": false
},
"typeRoots": ["./node_modules/@types", "./types"],
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/components/components/Dot/Dot.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useId } from "react"
import { useId } from "react"
import styles from "./Dot.module.css"
import type { DotProps } from "./Dot.types"
import type { FC } from "react"
Expand Down
2 changes: 2 additions & 0 deletions packages/components/components/Heading/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ export const Heading: FC<HeadingProps> = (props) => {
default:
null
}

return null
}
2 changes: 1 addition & 1 deletion packages/components/components/Pie/Pie.types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { HeliosColors, HeliosAttributeMeta } from "../.."
import type { HeliosColors } from "../.."

export interface PieItem {
name?: string
Expand Down
2 changes: 1 addition & 1 deletion packages/components/components/Radio/Radio.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ChangeEvent } from "react"
import type { HeliosIntentionType, HeliosAttributeMeta } from "../.."
import type { HeliosIntentionType } from "../.."

export interface RadioProps {
intent: HeliosIntentionType
Expand Down
2 changes: 1 addition & 1 deletion packages/components/components/Setup/Setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare global {
}

const code = (): void => {
globalThis.__onThemeChange = function (theme: HeliosThemes): void {}
globalThis.__onThemeChange = function (_theme: HeliosThemes): void {}

const setTheme = (newTheme: HeliosThemes): void => {
globalThis.__theme = newTheme
Expand Down
2 changes: 1 addition & 1 deletion packages/components/components/Text/Text.utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { it, describe, expect } from "vitest"
import { _getFontWeight, getTypographyUtility } from "./Text.utils"
import { _getFontWeight } from "./Text.utils"

describe("typography", () => {
describe("_getFontWeight", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getClasses } from "@heliosgraphics/utils/classnames"
import { Checkbox, Flex, Icon, Text } from "../../.."
import styles from "./ResultList.module.css"
import { forwardRef, type FC } from "react"
import { forwardRef } from "react"
import type { ResultListProps } from "./ResultList.types"

export const ResultList = forwardRef<HTMLOListElement, ResultListProps>(({ items, isHidden }, ref) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/hooks/useChatScroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useRef, useEffect, type RefObject } from "react"

export const useChatScroll = (dependencies: Array<unknown>): RefObject<HTMLDivElement> => {
export const useChatScroll = (dependencies: Array<unknown>): RefObject<HTMLDivElement | null> => {
const ref = useRef<HTMLDivElement | null>(null)

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/hooks/useInterval.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useEffect, useRef } from "react"

export const useInterval = (callback: () => void, delay: number) => {
const savedCallback = useRef<() => void>()
const savedCallback = useRef<() => void>(null)

useEffect(() => {
savedCallback.current = callback
Expand Down
8 changes: 4 additions & 4 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@heliosgraphics/ui",
"version": "1.8.5",
"version": "1.8.6",
"type": "module",
"author": "03b8 <[email protected]>",
"private": false,
Expand Down Expand Up @@ -41,10 +41,10 @@
},
"devDependencies": {
"@testing-library/react": "^16.1.0",
"@types/node": "^22.10.2",
"@types/node": "^22.10.5",
"@types/react": "^19.0.2",
"@types/react-dom": "^19.0.2",
"@typescript-eslint/eslint-plugin": "^8.18.2",
"@typescript-eslint/eslint-plugin": "^8.19.0",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/coverage-v8": "^2.1.8",
"eslint": "^9.17.0",
Expand All @@ -54,7 +54,7 @@
"next": "^15.1.3",
"prettier": "^3.4.2",
"typescript": "^5.7.2",
"vite": "^6.0.6",
"vite": "^6.0.7",
"vitest": "^2.1.8"
}
}
46 changes: 30 additions & 16 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
{
"compilerOptions": {
"target": "ES6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"noEmit": true,
"incremental": true,
"module": "esnext",
"allowJs": false,
"baseUrl": ".",
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
]
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "ES2022",
"useDefineForClassFields": true,
"verbatimModuleSyntax": false
},
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx", "globals.d.ts"],
"typeRoots": ["./node_modules/@types", "./types"],
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/fractures/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const writeFile = (openFolder: string, contents: string): void => {
}

// gets the file statistics
export const getStats = (folder: string, fileName: string, content: string) => {
export const getStats = (folder: string, fileName: string, _content: string) => {
fs.stat(folder, (error: any, stats: any) => {
if (error) return console.log(`File doesn't exist.`)

Expand Down
38 changes: 38 additions & 0 deletions packages/fractures/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"compilerOptions": {
"allowJs": false,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "ES2022",
"useDefineForClassFields": true,
"verbatimModuleSyntax": false
},
"typeRoots": ["./node_modules/@types", "./types"],
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@figma-export/cli": "^6.0.2",
"@figma-export/output-components-as-svg": "^6.0.1",
"@svgr/cli": "^8.1.0",
"@types/node": "^22.10.2",
"@types/node": "^22.10.5",
"prettier": "^3.4.2",
"svgo": "^3.3.2",
"ts-node": "^10.9.2",
Expand Down
38 changes: 38 additions & 0 deletions packages/icons/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"compilerOptions": {
"allowJs": false,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "ES2022",
"useDefineForClassFields": true,
"verbatimModuleSyntax": false
},
"typeRoots": ["./node_modules/@types", "./types"],
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
38 changes: 38 additions & 0 deletions packages/utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"compilerOptions": {
"allowJs": false,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "ES2022",
"useDefineForClassFields": true,
"verbatimModuleSyntax": false
},
"typeRoots": ["./node_modules/@types", "./types"],
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit 31fc04b

Please sign in to comment.