Merge branch 'main' into renovate/react-bootstrap-2.x

This commit is contained in:
Nathan Bierema 2021-10-21 15:47:46 -04:00 committed by GitHub
commit 8a69712cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 445 additions and 694 deletions

View File

@ -93,7 +93,7 @@
"react-transform-catch-errors": "^1.0.2", "react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.4", "react-transform-hmr": "^1.0.4",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"selenium-webdriver": "^3.6.0", "selenium-webdriver": "^4.0.0",
"sinon-chrome": "^3.0.1", "sinon-chrome": "^3.0.1",
"style-loader": "^3.3.0", "style-loader": "^3.3.0",
"ts-jest": "^27.0.7", "ts-jest": "^27.0.7",

View File

@ -1,5 +1,6 @@
import { resolve } from 'path'; import { resolve } from 'path';
import webdriver from 'selenium-webdriver'; import webdriver from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome';
import chromedriver from 'chromedriver'; import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e'; import { switchMonitorTests, delay } from '../utils/e2e';
@ -17,11 +18,9 @@ describe('Chrome extension', function () {
await delay(2000); await delay(2000);
driver = new webdriver.Builder() driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`) .usingServer(`http://localhost:${port}`)
.withCapabilities({ .setChromeOptions(
chromeOptions: { new chrome.Options().addArguments(`load-extension=${path}`)
args: [`load-extension=${path}`], )
},
})
.forBrowser('chrome') .forBrowser('chrome')
.build(); .build();
}); });
@ -72,7 +71,6 @@ describe('Chrome extension', function () {
await driver.switchTo().window(tabs[1]); await driver.switchTo().window(tabs[1]);
expect(await driver.getCurrentUrl()).toMatch(url); expect(await driver.getCurrentUrl()).toMatch(url);
await driver.manage().timeouts().pageLoadTimeout(5000);
await driver.switchTo().window(tabs[0]); await driver.switchTo().window(tabs[0]);

View File

@ -1,5 +1,6 @@
import { join } from 'path'; import { join } from 'path';
import webdriver from 'selenium-webdriver'; import webdriver from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome';
import electronPath from 'electron'; import electronPath from 'electron';
import chromedriver from 'chromedriver'; import chromedriver from 'chromedriver';
import { switchMonitorTests, delay } from '../utils/e2e'; import { switchMonitorTests, delay } from '../utils/e2e';
@ -16,15 +17,13 @@ describe('DevTools panel for Electron', function () {
await delay(1000); await delay(1000);
driver = new webdriver.Builder() driver = new webdriver.Builder()
.usingServer(`http://localhost:${port}`) .usingServer(`http://localhost:${port}`)
.withCapabilities({ .setChromeOptions(
chromeOptions: { new chrome.Options()
binary: electronPath, .setChromeBinaryPath(electronPath)
args: [`app=${join(__dirname, 'fixture')}`], .addArguments(`app=${join(__dirname, 'fixture')}`)
}, )
}) .forBrowser('chrome')
.forBrowser('electron')
.build(); .build();
await driver.manage().timeouts().setScriptTimeout(10000);
}); });
afterAll(async () => { afterAll(async () => {
@ -48,8 +47,6 @@ describe('DevTools panel for Electron', function () {
/devtools:\/\/devtools\/bundled\/devtools_app.html/ /devtools:\/\/devtools\/bundled\/devtools_app.html/
); );
await driver.manage().timeouts().pageLoadTimeout(5000);
const id = await driver.executeAsyncScript(function (callback) { const id = await driver.executeAsyncScript(function (callback) {
let attempts = 5; let attempts = 5;
function showReduxPanel() { function showReduxPanel() {

View File

@ -1,8 +1,8 @@
{ {
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.2", "eslint-plugin-jest": "^25.2.2",

View File

@ -35,8 +35,8 @@
"@types/node": "^14.17.27", "@types/node": "^14.17.27",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -54,8 +54,8 @@
"@types/node": "^14.17.27", "@types/node": "^14.17.27",
"@types/ramda": "^0.27.45", "@types/ramda": "^0.27.45",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -388,12 +388,12 @@ export default function (
fill: style.text.colors.default, fill: style.text.colors.default,
cursor: 'pointer', cursor: 'pointer',
}) })
.on('mouseover', function mouseover(this: any) { .on('mouseover', function mouseover(this: EventTarget) {
d3.select(this).style({ d3.select(this).style({
fill: style.text.colors.hover, fill: style.text.colors.hover,
}); });
}) })
.on('mouseout', function mouseout(this: any) { .on('mouseout', function mouseout(this: EventTarget) {
d3.select(this).style({ d3.select(this).style({
fill: style.text.colors.default, fill: style.text.colors.default,
}); });
@ -401,7 +401,7 @@ export default function (
if (!tooltipOptions.disabled) { if (!tooltipOptions.disabled) {
nodeEnter.call( nodeEnter.call(
d3tooltip(d3, 'tooltip', { ...tooltipOptions, root }) d3tooltip<NodeWithId>(d3, 'tooltip', { ...tooltipOptions, root })
.text((d, i) => getTooltipString(d, i, tooltipOptions)) .text((d, i) => getTooltipString(d, i, tooltipOptions))
.style(tooltipOptions.style) .style(tooltipOptions.style)
); );

View File

@ -47,8 +47,8 @@
"@types/node": "^14.17.27", "@types/node": "^14.17.27",
"@types/ramda": "^0.27.45", "@types/ramda": "^0.27.45",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"d3": "^3.5.17", "d3": "^3.5.17",
"eslint": "^7.32.0", "eslint": "^7.32.0",

View File

@ -20,11 +20,40 @@ const defaultOptions: Options<unknown> = {
root: undefined, root: undefined,
}; };
interface Tip<Datum> {
(selection: Selection<Datum>): void;
attr: (
this: this,
d:
| string
| {
[key: string]:
| Primitive
| ((datum: Datum, index: number, outerIndex: number) => Primitive);
}
) => this;
style: (
this: this,
d:
| string
| {
[key: string]:
| Primitive
| ((datum: Datum, index: number, outerIndex: number) => Primitive);
}
| undefined
) => this;
text: (
this: this,
d: string | ((datum: Datum, index?: number, outerIndex?: number) => string)
) => this;
}
export default function tooltip<Datum>( export default function tooltip<Datum>(
d3: typeof d3Package, d3: typeof d3Package,
className = 'tooltip', className = 'tooltip',
options: Partial<Options<Datum>> = {} options: Partial<Options<Datum>> = {}
) { ): Tip<Datum> {
const { left, top, offset, root } = { const { left, top, offset, root } = {
...defaultOptions, ...defaultOptions,
...options, ...options,
@ -74,6 +103,7 @@ export default function tooltip<Datum>(
} }
tip.attr = function setAttr( tip.attr = function setAttr(
this: typeof tip,
d: d:
| string | string
| { | {
@ -96,6 +126,7 @@ export default function tooltip<Datum>(
}; };
tip.style = function setStyle( tip.style = function setStyle(
this: typeof tip,
d: d:
| string | string
| { | {
@ -103,6 +134,7 @@ export default function tooltip<Datum>(
| Primitive | Primitive
| ((datum: Datum, index: number, outerIndex: number) => Primitive); | ((datum: Datum, index: number, outerIndex: number) => Primitive);
} }
| undefined
) { ) {
if (is(Object, d)) { if (is(Object, d)) {
styles = { styles = {
@ -118,6 +150,7 @@ export default function tooltip<Datum>(
}; };
tip.text = function setText( tip.text = function setText(
this: typeof tip,
d: string | ((datum: Datum, index?: number, outerIndex?: number) => string) d: string | ((datum: Datum, index?: number, outerIndex?: number) => string)
) { ) {
text = functor(d); text = functor(d);

View File

@ -51,8 +51,8 @@
"@types/lodash": "^4.14.176", "@types/lodash": "^4.14.176",
"@types/node": "^14.17.27", "@types/node": "^14.17.27",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -51,8 +51,8 @@
"@types/color": "^3.0.2", "@types/color": "^3.0.2",
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"@types/lodash.curry": "^4.1.6", "@types/lodash.curry": "^4.1.6",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.2", "eslint-plugin-jest": "^25.2.2",

View File

@ -63,7 +63,7 @@ const mergeStyling = (
style: defaultStyling as CSS.Properties<string | number>, style: defaultStyling as CSS.Properties<string | number>,
}); });
case 'function': case 'function':
return (styling: Styling, ...args: any[]) => return (styling: Styling, ...args: unknown[]) =>
merger({ merger({
className: customStyling as string, className: customStyling as string,
})((defaultStyling as StylingValueFunction)(styling, ...args)); })((defaultStyling as StylingValueFunction)(styling, ...args));
@ -82,7 +82,7 @@ const mergeStyling = (
...(customStyling as CSS.Properties<string | number>), ...(customStyling as CSS.Properties<string | number>),
}; };
case 'function': case 'function':
return (styling: Styling, ...args: any[]) => return (styling: Styling, ...args: unknown[]) =>
merger({ merger({
style: customStyling as CSS.Properties<string | number>, style: customStyling as CSS.Properties<string | number>,
})((defaultStyling as StylingValueFunction)(styling, ...args)); })((defaultStyling as StylingValueFunction)(styling, ...args));
@ -143,7 +143,7 @@ const mergeStylings = (
const getStylingByKeys = ( const getStylingByKeys = (
mergedStyling: StylingConfig, mergedStyling: StylingConfig,
keys: (string | false | undefined) | (string | false | undefined)[], keys: (string | false | undefined) | (string | false | undefined)[],
...args: any[] ...args: unknown[]
): Styling => { ): Styling => {
if (keys === null) { if (keys === null) {
return mergedStyling as unknown as Styling; return mergedStyling as unknown as Styling;

View File

@ -8,7 +8,7 @@ export interface Styling {
export type StylingValueFunction = ( export type StylingValueFunction = (
styling: Styling, styling: Styling,
...rest: any[] ...rest: unknown[]
) => Partial<Styling>; ) => Partial<Styling>;
export type StylingValue = export type StylingValue =
@ -28,5 +28,5 @@ export type Theme = string | Base16Theme | StylingConfig;
export type StylingFunction = ( export type StylingFunction = (
keys: (string | false | undefined) | (string | false | undefined)[], keys: (string | false | undefined) | (string | false | undefined)[],
...rest: any[] ...rest: unknown[]
) => Styling; ) => Styling;

View File

@ -70,8 +70,8 @@ const getStylingFromBase16 = (base16: Base16Theme): StylingConfig => ({
testStyle: { testStyle: {
color: base16.base00, color: base16.base00,
}, },
testFunc: ({ style }, arg: string) => ({ testFunc: ({ style }, arg) => ({
className: `testClass--${arg}`, className: `testClass--${arg as string}`,
style: { style: {
...style, ...style,
width: 0, width: 0,
@ -84,8 +84,8 @@ const getStylingFromBase16 = (base16: Base16Theme): StylingConfig => ({
additionalStyle: { additionalStyle: {
border: 0, border: 0,
}, },
testFuncNoStyle: (_, arg: string) => ({ testFuncNoStyle: (_, arg) => ({
className: `testClass--${arg}`, className: `testClass--${arg as string}`,
}), }),
}); });
@ -126,15 +126,15 @@ test('createStyling (custom)', () => {
let customStyling = styling({ let customStyling = styling({
testClass: 'customClass', testClass: 'customClass',
testStyle: { height: 0 }, testStyle: { height: 0 },
testFunc: (styling: Styling, arg: string) => ({ testFunc: (styling: Styling, arg) => ({
className: `${styling.className!} customClass--${arg}`, className: `${styling.className!} customClass--${arg as string}`,
style: { style: {
...styling.style, ...styling.style,
border: 0, border: 0,
}, },
}), }),
testFuncNoStyle: (styling: Styling, arg: string) => ({ testFuncNoStyle: (styling: Styling, arg) => ({
className: `${styling.className!} customClass--${arg}`, className: `${styling.className!} customClass--${arg as string}`,
style: { style: {
...styling.style, ...styling.style,
border: 0, border: 0,

View File

@ -29,8 +29,8 @@
"@types/styled-components": "^5.1.15", "@types/styled-components": "^5.1.15",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -51,8 +51,8 @@
"@types/lodash.debounce": "^4.0.6", "@types/lodash.debounce": "^4.0.6",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@types/react-test-renderer": "^16.9.5", "@types/react-test-renderer": "^16.9.5",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.2", "eslint-plugin-jest": "^25.2.2",

View File

@ -35,8 +35,8 @@
"@types/react-dom": "^16.9.14", "@types/react-dom": "^16.9.14",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -28,7 +28,8 @@ const getValueLabelStyle: StylingValue = ({ style }, nodeType, keyPath) => ({
style: { style: {
...style, ...style,
color: color:
!Number.isNaN(keyPath[0]) && !(parseInt(keyPath, 10) % 2) !Number.isNaN((keyPath as unknown[])[0]) &&
!(parseInt(keyPath as string, 10) % 2)
? '#33F' ? '#33F'
: style!.color, : style!.color,
}, },

View File

@ -58,8 +58,8 @@
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@types/react-test-renderer": "^16.9.5", "@types/react-test-renderer": "^16.9.5",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -55,7 +55,7 @@ const getDefaultThemeStyling = (theme: Base16Theme): StylingConfig => {
backgroundColor: colors.BACKGROUND_COLOR, backgroundColor: colors.BACKGROUND_COLOR,
}, },
value: ({ style }, nodeType, keyPath: (string | number)[]) => ({ value: ({ style }, nodeType, keyPath) => ({
style: { style: {
...style, ...style,
paddingTop: '0.25em', paddingTop: '0.25em',
@ -64,7 +64,7 @@ const getDefaultThemeStyling = (theme: Base16Theme): StylingConfig => {
WebkitUserSelect: 'text', WebkitUserSelect: 'text',
MozUserSelect: 'text', MozUserSelect: 'text',
wordWrap: 'break-word', wordWrap: 'break-word',
paddingLeft: keyPath.length > 1 ? '2.125em' : '1.25em', paddingLeft: (keyPath as unknown[]).length > 1 ? '2.125em' : '1.25em',
textIndent: '-0.5em', textIndent: '-0.5em',
wordBreak: 'break-all', wordBreak: 'break-all',
}, },
@ -136,18 +136,12 @@ const getDefaultThemeStyling = (theme: Base16Theme): StylingConfig => {
left: '-0.4em', left: '-0.4em',
}, },
nestedNode: ( nestedNode: ({ style }, keyPath, nodeType, expanded, expandable) => ({
{ style },
keyPath: (string | number)[],
nodeType,
expanded,
expandable
) => ({
style: { style: {
...style, ...style,
position: 'relative', position: 'relative',
paddingTop: '0.25em', paddingTop: '0.25em',
marginLeft: keyPath.length > 1 ? '0.875em' : 0, marginLeft: (keyPath as unknown[]).length > 1 ? '0.875em' : 0,
paddingLeft: !expandable ? '1.125em' : 0, paddingLeft: !expandable ? '1.125em' : 0,
}, },
}), }),

View File

@ -1,6 +1,7 @@
function getLength(type: string, collection: any) { function getLength(type: string, collection: any) {
if (type === 'Object') { if (type === 'Object') {
return Object.keys(collection).length; // eslint-disable-next-line @typescript-eslint/ban-types
return Object.keys(collection as {}).length;
} else if (type === 'Array') { } else if (type === 'Array') {
return (collection as unknown[]).length; return (collection as unknown[]).length;
} }

View File

@ -82,8 +82,8 @@
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@types/webpack-env": "^1.16.3", "@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"css-loader": "^6.4.0", "css-loader": "^6.4.0",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
@ -95,7 +95,7 @@
"eslint-plugin-react": "^7.26.1", "eslint-plugin-react": "^7.26.1",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^6.4.0", "fork-ts-checker-webpack-plugin": "^6.4.0",
"html-loader": "^2.1.2", "html-loader": "^3.0.0",
"html-webpack-plugin": "^5.4.0", "html-webpack-plugin": "^5.4.0",
"jest": "^27.3.1", "jest": "^27.3.1",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",

View File

@ -1,7 +1,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Delta, formatters } from 'jsondiffpatch'; import { Delta, formatters } from 'jsondiffpatch';
import styled from 'styled-components'; import styled, { ThemedStyledProps } from 'styled-components';
import { effects } from '@redux-devtools/ui'; import { effects } from '@redux-devtools/ui';
import { Theme } from '@redux-devtools/ui/lib/themes/default';
export const StyledContainer = styled.div` export const StyledContainer = styled.div`
.jsondiffpatch-delta { .jsondiffpatch-delta {
@ -18,7 +19,8 @@ export const StyledContainer = styled.div`
padding: 2px 3px; padding: 2px 3px;
border-radius: 3px; border-radius: 3px;
position: relative; position: relative;
color: ${(props) => props.theme.base07}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
color: ${(props: ThemedStyledProps<{}, Theme>) => props.theme.base07};
display: inline-block; display: inline-block;
} }
@ -42,20 +44,25 @@ export const StyledContainer = styled.div`
.jsondiffpatch-modified .jsondiffpatch-right-value:before { .jsondiffpatch-modified .jsondiffpatch-right-value:before {
vertical-align: top; vertical-align: top;
padding: 2px; padding: 2px;
color: ${(props) => props.theme.base0E}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
color: ${(props: ThemedStyledProps<{}, Theme>) => props.theme.base0E};
content: ' => '; content: ' => ';
} }
.jsondiffpatch-added .jsondiffpatch-value pre, .jsondiffpatch-added .jsondiffpatch-value pre,
.jsondiffpatch-modified .jsondiffpatch-right-value pre, .jsondiffpatch-modified .jsondiffpatch-right-value pre,
.jsondiffpatch-textdiff-added { .jsondiffpatch-textdiff-added {
background: ${(props) => effects.color(props.theme.base0B, 'alpha', 0.2)}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
background: ${(props: ThemedStyledProps<{}, Theme>) =>
effects.color(props.theme.base0B, 'alpha', 0.2)};
} }
.jsondiffpatch-deleted pre, .jsondiffpatch-deleted pre,
.jsondiffpatch-modified .jsondiffpatch-left-value pre, .jsondiffpatch-modified .jsondiffpatch-left-value pre,
.jsondiffpatch-textdiff-deleted { .jsondiffpatch-textdiff-deleted {
background: ${(props) => effects.color(props.theme.base08, 'alpha', 0.2)}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
background: ${(props: ThemedStyledProps<{}, Theme>) =>
effects.color(props.theme.base08, 'alpha', 0.2)};
text-decoration: line-through; text-decoration: line-through;
} }
@ -122,12 +129,14 @@ export const StyledContainer = styled.div`
padding: 2px 0; padding: 2px 0;
padding-right: 5px; padding-right: 5px;
vertical-align: top; vertical-align: top;
color: ${(props) => props.theme.base0D}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
color: ${(props: ThemedStyledProps<{}, Theme>) => props.theme.base0D};
} }
.jsondiffpatch-property-name:after { .jsondiffpatch-property-name:after {
content: ': '; content: ': ';
color: ${(props) => props.theme.base07}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
color: ${(props: ThemedStyledProps<{}, Theme>) => props.theme.base07};
} }
.jsondiffpatch-child-node-type-array > .jsondiffpatch-property-name:after { .jsondiffpatch-child-node-type-array > .jsondiffpatch-property-name:after {
@ -163,7 +172,8 @@ export const StyledContainer = styled.div`
} }
.jsondiffpatch-value pre:after { .jsondiffpatch-value pre:after {
color: ${(props) => props.theme.base07}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
color: ${(props: ThemedStyledProps<{}, Theme>) => props.theme.base07};
content: ','; content: ',';
} }
@ -186,7 +196,8 @@ export const StyledContainer = styled.div`
.jsondiffpatch-moved .jsondiffpatch-moved-destination { .jsondiffpatch-moved .jsondiffpatch-moved-destination {
display: inline-block; display: inline-block;
background: ${(props) => props.theme.base0A}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
background: ${(props: ThemedStyledProps<{}, Theme>) => props.theme.base0A};
} }
.jsondiffpatch-moved .jsondiffpatch-moved-destination:before { .jsondiffpatch-moved .jsondiffpatch-moved-destination:before {

View File

@ -129,7 +129,7 @@ function updateState(
newState = recompute( newState = recompute(
newState, newState,
request.batched ? payload : (payload as unknown as State[])[i], request.batched ? payload : (payload as unknown as State[])[i],
action[i], action[i] as PerformAction<Action<unknown>>,
newState.nextActionId + 1, newState.nextActionId + 1,
maxAge, maxAge,
isExcess isExcess

View File

@ -40,7 +40,7 @@ export default function configureStore(
module.hot.accept('../reducers', () => { module.hot.accept('../reducers', () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const nextReducer = require('../reducers'); // eslint-disable-line global-require const nextReducer = require('../reducers'); // eslint-disable-line global-require
store.replaceReducer(nextReducer); store.replaceReducer(nextReducer as Reducer<StoreState, StoreAction>);
}); });
} }
} }

View File

@ -51,8 +51,8 @@
"@babel/preset-typescript": "^7.15.0", "@babel/preset-typescript": "^7.15.0",
"@redux-devtools/core": "^3.9.0", "@redux-devtools/core": "^3.9.0",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.1", "eslint-plugin-react": "^7.26.1",

View File

@ -82,8 +82,8 @@
"@types/styled-components": "^5.1.15", "@types/styled-components": "^5.1.15",
"@types/supertest": "^2.0.11", "@types/supertest": "^2.0.11",
"@types/uuid": "^8.3.1", "@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.2", "eslint-plugin-jest": "^25.2.2",

View File

@ -21,7 +21,7 @@ const serverFlags: { [moduleName: string]: { [version: string]: string } } = {
}, },
}; };
function getModuleVersion(modulePath: string) { function getModuleVersion(modulePath: string): string {
return JSON.parse( return JSON.parse(
fs.readFileSync(path.join(modulePath, 'package.json'), 'utf-8') fs.readFileSync(path.join(modulePath, 'package.json'), 'utf-8')
).version; ).version;
@ -41,14 +41,14 @@ function getServerFlag(moduleName: string, version: string): string {
export const dir = 'local-cli/server'; export const dir = 'local-cli/server';
export const file = 'server.js'; export const file = 'server.js';
export const fullPath = path.join(exports.dir, exports.file); export const fullPath = path.join(dir, file);
export function inject( export function inject(
modulePath: string, modulePath: string,
options: Options, options: Options,
moduleName: string moduleName: string
) { ) {
const filePath = path.join(modulePath, exports.fullPath); const filePath = path.join(modulePath, fullPath);
if (!fs.existsSync(filePath)) return false; if (!fs.existsSync(filePath)) return false;
const serverFlag = getServerFlag(moduleName, getModuleVersion(modulePath)); const serverFlag = getServerFlag(moduleName, getModuleVersion(modulePath));
@ -85,7 +85,7 @@ export function revert(
options: Options, options: Options,
moduleName: string moduleName: string
) { ) {
const filePath = path.join(modulePath, exports.fullPath); const filePath = path.join(modulePath, fullPath);
if (!fs.existsSync(filePath)) return false; if (!fs.existsSync(filePath)) return false;
const serverFlag = getServerFlag(moduleName, getModuleVersion(modulePath)); const serverFlag = getServerFlag(moduleName, getModuleVersion(modulePath));

View File

@ -8,7 +8,7 @@ export default async function openApp(app: true | string, options: Options) {
try { try {
const port = options.port ? `--port=${options.port}` : ''; const port = options.port ? `--port=${options.port}` : '';
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
spawn.sync(require('electron'), [ spawn.sync(require('electron') as string, [
path.join(__dirname, '..', '..', 'app'), path.join(__dirname, '..', '..', 'app'),
port, port,
]); ]);

View File

@ -17,8 +17,8 @@ function readFile(filePath: string) {
} }
if (argv.protocol === 'https') { if (argv.protocol === 'https') {
argv.key = argv.key ? readFile(argv.key) : null; argv.key = argv.key ? readFile(argv.key as string) : null;
argv.cert = argv.cert ? readFile(argv.cert) : null; argv.cert = argv.cert ? readFile(argv.cert as string) : null;
} }
function log(pass: boolean, msg: string) { function log(pass: boolean, msg: string) {
@ -76,13 +76,13 @@ function injectRN(type: string, msg: string) {
if (argv.revert) { if (argv.revert) {
injectRN( injectRN(
argv.revert, argv.revert as string,
'Revert injection of ReduxDevTools server from React Native local server' 'Revert injection of ReduxDevTools server from React Native local server'
); );
} }
if (argv.injectserver) { if (argv.injectserver) {
injectRN( injectRN(
argv.injectserver, argv.injectserver as string,
'Inject ReduxDevTools server into React Native local server' 'Inject ReduxDevTools server into React Native local server'
); );
} }
@ -91,7 +91,7 @@ if (argv.injectserver) {
server(argv).then(function (r) { server(argv).then(function (r) {
if (argv.open && argv.open !== 'false') { if (argv.open && argv.open !== 'false') {
r.on('ready', async function () { r.on('ready', async function () {
await openApp(argv.open, options); await openApp(argv.open as string, options);
}); });
} }
}); });

View File

@ -1,11 +1,11 @@
import path from 'path'; import path from 'path';
import knexModule from 'knex'; import knexModule, { Config } from 'knex';
import { SCServer } from 'socketcluster-server'; import { SCServer } from 'socketcluster-server';
export default function connector(options: SCServer.SCServerOptions) { export default function connector(options: SCServer.SCServerOptions) {
const dbOptions = options.dbOptions; const dbOptions = options.dbOptions as Config;
dbOptions.useNullAsDefault = true; dbOptions.useNullAsDefault = true;
if (!dbOptions.migrate) { if (!(dbOptions as any).migrate) {
return knexModule(dbOptions); return knexModule(dbOptions);
} }

View File

@ -31,7 +31,7 @@ export interface Options {
export default function getOptions(argv: { [arg: string]: any }): Options { export default function getOptions(argv: { [arg: string]: any }): Options {
let dbOptions = argv.dbOptions; let dbOptions = argv.dbOptions;
if (typeof dbOptions === 'string') { if (typeof dbOptions === 'string') {
dbOptions = require(path.resolve(process.cwd(), argv.dbOptions)); dbOptions = require(path.resolve(process.cwd(), argv.dbOptions as string));
} else if (typeof dbOptions === 'undefined') { } else if (typeof dbOptions === 'undefined') {
dbOptions = require('../defaultDbOptions.json'); dbOptions = require('../defaultDbOptions.json');
} }

View File

@ -1,11 +1,12 @@
import path from 'path'; import path from 'path';
import express from 'express'; import express from 'express';
import morgan from 'morgan'; import morgan from 'morgan';
import * as http from 'http';
import bodyParser from 'body-parser'; import bodyParser from 'body-parser';
import cors from 'cors'; import cors from 'cors';
import { SCServer } from 'socketcluster-server'; import { SCServer } from 'socketcluster-server';
import graphqlMiddleware from './middleware/graphql'; import graphqlMiddleware from './middleware/graphql';
import { ReportBaseFields, Store } from './store'; import { AddData, ReportBaseFields, Store } from './store';
const app = express.Router(); const app = express.Router();
@ -27,7 +28,15 @@ function routes(
if (logHTTPRequests) { if (logHTTPRequests) {
if (typeof logHTTPRequests === 'object') if (typeof logHTTPRequests === 'object')
app.use(morgan('combined', logHTTPRequests)); app.use(
morgan(
'combined',
logHTTPRequests as morgan.Options<
http.IncomingMessage,
http.ServerResponse
>
)
);
else app.use(morgan('combined')); else app.use(morgan('combined'));
} }
@ -55,7 +64,7 @@ function routes(
switch (req.body.op) { switch (req.body.op) {
case 'get': case 'get':
store store
.get(req.body.id) .get(req.body.id as string)
.then(function (r) { .then(function (r) {
res.send(r || {}); res.send(r || {});
}) })
@ -66,7 +75,7 @@ function routes(
break; break;
case 'list': case 'list':
store store
.list(req.body.query, req.body.fields) .list(req.body.query, req.body.fields as string[])
.then(function (r) { .then(function (r) {
res.send(r); res.send(r);
}) })
@ -77,7 +86,7 @@ function routes(
break; break;
default: default:
store store
.add(req.body) .add(req.body as AddData)
.then(function (r) { .then(function (r) {
res.send({ res.send({
id: (r as ReportBaseFields).id, id: (r as ReportBaseFields).id,

View File

@ -62,7 +62,7 @@ function get(id: string): Promise<Report | { error: string }> {
return knex(reports).where('id', id).first(); return knex(reports).where('id', id).first();
} }
interface AddData { export interface AddData {
type: ReportType | null; type: ReportType | null;
title: string | null; title: string | null;
description: string | null; description: string | null;

View File

@ -60,7 +60,7 @@ class Worker extends SCWorker {
}); });
respond(null, channelToWatch); respond(null, channelToWatch);
}); });
socket.on('getReport', function (id, respond) { socket.on('getReport', function (id: string, respond) {
store store
.get(id) .get(id)
.then(function (data) { .then(function (data) {

View File

@ -52,8 +52,8 @@
"@redux-devtools/core": "^3.9.0", "@redux-devtools/core": "^3.9.0",
"@types/parse-key": "^0.2.0", "@types/parse-key": "^0.2.0",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.1", "eslint-plugin-react": "^7.26.1",

View File

@ -41,8 +41,8 @@
"@types/redux-logger": "^3.0.9", "@types/redux-logger": "^3.0.9",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"css-loader": "^6.4.0", "css-loader": "^6.4.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",

View File

@ -68,8 +68,8 @@
"@types/object-path": "^0.11.1", "@types/object-path": "^0.11.1",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@types/simple-diff": "^1.6.1", "@types/simple-diff": "^1.6.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6", "enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.6.2", "enzyme-to-json": "^3.6.2",

View File

@ -51,8 +51,8 @@
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@types/redux-devtools-themes": "^1.0.0", "@types/redux-devtools-themes": "^1.0.0",
"@types/source-map": "0.5.2", "@types/source-map": "0.5.2",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6", "enzyme-adapter-react-16": "^1.15.6",
"enzyme-to-json": "^3.6.2", "enzyme-to-json": "^3.6.2",

View File

@ -118,7 +118,7 @@ export default function openFile(
typeof editor === 'string' && typeof editor === 'string' &&
/^\w{1,30}$/.test(editor) /^\w{1,30}$/.test(editor)
) { ) {
openInEditor(editor.toLowerCase(), projectPath, stackFrame); openInEditor(editor.toLowerCase(), projectPath as string, stackFrame);
} else { } else {
if ( if (
chrome.devtools && chrome.devtools &&

View File

@ -12,7 +12,7 @@ import { RawSourceMap, SourceMapConsumer } from 'source-map';
* *
* This exposes methods which will be indifferent to changes made in <code>{@link https://github.com/mozilla/source-map source-map}</code>. * This exposes methods which will be indifferent to changes made in <code>{@link https://github.com/mozilla/source-map source-map}</code>.
*/ */
class SourceMap { export class SourceMap {
__source_map: SourceMapConsumer; __source_map: SourceMapConsumer;
constructor(sourceMap: SourceMapConsumer) { constructor(sourceMap: SourceMapConsumer) {
@ -74,7 +74,7 @@ class SourceMap {
} }
} }
function extractSourceMapUrl( export function extractSourceMapUrl(
fileUri: string, fileUri: string,
fileContents: string fileContents: string
): Promise<string> { ): Promise<string> {
@ -98,7 +98,7 @@ function extractSourceMapUrl(
* @param {string} fileUri The URI of the source file. * @param {string} fileUri The URI of the source file.
* @param {string} fileContents The contents of the source file. * @param {string} fileContents The contents of the source file.
*/ */
async function getSourceMap( export async function getSourceMap(
//function getSourceMap( //function getSourceMap(
fileUri: string, fileUri: string,
fileContents: string fileContents: string
@ -120,7 +120,7 @@ async function getSourceMap(
const index = fileUri.lastIndexOf('/'); const index = fileUri.lastIndexOf('/');
const url = fileUri.substring(0, index + 1) + sm; const url = fileUri.substring(0, index + 1) + sm;
const obj = await fetch(url).then((res) => res.json()); const obj = await fetch(url).then((res) => res.json());
return new SourceMap(new SourceMapConsumer(obj)); return new SourceMap(new SourceMapConsumer(obj as RawSourceMap));
} }
/* /*
@ -153,5 +153,4 @@ async function getSourceMap(
*/ */
} }
export { extractSourceMapUrl, getSourceMap };
export default getSourceMap; export default getSourceMap;

View File

@ -6,7 +6,7 @@
*/ */
import StackFrame from './stack-frame'; import StackFrame from './stack-frame';
import { getSourceMap } from './getSourceMap'; import { getSourceMap, SourceMap } from './getSourceMap';
import { getLinesAround } from './getLinesAround'; import { getLinesAround } from './getLinesAround';
/** /**
@ -18,7 +18,12 @@ async function map(
frames: StackFrame[], frames: StackFrame[],
contextLines = 3 contextLines = 3
): Promise<StackFrame[]> { ): Promise<StackFrame[]> {
const cache: any = {}; const cache: {
[fileName: string]: {
readonly fileSource: string;
readonly map: SourceMap;
};
} = {};
const files: string[] = []; const files: string[] = [];
frames.forEach((frame) => { frames.forEach((frame) => {
const { fileName } = frame; const { fileName } = frame;
@ -45,7 +50,7 @@ async function map(
} }
const { source, line, column } = map.getOriginalPosition( const { source, line, column } = map.getOriginalPosition(
lineNumber, lineNumber,
columnNumber columnNumber!
); );
const originalSource = source == null ? [] : map.getSource(source) || []; const originalSource = source == null ? [] : map.getSource(source) || [];
return new StackFrame( return new StackFrame(
@ -58,7 +63,7 @@ async function map(
source, source,
line, line,
column, column,
getLinesAround(line, contextLines, originalSource) getLinesAround(line!, contextLines, originalSource)
); );
}); });
} }

View File

@ -42,8 +42,8 @@
"@types/redux-logger": "^3.0.9", "@types/redux-logger": "^3.0.9",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -65,8 +65,8 @@
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@types/react-dragula": "^1.1.0", "@types/react-dragula": "^1.1.0",
"@types/redux-devtools-themes": "^1.0.0", "@types/redux-devtools-themes": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.1", "eslint-plugin-react": "^7.26.1",

View File

@ -23,7 +23,8 @@ function getShortTypeString(val: any, diff: boolean | undefined) {
} else if (val === undefined) { } else if (val === undefined) {
return 'undef'; return 'undef';
} else if (typeof val === 'object') { } else if (typeof val === 'object') {
return Object.keys(val).length > 0 ? '{…}' : '{}'; // eslint-disable-next-line @typescript-eslint/ban-types
return Object.keys(val as {}).length > 0 ? '{…}' : '{}';
} else if (typeof val === 'function') { } else if (typeof val === 'function') {
return 'fn'; return 'fn';
} else if (typeof val === 'string') { } else if (typeof val === 'string') {
@ -42,7 +43,8 @@ function getText(
isDiff: boolean | undefined isDiff: boolean | undefined
) { ) {
if (type === 'Object') { if (type === 'Object') {
const keys = Object.keys(data); // eslint-disable-next-line @typescript-eslint/ban-types
const keys = Object.keys(data as {});
if (!isWideLayout) return keys.length ? '{…}' : '{}'; if (!isWideLayout) return keys.length ? '{…}' : '{}';
const str = keys const str = keys

View File

@ -48,8 +48,8 @@
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"@types/lodash": "^4.14.176", "@types/lodash": "^4.14.176",
"@types/node": "^14.17.27", "@types/node": "^14.17.27",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.2", "eslint-plugin-jest": "^25.2.2",

View File

@ -54,8 +54,8 @@
"@babel/preset-typescript": "^7.15.0", "@babel/preset-typescript": "^7.15.0",
"@redux-devtools/core": "^3.9.0", "@redux-devtools/core": "^3.9.0",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.1", "eslint-plugin-react": "^7.26.1",

View File

@ -85,7 +85,11 @@ export default class LogMonitorEntry<
) => ({ ) => ({
style: { style: {
...style, ...style,
backgroundColor: dataIsEqual(data, previousData, keyPath) backgroundColor: dataIsEqual(
data,
previousData,
keyPath as (string | number)[]
)
? 'transparent' ? 'transparent'
: this.props.theme.base01, : this.props.theme.base01,
}, },
@ -93,7 +97,7 @@ export default class LogMonitorEntry<
const getNestedNodeStyle: StylingValue = ({ style }, keyPath) => ({ const getNestedNodeStyle: StylingValue = ({ style }, keyPath) => ({
style: { style: {
...style, ...style,
...(keyPath.length > 1 ? {} : styles.root), ...((keyPath as unknown[]).length > 1 ? {} : styles.root),
}, },
}); });
theme = { theme = {

View File

@ -41,8 +41,8 @@
"@types/react-router-dom": "^5.3.1", "@types/react-router-dom": "^5.3.1",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"copy-webpack-plugin": "^9.0.1", "copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.4.0", "css-loader": "^6.4.0",

View File

@ -72,7 +72,7 @@ const PostJsonDetail = ({ id }: { id: string }) => {
}; };
export const PostDetail = () => { export const PostDetail = () => {
const { id } = useParams<{ id: any }>(); const { id } = useParams<{ id: string }>();
const history = useHistory(); const history = useHistory();
const toast = useToast(); const toast = useToast();

View File

@ -42,7 +42,7 @@ export const postsApi = createApi({
}), }),
invalidatesTags: (result, error, { id }) => [{ type: 'Post', id }], invalidatesTags: (result, error, { id }) => [{ type: 'Post', id }],
}), }),
deletePost: build.mutation<{ success: boolean; id: number }, number>({ deletePost: build.mutation<{ success: boolean; id: number }, string>({
query(id) { query(id) {
return { return {
url: `posts/${id}`, url: `posts/${id}`,

View File

@ -64,8 +64,8 @@
"@types/hex-rgba": "^1.0.1", "@types/hex-rgba": "^1.0.1",
"@types/lodash.debounce": "^4.0.6", "@types/lodash.debounce": "^4.0.6",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.1", "eslint-plugin-react": "^7.26.1",

View File

@ -44,7 +44,8 @@ function getText(
isDiff: boolean | undefined isDiff: boolean | undefined
) { ) {
if (type === 'Object') { if (type === 'Object') {
const keys = Object.keys(data); // eslint-disable-next-line @typescript-eslint/ban-types
const keys = Object.keys(data as {});
if (!previewContent) return keys.length ? '{…}' : '{}'; if (!previewContent) return keys.length ? '{…}' : '{}';
const str = keys const str = keys

View File

@ -39,8 +39,8 @@
"@babel/preset-typescript": "^7.15.0", "@babel/preset-typescript": "^7.15.0",
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"@types/jsan": "^3.1.2", "@types/jsan": "^3.1.2",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.2", "eslint-plugin-jest": "^25.2.2",

View File

@ -35,13 +35,26 @@ export function extract(data: unknown, type: string): SerializedData {
}; };
} }
export function refer(data: unknown, type: string): SerializedData;
export function refer<K extends string>( export function refer<K extends string>(
data: { [key in K]: () => unknown }, data: { [key in K]: () => unknown },
type: string, type: string,
transformMethod: K | false, transformMethod?: K | false,
refs?: (new (data: any) => unknown)[] | null
): SerializedData;
export function refer<K extends string>(
data: any,
type: string,
transformMethod?: 'toString' | false,
refs?: (new (data: any) => unknown)[] | null
): SerializedData;
export function refer<K extends string>(
data: { [key in K]: () => unknown } | unknown,
type: string,
transformMethod?: K | false,
refs?: (new (data: any) => unknown)[] | null refs?: (new (data: any) => unknown)[] | null
): SerializedData { ): SerializedData {
const r = mark(data, type, transformMethod); const r = mark(data as { [key in K]: () => unknown }, type, transformMethod);
if (!refs) return r; if (!refs) return r;
for (let i = 0; i < refs.length; i++) { for (let i = 0; i < refs.length; i++) {
const ref = refs[i]; const ref = refs[i];

View File

@ -16,7 +16,9 @@ describe('Helpers', function () {
const TestClass = function (data: unknown) { const TestClass = function (data: unknown) {
return data; return data;
}; };
const testInstance = new (TestClass as any)({ testData: 'test' }); const testInstance = new (TestClass as any)({
testData: 'test',
}) as unknown;
expect( expect(
refer(testInstance, 'testType', false, [TestClass as any]) refer(testInstance, 'testType', false, [TestClass as any])
).toMatchSnapshot(); ).toMatchSnapshot();

View File

@ -40,8 +40,8 @@
"@types/react-redux": "^7.1.20", "@types/react-redux": "^7.1.20",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"css-loader": "^6.4.0", "css-loader": "^6.4.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",

View File

@ -43,8 +43,8 @@
"@babel/preset-typescript": "^7.15.0", "@babel/preset-typescript": "^7.15.0",
"@redux-devtools/core": "^3.9.0", "@redux-devtools/core": "^3.9.0",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-react": "^7.26.1", "eslint-plugin-react": "^7.26.1",

View File

@ -64,8 +64,8 @@
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@types/styled-components": "^5.1.15", "@types/styled-components": "^5.1.15",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"csstype": "^3.0.9", "csstype": "^3.0.9",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6", "enzyme-adapter-react-16": "^1.15.6",
@ -80,9 +80,9 @@
"react-is": "^16.13.1", "react-is": "^16.13.1",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"styled-components": "^5.3.3", "styled-components": "^5.3.3",
"stylelint": "^13.13.1", "stylelint": "^14.0.0",
"stylelint-config-prettier": "^9.0.3", "stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^22.0.0", "stylelint-config-standard": "^23.0.0",
"stylelint-config-styled-components": "^0.1.1", "stylelint-config-styled-components": "^0.1.1",
"stylelint-processor-styled-components": "^1.10.0", "stylelint-processor-styled-components": "^1.10.0",
"ts-jest": "^27.0.7", "ts-jest": "^27.0.7",

View File

@ -1,5 +1,6 @@
import styled from 'styled-components'; import styled, { ThemedStyledProps } from 'styled-components';
import color from '../../utils/color'; import color from '../../utils/color';
import { Theme } from '../../themes/default';
export const MainContainerWrapper = styled.div` export const MainContainerWrapper = styled.div`
display: flex; display: flex;
@ -7,7 +8,9 @@ export const MainContainerWrapper = styled.div`
width: 100%; width: 100%;
flex-flow: column nowrap; flex-flow: column nowrap;
overflow: auto; overflow: auto;
background-color: ${(props) => color(props.theme.base00, 'lighten', 0.03)}; ${/* eslint-disable-next-line @typescript-eslint/ban-types */ ''}
background-color: ${(props: ThemedStyledProps<{}, Theme>) =>
color(props.theme.base00, 'lighten', 0.03)};
color: ${(props) => props.theme.base07}; color: ${(props) => props.theme.base07};
font-size: 12px; font-size: 12px;

View File

@ -65,15 +65,15 @@ export default function createStyledComponent<
): StyledComponent<C, Theme | Base16Theme, O> { ): StyledComponent<C, Theme | Base16Theme, O> {
return (styled as ThemedStyledInterface<Theme>)((component || 'div') as C)` return (styled as ThemedStyledInterface<Theme>)((component || 'div') as C)`
${(props: ThemedStyledProps<StyledComponentPropsWithRef<C> & O, Theme>) => ${(props: ThemedStyledProps<StyledComponentPropsWithRef<C> & O, Theme>) =>
isThemeFromProvider(props.theme) isThemeFromProvider(props.theme as Theme | Base16Theme)
? getStyle(styles, props.theme.type) ? getStyle(styles, props.theme.type as string)
: // used outside of container (theme provider) : // used outside of container (theme provider)
getStyle( getStyle(
styles, styles,
'default' 'default'
)({ )({
...props, ...props,
theme: getDefaultTheme(props.theme), theme: getDefaultTheme(props.theme as Base16Theme),
})} })}
` as StyledComponent<C, Theme | Base16Theme, O>; ` as StyledComponent<C, Theme | Base16Theme, O>;
} }

View File

@ -2,7 +2,7 @@
exports[`Container renders correctly 1`] = ` exports[`Container renders correctly 1`] = `
<div <div
class="sc-bdvvtL htahit" class="sc-bdvvtL gyKeHC"
> >
Text Text
</div> </div>

View File

@ -48,8 +48,8 @@
"@types/jsan": "^3.1.2", "@types/jsan": "^3.1.2",
"@types/lodash": "^4.14.176", "@types/lodash": "^4.14.176",
"@types/node": "^14.17.27", "@types/node": "^14.17.27",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",

View File

@ -71,14 +71,15 @@ export function getActionsArray(actionCreators: {
return flatTree(actionCreators); return flatTree(actionCreators);
} }
const interpretArg = (arg: string): unknown =>
// eslint-disable-next-line @typescript-eslint/no-implied-eval // eslint-disable-next-line @typescript-eslint/no-implied-eval
const interpretArg = (arg: string) => new Function('return ' + arg)(); new Function('return ' + arg)();
function evalArgs(inArgs: string[], restArgs: string) { function evalArgs(inArgs: string[], restArgs: string): unknown[] {
const args = inArgs.map(interpretArg); const args = inArgs.map(interpretArg);
if (!restArgs) return args; if (!restArgs) return args;
const rest = interpretArg(restArgs); const rest = interpretArg(restArgs);
if (Array.isArray(rest)) return args.concat(...rest); if (Array.isArray(rest)) return args.concat(...(rest as unknown[]));
throw new Error('rest must be an array'); throw new Error('rest must be an array');
} }

View File

@ -42,8 +42,8 @@
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@types/webpack-env": "^1.16.3", "@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",

View File

@ -1,4 +1,10 @@
import { createStore, applyMiddleware, compose, PreloadedState } from 'redux'; import {
createStore,
applyMiddleware,
compose,
PreloadedState,
Reducer,
} from 'redux';
import { persistState } from '@redux-devtools/core'; import { persistState } from '@redux-devtools/core';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import rootReducer, { CounterState } from '../reducers'; import rootReducer, { CounterState } from '../reducers';
@ -23,7 +29,7 @@ export default function configureStore(
if (module.hot) { if (module.hot) {
module.hot.accept('../reducers', () => module.hot.accept('../reducers', () =>
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
store.replaceReducer(require('../reducers').default) store.replaceReducer(require('../reducers').default as Reducer)
); );
} }

View File

@ -55,8 +55,8 @@
"@types/react-redux": "^7.1.20", "@types/react-redux": "^7.1.20",
"@types/webpack": "^5.28.0", "@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.3.1", "@types/webpack-dev-server": "^4.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"babel-loader": "^8.2.3", "babel-loader": "^8.2.3",
"css-loader": "^6.4.0", "css-loader": "^6.4.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",

View File

@ -54,8 +54,8 @@
"@types/node": "^14.17.27", "@types/node": "^14.17.27",
"@types/react": "^16.14.18", "@types/react": "^16.14.18",
"@types/react-redux": "^7.1.20", "@types/react-redux": "^7.1.20",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.1.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^25.2.2", "eslint-plugin-jest": "^25.2.2",

View File

@ -36,9 +36,9 @@ export default function persistState<
} }
return (next) => return (next) =>
<S, A extends Action<unknown>>( <S2, A2 extends Action<unknown>>(
reducer: Reducer<S, A>, reducer: Reducer<S2, A2>,
initialState?: PreloadedState<S> initialState?: PreloadedState<S2>
) => { ) => {
const key = `redux-dev-session-${sessionId}`; const key = `redux-dev-session-${sessionId}`;
@ -46,7 +46,9 @@ export default function persistState<
try { try {
const json = localStorage.getItem(key); const json = localStorage.getItem(key);
if (json) { if (json) {
finalInitialState = deserialize(JSON.parse(json)) || initialState; finalInitialState =
deserialize(JSON.parse(json) as LiftedState<S, A, MonitorState>) ||
initialState;
next(reducer, initialState); next(reducer, initialState);
} }
} catch (e) { } catch (e) {
@ -60,12 +62,12 @@ export default function persistState<
const store = next( const store = next(
reducer, reducer,
finalInitialState as PreloadedState<S> | undefined finalInitialState as PreloadedState<S2> | undefined
); );
return { return {
...store, ...store,
dispatch<T extends A>(action: T) { dispatch<T extends A2>(action: T) {
store.dispatch(action); store.dispatch(action);
try { try {

695
yarn.lock

File diff suppressed because it is too large Load Diff