Skip to content

Commit 3205269

Browse files
authored
[inspector-monitor] Add explicit return types (#1573)
* Cleanup * Explicitly define return type * Create violet-hotels-appear.md * Strip out module augmentation * Update violet-hotels-appear.md
1 parent d165cc7 commit 3205269

File tree

12 files changed

+30
-24
lines changed

12 files changed

+30
-24
lines changed

.changeset/violet-hotels-appear.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@redux-devtools/inspector-monitor': patch
3+
'@redux-devtools/rtk-query-monitor': patch
4+
---
5+
6+
Add explicit return types

.gitattributes

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1 @@
1-
*.js text eol=lf
2-
*.jsx text eol=lf
3-
*.ts text eol=lf
4-
*.tsx text eol=lf
5-
*.json text eol=lf
6-
*.css text eol=lf
7-
*.html text eol=lf
8-
*.md text eol=lf
9-
*.yml text eol=lf
10-
*.graphql text eol=lf
11-
.eslintrc text eol=lf
12-
.prettierrc text eol=lf
13-
.babelrc text eol=lf
14-
.stylelintrc text eol=lf
1+
* text=auto eol=lf

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"@babel/core": "^7.23.5",
55
"@babel/eslint-parser": "^7.23.3",
66
"@changesets/cli": "^2.27.1",
7+
"@nrwl/nx-cloud": "^16.5.2",
78
"@typescript-eslint/eslint-plugin": "^6.13.2",
89
"@typescript-eslint/parser": "^6.13.2",
910
"eslint": "^8.55.0",
@@ -12,10 +13,9 @@
1213
"eslint-plugin-react": "^7.33.2",
1314
"eslint-plugin-react-hooks": "^4.6.0",
1415
"jest": "^29.7.0",
15-
"prettier": "3.1.0",
16-
"typescript": "~5.3.3",
1716
"nx": "^16.10.0",
18-
"@nrwl/nx-cloud": "^16.5.2"
17+
"prettier": "3.1.0",
18+
"typescript": "~5.3.3"
1919
},
2020
"scripts": {
2121
"format": "prettier --write .",

packages/redux-devtools-inspector-monitor/src/ActionList.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
verticalListSortingStrategy,
1919
} from '@dnd-kit/sortable';
2020
import { CSS } from '@dnd-kit/utilities';
21+
import type { JSX } from '@emotion/react/jsx-runtime';
2122
import ActionListRow from './ActionListRow';
2223
import ActionListHeader from './ActionListHeader';
2324

@@ -80,7 +81,7 @@ export default function ActionList<A extends Action<string>>({
8081
onJumpToState,
8182
lastActionId,
8283
onReorderAction,
83-
}: Props<A>) {
84+
}: Props<A>): JSX.Element {
8485
const nodeRef = useRef<HTMLDivElement | null>(null);
8586
const prevLastActionId = useRef<number | undefined>();
8687

packages/redux-devtools-inspector-monitor/src/ActionListRow.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { DebouncedFunc } from 'lodash';
44
import debounce from 'lodash.debounce';
55
import { Action } from 'redux';
66
import type { Interpolation, Theme } from '@emotion/react';
7+
import type { JSX } from '@emotion/react/jsx-runtime';
78
import RightSlider from './RightSlider';
89
import {
910
selectorButtonCss,
@@ -52,7 +53,7 @@ export default class ActionListRow<
5253
> extends PureComponent<Props<A>, State> {
5354
state: State = { hover: false };
5455

55-
render() {
56+
render(): JSX.Element {
5657
const {
5758
isSelected,
5859
action,

packages/redux-devtools-inspector-monitor/src/ActionPreview.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Action } from 'redux';
44
import type { LabelRenderer } from 'react-json-tree';
55
import { PerformAction } from '@redux-devtools/core';
66
import { Delta } from 'jsondiffpatch';
7+
import type { JSX } from '@emotion/react/jsx-runtime';
78
import { DEFAULT_STATE, DevtoolsInspectorState } from './redux';
89
import ActionPreviewHeader from './ActionPreviewHeader';
910
import DiffTab from './tabs/DiffTab';
@@ -80,7 +81,7 @@ class ActionPreview<S, A extends Action<string>> extends Component<
8081
tabName: DEFAULT_STATE.tabName,
8182
};
8283

83-
render() {
84+
render(): JSX.Element {
8485
const {
8586
delta,
8687
error,

packages/redux-devtools-inspector-monitor/src/tabs/JSONDiff.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Delta } from 'jsondiffpatch';
66
import { Base16Theme } from 'redux-devtools-themes';
77
import { css } from '@emotion/react';
88
import type { Interpolation, Theme } from '@emotion/react';
9+
import type { JSX } from '@emotion/react/jsx-runtime';
910
import getItemString from './getItemString';
1011
import getJsonTreeTheme from './getJsonTreeTheme';
1112

@@ -91,7 +92,7 @@ export default class JSONDiff extends Component<Props, State> {
9192
this.setState({ data: this.props.delta });
9293
}
9394

94-
render() {
95+
render(): JSX.Element {
9596
const { base16Theme, ...props } = this.props;
9697

9798
if (!this.state.data) {

packages/redux-devtools-inspector-monitor/src/tabs/getItemString.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { isCollection, isIndexed, isKeyed } from 'immutable';
3+
import type { JSX } from '@emotion/react/jsx-runtime';
34
import isIterable from '../utils/isIterable';
45

56
const IS_IMMUTABLE_KEY = '@@__IS_IMMUTABLE__@@';
@@ -76,7 +77,7 @@ const getItemString = (
7677
dataTypeKey: string | symbol | undefined,
7778
isWideLayout: boolean,
7879
isDiff?: boolean,
79-
) => (
80+
): JSX.Element => (
8081
<span css={(theme) => ({ color: theme.ITEM_HINT_COLOR })}>
8182
{data[IS_IMMUTABLE_KEY] ? 'Immutable' : ''}
8283
{dataTypeKey && data[dataTypeKey] ? `${data[dataTypeKey] as string} ` : ''}

packages/redux-devtools-inspector-monitor/src/utils/themes.ts

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export function resolveBase16Theme(theme: Base16ThemeName | Base16Theme) {
1111
return getBase16Theme(theme, base16Themes);
1212
}
1313

14+
/**
15+
* @internal
16+
*/
1417
declare module '@emotion/react' {
1518
export interface Theme {
1619
TEXT_COLOR: string;

packages/redux-devtools-inspector-monitor/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"outDir": "lib/types",
55
"resolveJsonModule": true,
66
"jsx": "react-jsx",
7-
"jsxImportSource": "@emotion/react"
7+
"jsxImportSource": "@emotion/react",
8+
"stripInternal": true
89
},
910
"include": ["src"]
1011
}

packages/redux-devtools-rtk-query-monitor/src/styles/themes.ts

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export function resolveBase16Theme(
1111
return getBase16Theme(theme, reduxThemes) ?? reduxThemes.nicinabox;
1212
}
1313

14+
/**
15+
* @internal
16+
*/
1417
declare module '@emotion/react' {
1518
export interface Theme {
1619
TEXT_COLOR: string;

packages/redux-devtools-rtk-query-monitor/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"outDir": "lib/types",
55
"resolveJsonModule": true,
66
"jsx": "react-jsx",
7-
"jsxImportSource": "@emotion/react"
7+
"jsxImportSource": "@emotion/react",
8+
"stripInternal": true
89
},
910
"include": ["src"]
1011
}

0 commit comments

Comments
 (0)