Skip to content

Commit 4592c4a

Browse files
committed
update essex tooling
1 parent a2abb4d commit 4592c4a

File tree

107 files changed

+927
-815
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+927
-815
lines changed

.eslintignore

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ lib/
66
coverage/
77
public/
88
.yarn/
9+
.yarnrc.yaml
10+
yarn.lock
911
.pnp.js
1012
.pnp.cjs
1113
.cache/
12-
node_modules/
1314
pkg/
1415
target/
1516
.eslintrc.js
16-
babel.config.js
17+
babel.config.js
18+
target/
19+
bot_backups/*
20+
DATA_REVIEW.md

.eslintrc.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
* Licensed under the MIT license. See LICENSE file in the project.
44
*/
55
module.exports = {
6-
extends: '@essex/eslint-config',
6+
root: true,
7+
extends: ['@essex/eslint-config/fast'],
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: {
10+
project: './tsconfig.json',
11+
},
712
rules: {
813
'@typescript-eslint/no-explicit-any': 'off',
914
'no-redeclare': 'off',
@@ -12,6 +17,7 @@ module.exports = {
1217
'warn',
1318
{ allowArgumentsExplicitlyTypedAsAny: true },
1419
],
20+
1521
// TODO: Re-enable
1622
'jsx-a11y/click-events-have-key-events': 0,
1723
'jsx-a11y/no-static-element-interactions': 0,

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn git:precommit

.lintstagedrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"*": ["essex prettify --staged"],
3-
"*.{js,jsx,ts,tsx}": ["essex lint --fix --staged"]
3+
"*.{js,jsx,ts,tsx}": ["eslint --fix"]
44
}

.prettierignore

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
.yarn/
2-
.yarnrc.yml
3-
yarn.lock
4-
.pnp.js
5-
.pnp.cjs
61
node_modules/
72
storybook-static/
83
build/
94
dist/
105
lib/
116
coverage/
127
public/
8+
.yarn/
9+
.yarnrc.yml
10+
yarn.lock
11+
.pnp.js
12+
.pnp.cjs
13+
.cache/
14+
pkg/
15+
target/
16+
.eslintrc.js
17+
babel.config.js
18+
target/
1319
bot_backups/*
14-
DATA_REVIEW.md
15-
.cache
16-
.eslintrc
20+
DATA_REVIEW.md

package.json

+14-11
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,38 @@
33
"private": true,
44
"license": "MIT",
55
"scripts": {
6+
"postinstall": "husky install",
67
"clean:": "yarn workspaces foreach -pv run clean",
78
"build:": "yarn workspaces foreach -ivt run build",
89
"start:": "yarn workspaces foreach -piv run start",
9-
"lint:": "essex lint --fix --strict",
10+
"lint:check": "eslint \"./packages/*/src/**/*.{js,jsx,ts,tsx}\"",
11+
"lint": "eslint --fix \"./packages/*/src/**/*.{js,jsx,ts,tsx}\"",
12+
"format:check": "prettier --check \"./packages/*/src/**/*.{js,jsx,ts,tsx}\"",
13+
"format": "prettier --write \"./packages/*/src/**/*.{js,jsx,ts,tsx}\"",
1014
"build:lib-wasm": "cd packages/lib-wasm && wasm-pack build --release --target web --out-dir ../../target/wasm",
11-
"prettify:": "essex prettify",
12-
"rebuild-all": "cargo clean && run-s clean: && cargo build --release && run-s build:lib-wasm && yarn install && run-s build:"
15+
"rebuild-all": "cargo clean && run-s clean: && cargo build --release && run-s build:lib-wasm && yarn install && run-s build:",
16+
"git:precommit": "lint-staged"
1317
},
1418
"prettier": "@essex/prettier-config",
1519
"devDependencies": {
1620
"@babel/core": "^7.17.0",
1721
"@babel/preset-env": "^7.16.11",
1822
"@babel/preset-react": "^7.16.7",
1923
"@babel/preset-typescript": "^7.16.7",
20-
"@essex/eslint-config": "^19.0.2",
21-
"@essex/eslint-plugin": "^19.0.2",
22-
"@essex/jest-config": "^19.0.2",
24+
"@essex/eslint-config": "^20.3.1",
25+
"@essex/eslint-plugin": "^20.3.2",
26+
"@essex/jest-config": "^21.0.8",
2327
"@essex/prettier-config": "^18.0.2",
24-
"@essex/scripts": "^19.0.6",
28+
"@essex/scripts": "^20.5.2",
2529
"@types/eslint": "^8.4.1",
2630
"@types/prettier": "^2.4.3",
27-
"@typescript-eslint/eslint-plugin": "^5.10.2",
28-
"@typescript-eslint/parser": "^5.10.2",
29-
"eslint": "^8.8.0",
31+
"@typescript-eslint/eslint-plugin": "^5.15.0",
32+
"@typescript-eslint/parser": "^5.15.0",
33+
"eslint": "^8.11.0",
3034
"eslint-import-resolver-node": "^0.3.6",
3135
"husky": "^7.0.4",
3236
"jest": "^27.4.7",
3337
"lint-staged": "^12.3.3",
34-
"npm-run-all": "^4.1.5",
3538
"prettier": "^2.5.1",
3639
"typescript": "4.4.3"
3740
},

packages/webapp/.eslintrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"rules": {
3+
"import/extensions": [
4+
"error",
5+
"never",
6+
{
7+
"ignorePackages": true
8+
}
9+
]
10+
}
11+
}

packages/webapp/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"yup": "^0.32.11"
4848
},
4949
"devDependencies": {
50-
"@essex/scripts": "^19.0.6",
5150
"@essex/vite-config": "^18.0.2",
5251
"@types/dompurify": "^2.3.3",
5352
"@types/lodash": "^4.14.178",
@@ -62,7 +61,6 @@
6261
"@types/styled-components": "^5.1.21",
6362
"@types/uuid": "^8.3.4",
6463
"@types/yup": "^0.29.13",
65-
"npm-run-all": "^4.1.5",
6664
"sds-wasm": "file:../../target/wasm",
6765
"ts-node": "^10.4.0",
6866
"typescript": "4.4.3",

packages/webapp/src/components/App/App.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
import { memo } from 'react'
66
import { HashRouter } from 'react-router-dom'
7+
78
import { ChartContext } from './ChartContext'
89
import { DataContext } from './DataContext'
910
import { Layout } from './Layout'

packages/webapp/src/components/App/ChartContext.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
* Copyright (c) Microsoft. All rights reserved.
33
* Licensed under the MIT license. See LICENSE file in the project.
44
*/
5+
import 'chart.js/auto'
6+
57
import { useThematic } from '@thematic/react'
68
import { Chart } from 'chart.js'
7-
import 'chart.js/auto'
89
import { merge } from 'lodash'
910
import { memo, useEffect } from 'react'
1011

packages/webapp/src/components/App/Layout.tsx

+9-7
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
import { Spinner, Stack } from '@fluentui/react'
66
import React, { memo, Suspense } from 'react'
77
import styled from 'styled-components'
8-
import { Pages } from './Pages'
8+
99
import { NavBar } from '~components/NavBar'
1010

11+
import { Pages } from './Pages'
12+
1113
export const Layout: React.FC = memo(function Layout({ children }) {
12-
const menuItems = Object.keys(Pages)
13-
.filter(k => !Pages[k].hideFromMenu)
14-
.map(k => ({
15-
key: Pages[k].name,
16-
text: Pages[k].name,
17-
pagePath: Pages[k].path,
14+
const menuItems = Object.values(Pages)
15+
.filter(page => !page.hideFromMenu)
16+
.map(({ name, path }) => ({
17+
key: name,
18+
text: name,
19+
pagePath: path,
1820
}))
1921

2022
return (

packages/webapp/src/components/App/Pages.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
* Copyright (c) Microsoft. All rights reserved.
33
* Licensed under the MIT license. See LICENSE file in the project.
44
*/
5-
export const Pages = {
5+
6+
export type PageDetails = {
7+
name: string
8+
path: string
9+
hideFromMenu: boolean
10+
}
11+
export const Pages: Record<string, PageDetails> = {
612
DataShowcase: {
713
name: 'Synthetic Data Showcase',
814
path: '/sds',
15+
hideFromMenu: false,
916
},
1017
}

packages/webapp/src/components/App/Routes.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
* Licensed under the MIT license. See LICENSE file in the project.
44
*/
55
import React, { lazy, memo } from 'react'
6-
import { Routes as Switch, Route, Navigate } from 'react-router-dom'
6+
import { Navigate, Route, Routes as Switch } from 'react-router-dom'
7+
78
import { Pages } from './Pages'
89

910
const DataShowcasePageLazy = lazy(
10-
() =>
11-
/* webpackChunkName: "EvaluationPage" */ import(
12-
'~components/Pages/DataShowcasePage'
13-
),
11+
async () =>
12+
/* webpackChunkName: "EvaluationPage" */
13+
await import('~components/Pages/DataShowcasePage'),
1414
)
1515

1616
export const Routes: React.FC = memo(function Routes() {

packages/webapp/src/components/AttributeIntersectionValueChartLegend/AttributeIntersectionValueChartLegend.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
* Copyright (c) Microsoft. All rights reserved.
33
* Licensed under the MIT license. See LICENSE file in the project.
44
*/
5-
import { IStackTokens, Label, useTheme } from '@fluentui/react'
6-
import { Stack } from '@fluentui/react'
5+
import type { IStackTokens } from '@fluentui/react'
6+
import { Label, Stack, useTheme } from '@fluentui/react'
77
import { memo } from 'react'
88
import styled from 'styled-components'
9+
910
import { useActualNominalColor, useEstimatedNominalColor } from './hooks'
1011

1112
export const AttributeIntersectionValueChartLegend: React.FC = memo(

packages/webapp/src/components/AttributeSelector/ColumnAttributeSelector.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
* Copyright (c) Microsoft. All rights reserved.
33
* Licensed under the MIT license. See LICENSE file in the project.
44
*/
5-
import { Stack, Label, Spinner } from '@fluentui/react'
5+
import { Label, Spinner, Stack } from '@fluentui/react'
66
import { memo, useCallback, useEffect, useRef, useState } from 'react'
7-
import { IAttributesIntersection } from 'sds-wasm'
8-
import { useMaxCount } from './hooks'
7+
import type { IAttributesIntersection } from 'sds-wasm'
8+
99
import { AttributeIntersectionValueChart } from '~components/Charts/AttributeIntersectionValueChart'
1010
import { useStopPropagation } from '~components/Charts/hooks'
11-
import { SetSelectedAttributesCallback } from '~components/Pages/DataShowcasePage/DataNavigation'
11+
import type { SetSelectedAttributesCallback } from '~components/Pages/DataShowcasePage/DataNavigation'
1212
import { useWasmWorkerValue } from '~states'
1313

14+
import { useMaxCount } from './hooks'
15+
1416
export interface ColumnAttributeSelectorProps {
1517
headerName: string
1618
columnIndex: number

packages/webapp/src/components/AttributeSelector/ColumnAttributeSelectorGrid.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
*/
55
import { Stack, useTheme } from '@fluentui/react'
66
import { memo } from 'react'
7-
import { HeaderNames, ISelectedAttributesByColumn } from 'sds-wasm'
8-
import { ColumnAttributeSelector } from './ColumnAttributeSelector'
7+
import type { HeaderNames, ISelectedAttributesByColumn } from 'sds-wasm'
8+
99
import { AttributeIntersectionValueChartLegend } from '~components/AttributeIntersectionValueChartLegend'
1010
import { useHorizontalScrolling } from '~components/Charts/hooks'
11-
import { SetSelectedAttributesCallback } from '~components/Pages/DataShowcasePage/DataNavigation'
11+
import type { SetSelectedAttributesCallback } from '~components/Pages/DataShowcasePage/DataNavigation'
12+
13+
import { ColumnAttributeSelector } from './ColumnAttributeSelector'
1214

1315
export interface ColumnAttributeSelectorGridProps {
1416
viewHeight: string | number

packages/webapp/src/components/AttributeSelector/HeaderSelector.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
* Copyright (c) Microsoft. All rights reserved.
33
* Licensed under the MIT license. See LICENSE file in the project.
44
*/
5-
import { Stack, useTheme, IStackTokens, Checkbox } from '@fluentui/react'
5+
import type { IStackTokens } from '@fluentui/react'
6+
import { Checkbox, Stack, useTheme } from '@fluentui/react'
67
import { memo } from 'react'
7-
import { HeaderNames } from 'sds-wasm'
8+
import type { HeaderNames } from 'sds-wasm'
89

910
export interface HeaderSelectorProps {
1011
headers: HeaderNames

packages/webapp/src/components/AttributeSelector/SelectedAttributes.tsx

+7-11
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@
22
* Copyright (c) Microsoft. All rights reserved.
33
* Licensed under the MIT license. See LICENSE file in the project.
44
*/
5-
import {
6-
CommandButton,
7-
IIconProps,
8-
IStackTokens,
9-
PrimaryButton,
10-
Stack,
11-
useTheme,
12-
} from '@fluentui/react'
5+
import type { IIconProps, IStackTokens } from '@fluentui/react'
6+
import { CommandButton, PrimaryButton, Stack, useTheme } from '@fluentui/react'
137
import { memo } from 'react'
14-
import { HeaderNames, ISelectedAttributesByColumn } from 'sds-wasm'
15-
import { useSelectedAttributesByColumnEntries } from './hooks'
16-
import {
8+
import type { HeaderNames, ISelectedAttributesByColumn } from 'sds-wasm'
9+
10+
import type {
1711
ClearSelectedAttributesCallback,
1812
SetSelectedAttributesCallback,
1913
} from '~components/Pages/DataShowcasePage/DataNavigation'
2014

15+
import { useSelectedAttributesByColumnEntries } from './hooks'
16+
2117
const deleteIcon: IIconProps = { iconName: 'Delete' }
2218

2319
export interface SelectedAttributesProps {

packages/webapp/src/components/AttributeSelector/hooks.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
*/
55
import _ from 'lodash'
66
import { useMemo } from 'react'
7-
import { IAttributesIntersection, ISelectedAttributesByColumn } from 'sds-wasm'
7+
import type {
8+
IAttributesIntersection,
9+
ISelectedAttributesByColumn,
10+
} from 'sds-wasm'
811

912
export function useMaxCount(items: IAttributesIntersection[]): number {
1013
return useMemo(

packages/webapp/src/components/Charts/AttributeIntersectionValueChart.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import type { Plugin } from 'chart.js'
66
import ChartDataLabels from 'chartjs-plugin-datalabels'
77
import { memo, useCallback } from 'react'
88
import { Bar } from 'react-chartjs-2'
9-
import { IAttributesIntersection } from 'sds-wasm'
9+
import type { IAttributesIntersection } from 'sds-wasm'
10+
1011
import {
1112
useActualBarConfig,
1213
useDataLabelsConfig,

packages/webapp/src/components/Charts/MetricsChart.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55
import { memo } from 'react'
66
import { Chart } from 'react-chartjs-2'
7-
import { IMetrics } from '~models'
7+
8+
import type { IMetrics } from '~models'
89

910
export interface IMetricsChart {
1011
label: string

0 commit comments

Comments
 (0)