Skip to content

Commit 09d1c06

Browse files
authored
Update prettier and add import sorting (#11742)
* Update package * Adjust prettier config and reformat * Auto sort imports
1 parent 42fdebd commit 09d1c06

File tree

400 files changed

+2421
-5665
lines changed

Some content is hidden

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

400 files changed

+2421
-5665
lines changed

airbyte-webapp/.eslintrc

+16
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@
2020
},
2121
"rules": {
2222
"prettier/prettier": "error",
23+
"import/order": ["error", {
24+
"newlines-between": "always",
25+
"groups": ["type", "builtin", "external", "internal", ["parent", "sibling"], "index"],
26+
"pathGroupsExcludedImportTypes": ["builtin"],
27+
"pathGroups": [
28+
{
29+
"pattern": "components{/**,}",
30+
"group": "internal"
31+
},
32+
{
33+
"pattern": "+(config|core|hooks|locales|packages|pages|services|utils|views){/**,}",
34+
"group": "internal",
35+
"position": "after"
36+
}
37+
]
38+
}],
2339
"@typescript-eslint/ban-ts-comment": [
2440
"warn",
2541
{

airbyte-webapp/.prettierrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
printWidth: 120,
3+
};

airbyte-webapp/package-lock.json

+231-174
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

airbyte-webapp/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@
8080
"@types/react-widgets": "^4.4.7",
8181
"@types/sanitize-html": "^2.6.2",
8282
"@types/styled-components": "^5.1.23",
83-
"@typescript-eslint/eslint-plugin": "^5.12.1",
84-
"@typescript-eslint/parser": "^5.12.1",
85-
"eslint-config-prettier": "^8.4.0",
83+
"@typescript-eslint/eslint-plugin": "^5.18.0",
84+
"@typescript-eslint/parser": "^5.18.0",
85+
"eslint-config-prettier": "^8.5.0",
8686
"eslint-config-react-app": "^7.0.0",
8787
"eslint-plugin-jest": "^26.1.1",
8888
"eslint-plugin-prettier": "^4.0.0",
8989
"express": "^4.17.3",
9090
"husky": "^4.2.3",
9191
"license-checker": "^25.0.1",
9292
"lint-staged": "^12.3.4",
93-
"prettier": "2.2.1",
93+
"prettier": "^2.6.2",
9494
"react-scripts": "^5.0.0",
9595
"react-select-event": "^5.3.0",
9696
"storybook-addon-mock": "^2.3.1",

airbyte-webapp/src/App.tsx

+9-15
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ import { ThemeProvider } from "styled-components";
33
import { IntlProvider } from "react-intl";
44
import { BrowserRouter as Router } from "react-router-dom";
55

6+
import NotificationService from "hooks/services/Notification";
7+
import { AnalyticsProvider } from "views/common/AnalyticsProvider";
8+
import { FeatureService } from "hooks/services/Feature";
9+
import { ServicesProvider } from "core/servicesProvider";
10+
import { ApiServices } from "core/ApiServices";
11+
import { StoreProvider } from "views/common/StoreProvider";
12+
613
import en from "./locales/en.json";
714
import GlobalStyle from "./global-styles";
815
import { theme } from "./theme";
9-
1016
import { Routing } from "./pages/routes";
1117
import LoadingPage from "./components/LoadingPage";
1218
import ApiErrorBoundary from "./components/ApiErrorBoundary";
13-
import NotificationService from "hooks/services/Notification";
14-
import { AnalyticsProvider } from "views/common/AnalyticsProvider";
15-
import { FeatureService } from "hooks/services/Feature";
16-
import { ServicesProvider } from "core/servicesProvider";
17-
import { ApiServices } from "core/ApiServices";
1819
import {
1920
Config,
2021
ConfigServiceProvider,
@@ -24,7 +25,6 @@ import {
2425
windowConfigProvider,
2526
} from "./config";
2627
import { WorkspaceServiceProvider } from "./services/workspaces/WorkspacesService";
27-
import { StoreProvider } from "views/common/StoreProvider";
2828

2929
const StyleProvider: React.FC = ({ children }) => (
3030
<ThemeProvider theme={theme}>
@@ -45,10 +45,7 @@ const I18NProvider: React.FC = ({ children }) => (
4545
</IntlProvider>
4646
);
4747

48-
const configProviders: ValueProvider<Config> = [
49-
envConfigProvider,
50-
windowConfigProvider,
51-
];
48+
const configProviders: ValueProvider<Config> = [envConfigProvider, windowConfigProvider];
5249

5350
const Services: React.FC = ({ children }) => (
5451
<AnalyticsProvider>
@@ -72,10 +69,7 @@ const App: React.FC = () => {
7269
<StoreProvider>
7370
<ServicesProvider>
7471
<Suspense fallback={<LoadingPage />}>
75-
<ConfigServiceProvider
76-
defaultConfig={defaultConfig}
77-
providers={configProviders}
78-
>
72+
<ConfigServiceProvider defaultConfig={defaultConfig} providers={configProviders}>
7973
<Router>
8074
<Services>
8175
<Routing />

airbyte-webapp/src/components/ApiErrorBoundary/ApiErrorBoundary.tsx

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
2-
32
import { FormattedMessage } from "react-intl";
3+
44
import { isVersionError } from "core/request/VersionError";
55
import { ErrorOccurredView } from "views/common/ErrorOccurredView";
66
import { StartOverErrorView } from "views/common/StartOverErrorView";
@@ -20,11 +20,7 @@ class ApiErrorBoundary extends React.Component<unknown, BoundaryState> {
2020
this.state = {};
2121
}
2222

23-
static getDerivedStateFromError(error: {
24-
message: string;
25-
status?: number;
26-
__type?: string;
27-
}): BoundaryState {
23+
static getDerivedStateFromError(error: { message: string; status?: number; __type?: string }): BoundaryState {
2824
// Update state so the next render will show the fallback UI.
2925
if (isVersionError(error)) {
3026
return { errorId: ErrorId.VersionMismatch, message: error.message };
@@ -49,11 +45,7 @@ class ApiErrorBoundary extends React.Component<unknown, BoundaryState> {
4945
}
5046

5147
if (this.state.errorId === ErrorId.ServerUnavailable) {
52-
return (
53-
<ErrorOccurredView
54-
message={<FormattedMessage id="webapp.cannotReachServer" />}
55-
/>
56-
);
48+
return <ErrorOccurredView message={<FormattedMessage id="webapp.cannotReachServer" />} />;
5749
}
5850

5951
return !this.state.errorId ? (

airbyte-webapp/src/components/ArrayOfObjectsEditor/ArrayOfObjectsEditor.tsx

+7-33
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,14 @@ type ArrayOfObjectsEditorProps<T extends { name: string }> = {
4141
function ArrayOfObjectsEditor<T extends { name: string } = { name: string }>(
4242
props: ArrayOfObjectsEditorProps<T>
4343
): JSX.Element {
44-
const {
45-
onStartEdit,
46-
onDone,
47-
onRemove,
48-
onCancelEdit,
49-
items,
50-
editableItemIndex,
51-
children,
52-
mainTitle,
53-
addButtonText,
54-
} = props;
55-
const onAddItem = React.useCallback(() => onStartEdit(items.length), [
56-
onStartEdit,
57-
items,
58-
]);
44+
const { onStartEdit, onDone, onRemove, onCancelEdit, items, editableItemIndex, children, mainTitle, addButtonText } =
45+
props;
46+
const onAddItem = React.useCallback(() => onStartEdit(items.length), [onStartEdit, items]);
5947

60-
const isEditMode =
61-
editableItemIndex !== null && editableItemIndex !== undefined;
48+
const isEditMode = editableItemIndex !== null && editableItemIndex !== undefined;
6249

6350
if (isEditMode) {
64-
const item =
65-
typeof editableItemIndex === "number"
66-
? items[editableItemIndex]
67-
: undefined;
51+
const item = typeof editableItemIndex === "number" ? items[editableItemIndex] : undefined;
6852

6953
return (
7054
<Content>
@@ -77,11 +61,7 @@ function ArrayOfObjectsEditor<T extends { name: string } = { name: string }>(
7761
</SmallButton>
7862
)}
7963
{onDone && (
80-
<SmallButton
81-
onClick={onDone}
82-
type="button"
83-
data-testid="done-button"
84-
>
64+
<SmallButton onClick={onDone} type="button" data-testid="done-button">
8565
<FormattedMessage id="form.done" />
8666
</SmallButton>
8767
)}
@@ -102,13 +82,7 @@ function ArrayOfObjectsEditor<T extends { name: string } = { name: string }>(
10282
{items.length ? (
10383
<ItemsList>
10484
{items.map((item, key) => (
105-
<EditorRow
106-
key={`form-item-${key}`}
107-
name={item.name}
108-
id={key}
109-
onEdit={onStartEdit}
110-
onRemove={onRemove}
111-
/>
85+
<EditorRow key={`form-item-${key}`} name={item.name} id={key} onEdit={onStartEdit} onRemove={onRemove} />
11286
))}
11387
</ItemsList>
11488
) : null}

airbyte-webapp/src/components/ArrayOfObjectsEditor/components/EditorHeader.tsx

+3-15
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,11 @@ type EditorHeaderProps = {
2323
onAddItem: () => void;
2424
};
2525

26-
const EditorHeader: React.FC<EditorHeaderProps> = ({
27-
itemsCount,
28-
onAddItem,
29-
mainTitle,
30-
addButtonText,
31-
}) => {
26+
const EditorHeader: React.FC<EditorHeaderProps> = ({ itemsCount, onAddItem, mainTitle, addButtonText }) => {
3227
return (
3328
<Content>
34-
{mainTitle || (
35-
<FormattedMessage id="form.items" values={{ count: itemsCount }} />
36-
)}
37-
<Button
38-
secondary
39-
type="button"
40-
onClick={onAddItem}
41-
data-testid="addItemButton"
42-
>
29+
{mainTitle || <FormattedMessage id="form.items" values={{ count: itemsCount }} />}
30+
<Button secondary type="button" onClick={onAddItem} data-testid="addItemButton">
4331
{addButtonText || <FormattedMessage id="form.addItems" />}
4432
</Button>
4533
</Content>

airbyte-webapp/src/components/ArrayOfObjectsEditor/components/EditorRow.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,7 @@ type EditorRowProps = {
3939
onRemove: (id: number) => void;
4040
};
4141

42-
const EditorRow: React.FC<EditorRowProps> = ({
43-
name,
44-
id,
45-
onEdit,
46-
onRemove,
47-
}) => {
42+
const EditorRow: React.FC<EditorRowProps> = ({ name, id, onEdit, onRemove }) => {
4843
return (
4944
<Content>
5045
<div>{name || id}</div>

airbyte-webapp/src/components/BarChart/BarChart.tsx

+4-30
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import React from "react";
2-
import {
3-
CartesianGrid,
4-
BarChart as BasicBarChart,
5-
ResponsiveContainer,
6-
XAxis,
7-
YAxis,
8-
Bar,
9-
Label,
10-
} from "recharts";
2+
import { CartesianGrid, BarChart as BasicBarChart, ResponsiveContainer, XAxis, YAxis, Bar, Label } from "recharts";
113
import { barChartColors, theme } from "theme";
124

135
type BarChartProps = {
@@ -20,12 +12,7 @@ type BarChartProps = {
2012
yLabel?: string;
2113
};
2214

23-
const BarChart: React.FC<BarChartProps> = ({
24-
data,
25-
legendLabels,
26-
xLabel,
27-
yLabel,
28-
}) => {
15+
const BarChart: React.FC<BarChartProps> = ({ data, legendLabels, xLabel, yLabel }) => {
2916
const chartLinesColor = theme.greyColor20;
3017
const chartTicksColor = theme.lightTextColor;
3118

@@ -51,21 +38,8 @@ const BarChart: React.FC<BarChartProps> = ({
5138
tick={{ fontSize: "11px" }}
5239
tickSize={7}
5340
/>
54-
<YAxis
55-
axisLine={false}
56-
tickLine={false}
57-
stroke={chartTicksColor}
58-
tick={{ fontSize: "11px" }}
59-
tickSize={10}
60-
>
61-
<Label
62-
value={yLabel}
63-
fontSize={11}
64-
fill={chartTicksColor}
65-
fontWeight={600}
66-
position="top"
67-
offset={10}
68-
/>
41+
<YAxis axisLine={false} tickLine={false} stroke={chartTicksColor} tick={{ fontSize: "11px" }} tickSize={10}>
42+
<Label value={yLabel} fontSize={11} fill={chartTicksColor} fontWeight={600} position="top" offset={10} />
6943
</YAxis>
7044
{legendLabels.map((barName, key) => (
7145
<Bar dataKey={barName} fill={barChartColors[key]} />

airbyte-webapp/src/components/Breadcrumbs/Breadcrumbs.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,10 @@ const Breadcrumbs: React.FC<IProps> = ({ data }) => {
3131
<BreadcrumbsContainer>
3232
{data.map((item, key) =>
3333
key === lastIndex ? (
34-
<LastBreadcrumbsItem key={`breadcrumbs-item-${key}`}>
35-
{item.name}
36-
</LastBreadcrumbsItem>
34+
<LastBreadcrumbsItem key={`breadcrumbs-item-${key}`}>{item.name}</LastBreadcrumbsItem>
3735
) : (
3836
<span key={`breadcrumbs-item-${key}`}>
39-
<BreadcrumbsItem onClick={item.onClick}>
40-
{item.name}
41-
</BreadcrumbsItem>
37+
<BreadcrumbsItem onClick={item.onClick}>{item.name}</BreadcrumbsItem>
4238
<span> / </span>
4339
</span>
4440
)

airbyte-webapp/src/components/CenteredPageComponents/BigButton.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const BigButton = styled(Button)<{ shadow?: boolean }>`
66
line-height: 19px;
77
padding: 10px 27px;
88
font-weight: 500;
9-
box-shadow: ${({ shadow }) =>
10-
shadow ? "0 8px 5px -5px rgba(0, 0, 0, 0.2)" : "none"};
9+
box-shadow: ${({ shadow }) => (shadow ? "0 8px 5px -5px rgba(0, 0, 0, 0.2)" : "none")};
1110
`;
1211

1312
export default BigButton;

airbyte-webapp/src/components/CenteredPageComponents/PageViewContainer.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from "react";
22

3-
import PaddedCard from "./PaddedCard";
43
import BaseClearView from "components/BaseClearView";
54

5+
import PaddedCard from "./PaddedCard";
6+
67
const PageViewContainer: React.FC = (props) => {
78
return (
89
<BaseClearView>

airbyte-webapp/src/components/ConnectionBlock/ConnectionBlock.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ const ExtraBlock = styled(Content)`
3333

3434
const ConnectionBlock: React.FC<IProps> = (props) => (
3535
<LightContentCard className={props.className}>
36-
{props.itemFrom ? (
37-
<ConnectionBlockItem {...props.itemFrom} />
38-
) : (
39-
<ExtraBlock />
40-
)}
36+
{props.itemFrom ? <ConnectionBlockItem {...props.itemFrom} /> : <ExtraBlock />}
4137
<Arrow icon={faChevronRight} />
4238
{props.itemTo ? <ConnectionBlockItem {...props.itemTo} /> : <ExtraBlock />}
4339
</LightContentCard>

airbyte-webapp/src/components/ConnectionBlock/components/ConnectionBlockItem.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import styled from "styled-components";
3+
34
import ImageBlock from "components/ImageBlock";
45

56
type IProps = {

airbyte-webapp/src/components/ConnectorBlocks/ItemTabs.tsx

+1-8
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ const steps = [
2525
];
2626

2727
const ItemTabs: React.FC<IProps> = ({ currentStep, setCurrentStep }) => {
28-
return (
29-
<StepsMenu
30-
lightMode
31-
data={steps}
32-
activeStep={currentStep}
33-
onSelect={setCurrentStep}
34-
/>
35-
);
28+
return <StepsMenu lightMode data={steps} activeStep={currentStep} onSelect={setCurrentStep} />;
3629
};
3730

3831
export default ItemTabs;

airbyte-webapp/src/components/ConnectorBlocks/TableItemTitle.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { FormattedMessage, useIntl } from "react-intl";
55
import { Button, DropDownRow, H3, H5 } from "components";
66
import { Popout } from "components/base/Popout/Popout";
77
import { ReleaseStageBadge } from "components/ReleaseStageBadge";
8+
89
import { ReleaseStage } from "core/domain/connector";
910
import { FeatureItem, useFeatureService } from "hooks/services/Feature";
1011

airbyte-webapp/src/components/ContentCard/ContentCard.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ type IProps = {
1414
const Title = styled(H5)<{ light?: boolean }>`
1515
padding: ${({ light }) => (light ? "19px 20px 20px" : "25px 25px 22px")};
1616
color: ${({ theme }) => theme.darkPrimaryColor};
17-
box-shadow: ${({ light, theme }) =>
18-
light ? "none" : `0 1px 2px ${theme.shadowColor}`};
17+
box-shadow: ${({ light, theme }) => (light ? "none" : `0 1px 2px ${theme.shadowColor}`)};
1918
font-weight: 600;
2019
letter-spacing: 0.008em;
2120
border-radius: 10px 10px 0 0;

0 commit comments

Comments
 (0)