Skip to content

Commit

Permalink
♻️ (typescript) enable strict mode everywhere (#2230)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis authored Jan 15, 2024
1 parent cdefe61 commit f33bce4
Show file tree
Hide file tree
Showing 350 changed files with 415 additions and 8 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"rebuild-node": "yarn workspace loot-core rebuild",
"lint": "eslint . --max-warnings 0",
"lint:verbose": "DEBUG=eslint:cli-engine eslint . --max-warnings 0",
"typecheck": "yarn tsc",
"typecheck": "yarn tsc && tsc-strict",
"jq": "./node_modules/node-jq/bin/jq"
},
"devDependencies": {
Expand All @@ -55,7 +55,8 @@
"prettier": "2.8.2",
"react-refresh": "^0.14.0",
"source-map-support": "^0.5.21",
"typescript": "^5.0.2"
"typescript": "^5.0.2",
"typescript-strict-plugin": "^2.2.2-beta.2"
},
"engines": {
"node": ">=18.0.0"
Expand Down
1 change: 1 addition & 0 deletions packages/api/methods.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import * as fs from 'fs/promises';
import * as path from 'path';

Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/ResponsiveProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import { type ReactNode, createContext, useContext } from 'react';

import { useViewportSize } from '@react-aria/utils';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/AnimatedRefresh.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React from 'react';

import { keyframes } from 'glamor';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useEffect, useState } from 'react';
import {
ErrorBoundary,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/FatalError.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';

import { Block } from './common/Block';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ReactElement, useEffect, useMemo } from 'react';
import { DndProvider } from 'react-dnd';
import { HTML5Backend as Backend } from 'react-dnd-html5-backend';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/FixedSizeList.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import {
createRef,
PureComponent,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/GlobalKeys.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import { useEffect } from 'react';

import * as Platform from 'loot-core/src/client/platform';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/KeyHandlers.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { createContext, useEffect, useContext } from 'react';

import hotkeys, { type KeyHandler as HotKeyHandler } from 'hotkeys-js';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/LoggedInUser.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState, useEffect } from 'react';
import { useSelector } from 'react-redux';

Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/ManageRules.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useState,
useEffect,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/Modals.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useEffect } from 'react';
import { useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/Notes.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useEffect, useRef } from 'react';
import ReactMarkdown from 'react-markdown';

Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/NotesButton.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';

import { useLiveQuery } from 'loot-core/src/client/query-hooks';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/Notifications.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useState,
useEffect,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/PrivacyFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useState,
useCallback,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/ScrollProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
type ReactNode,
createContext,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/ServerContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
createContext,
useState,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/Titlebar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
createContext,
useState,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React from 'react';
import { useSelector } from 'react-redux';

Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/alerts.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ComponentType, type ReactNode } from 'react';

import { SvgExclamationOutline, SvgInformationOutline } from '../icons/v1';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { Fragment, type ComponentProps, type ReactNode } from 'react';

import { css } from 'glamor';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useState,
useRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
type ComponentProps,
Fragment,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
Fragment,
useState,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ComponentProps } from 'react';

import { useFeatureFlag } from '../../hooks/useFeatureFlag';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
createContext,
type Dispatch,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ComponentProps, memo } from 'react';

import * as monthUtils from 'loot-core/src/shared/months';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { forwardRef, useEffect, type ComponentProps } from 'react';
import { useSelector } from 'react-redux';
import AutoSizer from 'react-virtualized-auto-sizer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ComponentProps } from 'react';

import { type CategoryEntity } from 'loot-core/src/types/models';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ComponentProps } from 'react';

import { theme } from '../../style';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ComponentProps } from 'react';

import { type CategoryEntity } from 'loot-core/src/types/models';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React from 'react';

import { theme } from '../../style';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import { type CSSProperties, useState } from 'react';

import * as monthUtils from 'loot-core/src/shared/months';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { createContext, type ReactNode } from 'react';

import * as monthUtils from 'loot-core/src/shared/months';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useContext,
type CSSProperties,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type CSSProperties, type Ref, useState } from 'react';

import { type CategoryEntity } from 'loot-core/src/types/models';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type CSSProperties, useState } from 'react';
import { type ConnectDragSource } from 'react-dnd';

Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/budget/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
memo,
useContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { memo, useState } from 'react';

import { reportBudget } from 'loot-core/src/client/queries';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ReactNode, createContext, useContext } from 'react';

import * as monthUtils from 'loot-core/src/shared/months';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';

import { css } from 'glamor';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
type CSSProperties,
type ComponentProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
export function fraction(num, denom) {
if (denom === 0) {
if (num > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';

import { rolloverBudget } from 'loot-core/src/client/queries';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ComponentProps, useState } from 'react';

import { useCategories } from '../../../hooks/useCategories';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useState,
useContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { memo, useState } from 'react';

import { rolloverBudget } from 'loot-core/src/client/queries';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ReactNode, createContext, useContext } from 'react';

import * as monthUtils from 'loot-core/src/shared/months';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useState,
useContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';

import { css } from 'glamor';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState, type ComponentPropsWithoutRef } from 'react';

import { css } from 'glamor';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/budget/util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import { type useSpreadsheet } from 'loot-core/src/client/SpreadsheetProvider';
import { send } from 'loot-core/src/platform/client/fetch';
import * as monthUtils from 'loot-core/src/shared/months';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import { type ComponentProps } from 'react';

import { type CSSProperties } from '../../style';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/common/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { forwardRef, type ElementType, type HTMLProps } from 'react';

import { css } from 'glamor';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import {
type ReactElement,
type Ref,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/common/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useRef,
type KeyboardEvent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import { useState, type ComponentProps, type ReactNode } from 'react';

import { type CSSProperties, theme } from '../../style';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/common/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ReactNode, type ComponentProps } from 'react';
import { NavLink, useMatch } from 'react-router-dom';

Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/common/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import {
type ReactNode,
createElement,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React from 'react';

import { SvgDotsHorizontalTriple } from '../../icons/v1';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React from 'react';

import { Tooltip } from '../tooltips';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/common/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
useEffect,
useRef,
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/common/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import { type ChangeEvent, type Ref } from 'react';

import { SvgRemove, SvgSearchAlternate } from '../../icons/v2';
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/components/common/Stack.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, {
Children,
type ComponentProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React from 'react';

import { SvgFilter } from '../../icons/v1';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React from 'react';

import { SvgSettingsSliderAlternate } from '../../icons/v2';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState, useEffect } from 'react';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { useState } from 'react';

import { send } from 'loot-core/src/platform/client/fetch';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React, { type ChangeEvent, useState } from 'react';

import { ButtonWithLoading } from '../../common/Button';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-strict-ignore
import React from 'react';
import { useLocation } from 'react-router-dom';

Expand Down
Loading

0 comments on commit f33bce4

Please sign in to comment.