Skip to content

Commit 1c5adab

Browse files
chore: fix pre-commit prettier linting and add json linting (#484)
1 parent b50db5f commit 1c5adab

File tree

27 files changed

+100
-122
lines changed

27 files changed

+100
-122
lines changed

.eslintrc

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
{
2-
"extends": ["@gravity-ui/eslint-config", "prettier"],
2+
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier"],
33
"root": true,
44
"overrides": [
55
{
6-
"files": [
7-
"config-overrides.js",
8-
"commitlint.config.js"
9-
],
6+
"files": ["config-overrides.js", "commitlint.config.js"],
107
"env": {
118
"node": true
129
}

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
],
6565
"*.{js,jsx,ts,tsx}": [
6666
"eslint --fix --quiet"
67+
],
68+
"*.{json}": [
69+
"prettier --write"
6770
]
6871
},
6972
"jest": {

src/components/QueryResultTable/Cell/Cell.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ interface CellProps {
1111
}
1212

1313
export const Cell = React.memo(function Cell(props: CellProps) {
14-
const {
15-
className,
16-
value,
17-
} = props;
14+
const {className, value} = props;
1815

1916
const dispatch = useDispatch();
2017

21-
useEffect(() => () => {
22-
dispatch(hideTooltip());
23-
}, [dispatch]);
18+
useEffect(
19+
() => () => {
20+
dispatch(hideTooltip());
21+
},
22+
[dispatch],
23+
);
2424

2525
return (
2626
<span
@@ -29,5 +29,5 @@ export const Cell = React.memo(function Cell(props: CellProps) {
2929
>
3030
{value}
3131
</span>
32-
)
32+
);
3333
});
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"empty": "Table is empty"
2+
"empty": "Table is empty"
33
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"empty": "Таблица пустая"
2+
"empty": "Таблица пустая"
33
}

src/components/ShortyString/ShortyString.tsx

+3-6
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ export default function ShortyString({
3333
const [expanded, setExpanded] = React.useState(false);
3434

3535
const toggleLabelAction = expanded ? collapseLabel : expandLabel;
36-
const toggleLabelSymbolsCount = displayLength && !expanded
37-
? i18n('chars_count', {count: value.length})
38-
: '';
36+
const toggleLabelSymbolsCount =
37+
displayLength && !expanded ? i18n('chars_count', {count: value.length}) : '';
3938
const toggleLabel = toggleLabelAction + toggleLabelSymbolsCount;
4039

4140
// showing toogle button with a label that is longer than the hidden part is pointless,
4241
// hence compare to limit + length in the not-strict mode
4342
const hasToggle = value.length > limit + (strict ? 0 : toggleLabel.length);
4443

45-
const text = expanded || !hasToggle
46-
? value
47-
: value.slice(0, limit - 4) + '\u00a0...';
44+
const text = expanded || !hasToggle ? value : value.slice(0, limit - 4) + '\u00a0...';
4845

4946
return (
5047
<div className={block()}>
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"default_collapse_label": "Show less",
3-
"default_expand_label": "Show more",
4-
"chars_count": [
5-
" ({{count}} symbol)",
6-
" ({{count}} symbols)",
7-
" ({{count}} symbols)",
8-
" ({{count}} symbols)"
9-
]
2+
"default_collapse_label": "Show less",
3+
"default_expand_label": "Show more",
4+
"chars_count": [
5+
" ({{count}} symbol)",
6+
" ({{count}} symbols)",
7+
" ({{count}} symbols)",
8+
" ({{count}} symbols)"
9+
]
1010
}
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"default_collapse_label": "Показать меньше",
3-
"default_expand_label": "Показать ещё",
4-
"chars_count": [
5-
" ({{count}} символ)",
6-
" ({{count}} символа)",
7-
" ({{count}} символов)",
8-
" ({{count}} символов)"
9-
]
2+
"default_collapse_label": "Показать меньше",
3+
"default_expand_label": "Показать ещё",
4+
"chars_count": [
5+
" ({{count}} символ)",
6+
" ({{count}} символа)",
7+
" ({{count}} символов)",
8+
" ({{count}} символов)"
9+
]
1010
}

src/components/SpeedMultiMeter/i18n/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@ i18n.registerKeyset(Lang.En, COMPONENT, en);
99
i18n.registerKeyset(Lang.Ru, COMPONENT, ru);
1010

1111
export default i18n.keyset(COMPONENT);
12-
13-

src/components/Stack/Stack.tsx

+16-16
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ const b = cn('stack');
1313

1414
export const Stack: React.FC<StackProps> = ({children, className}) => (
1515
<div className={b(null, className)}>
16-
{
17-
React.Children.map(children, (child, index) => {
18-
if (!React.isValidElement(child)) {
19-
return null;
20-
}
16+
{React.Children.map(children, (child, index) => {
17+
if (!React.isValidElement(child)) {
18+
return null;
19+
}
2120

22-
return (
23-
<div
24-
className={b('layer')}
25-
style={{
21+
return (
22+
<div
23+
className={b('layer')}
24+
style={
25+
{
2626
[LAYER_CSS_VAR]: index,
27-
} as React.CSSProperties}
28-
>
29-
{child}
30-
</div>
31-
);
32-
})
33-
}
27+
} as React.CSSProperties
28+
}
29+
>
30+
{child}
31+
</div>
32+
);
33+
})}
3434
</div>
3535
);

src/components/TableSkeleton/TableSkeleton.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { FC } from 'react';
1+
import {FC} from 'react';
22
import block from 'bem-cn-lite';
3-
import { Skeleton } from '@gravity-ui/uikit';
3+
import {Skeleton} from '@gravity-ui/uikit';
44

55
import './TableSkeleton.scss';
66

@@ -11,7 +11,7 @@ interface TableSkeletonProps {
1111
rows?: number;
1212
}
1313

14-
export const TableSkeleton: FC<TableSkeletonProps> = ({ rows = 2, className }) => (
14+
export const TableSkeleton: FC<TableSkeletonProps> = ({rows = 2, className}) => (
1515
<div className={b(null, className)}>
1616
<div className={b('row')}>
1717
<Skeleton className={b('col-1')} />

src/containers/Cluster/ClusterInfo/ClusterInfo.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import type {TClusterInfo} from '../../../types/api/cluster';
1818
import {backend, customBackend} from '../../../store';
1919
import {formatStorageValues} from '../../../utils';
2020
import {useSetting, useTypedSelector} from '../../../utils/hooks';
21-
import {CLUSTER_DEFAULT_TITLE, CLUSTER_INFO_HIDDEN_KEY, DEVELOPER_UI_TITLE} from '../../../utils/constants';
21+
import {
22+
CLUSTER_DEFAULT_TITLE,
23+
CLUSTER_INFO_HIDDEN_KEY,
24+
DEVELOPER_UI_TITLE,
25+
} from '../../../utils/constants';
2226

2327
import {VersionsBar} from '../VersionsBar/VersionsBar';
2428
import {ClusterInfoSkeleton} from '../ClusterInfoSkeleton/ClusterInfoSkeleton';

src/containers/Node/NodeStructure/PDiskTitleBadge.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@ interface PDiskTitleBadgeProps {
1212
export function PDiskTitleBadge({label, value, className}: PDiskTitleBadgeProps) {
1313
return (
1414
<span className={b('pdisk-title-item', className)}>
15-
{label && (
16-
<span className={b('pdisk-title-item-label')}>
17-
{label}:
18-
</span>
19-
)}
20-
<span className={b('pdisk-title-item-value')}>
21-
{value}
22-
</span>
15+
{label && <span className={b('pdisk-title-item-label')}>{label}:</span>}
16+
<span className={b('pdisk-title-item-value')}>{value}</span>
2317
</span>
2418
);
2519
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"default_message": "Everything is fine!",
3-
"default_button_label": "Show All"
2+
"default_message": "Everything is fine!",
3+
"default_button_label": "Show All"
44
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"default_message": "Всё в порядке!",
3-
"default_button_label": "Показать все"
2+
"default_message": "Всё в порядке!",
3+
"default_button_label": "Показать все"
44
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"empty.default": "No such groups",
3-
"empty.out_of_space": "No groups with out of space errors",
4-
"empty.degraded": "No degraded groups",
5-
"show_all": "Show all groups",
6-
"encrypted": "Encrypted group"
2+
"empty.default": "No such groups",
3+
"empty.out_of_space": "No groups with out of space errors",
4+
"empty.degraded": "No degraded groups",
5+
"show_all": "Show all groups",
6+
"encrypted": "Encrypted group"
77
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"empty.default": "Нет групп",
3-
"empty.out_of_space": "Нет групп, в которых кончается место",
4-
"empty.degraded": "Нет деградировавших групп",
5-
"show_all": "Показать все группы",
6-
"encrypted": "Зашифрованная группа"
2+
"empty.default": "Нет групп",
3+
"empty.out_of_space": "Нет групп, в которых кончается место",
4+
"empty.degraded": "Нет деградировавших групп",
5+
"show_all": "Показать все группы",
6+
"encrypted": "Зашифрованная группа"
77
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
2-
"label": "Usage:",
3-
"default_value": "Any",
4-
"groups_count": [
5-
"{{count}} group",
6-
"{{count}} groups",
7-
"{{count}} groups",
8-
"No groups"
9-
]
2+
"label": "Usage:",
3+
"default_value": "Any",
4+
"groups_count": ["{{count}} group", "{{count}} groups", "{{count}} groups", "No groups"]
105
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
{
2-
"label": "Использование:",
3-
"default_value": "Любое",
4-
"groups_count": [
5-
"{{count}} группа",
6-
"{{count}} группы",
7-
"{{count}} групп",
8-
"Нет групп"
9-
]
2+
"label": "Использование:",
3+
"default_value": "Любое",
4+
"groups_count": ["{{count}} группа", "{{count}} группы", "{{count}} групп", "Нет групп"]
105
}

src/containers/Tenant/ObjectSummary/ObjectSummary.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,10 @@ export function ObjectSummary({
288288
</Button>
289289
)}
290290
{currentSchemaPath && (
291-
<CopyToClipboard text={currentSchemaPath} title={i18n('summary.copySchemaPath')} />
291+
<CopyToClipboard
292+
text={currentSchemaPath}
293+
title={i18n('summary.copySchemaPath')}
294+
/>
292295
)}
293296
<PaneVisibilityToggleButtons
294297
onCollapse={onCollapseInfoHandler}

src/containers/Tenant/i18n/ru.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
2-
"acl.owner": "Владелец",
3-
"acl.empty": "Нет данных об Acl",
2+
"acl.owner": "Владелец",
3+
"acl.empty": "Нет данных об Acl",
44

5-
"summary.navigation": "Навигация",
6-
"summary.showPreview": "Показать превью",
7-
"summary.copySchemaPath": "Скопировать путь"
8-
5+
"summary.navigation": "Навигация",
6+
"summary.showPreview": "Показать превью",
7+
"summary.copySchemaPath": "Скопировать путь"
98
}

src/containers/Tenant/utils/schemaActions.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import type {NavigationTreeNodeType, NavigationTreeProps} from 'ydb-ui-component
44
import {changeUserInput} from '../../../store/reducers/executeQuery';
55
import {setShowPreview} from '../../../store/reducers/schema/schema';
66
import {setQueryTab, setTenantPage} from '../../../store/reducers/tenant/tenant';
7-
import {
8-
TENANT_QUERY_TABS_ID,
9-
TENANT_PAGES_IDS,
10-
} from '../../../store/reducers/tenant/constants';
7+
import {TENANT_QUERY_TABS_ID, TENANT_PAGES_IDS} from '../../../store/reducers/tenant/constants';
118
import createToast from '../../../utils/createToast';
129

1310
const createTableTemplate = (path: string) => {

src/store/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ function configureStore(aRootReducer = rootReducer, singleClusterMode = true) {
3232
export const webVersion = window.web_version;
3333
export const customBackend = window.custom_backend;
3434

35-
export * from "./reducers"
35+
export * from './reducers';
3636

3737
export default configureStore;

src/types/api/cluster.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface TClusterInfo {
3131
Tenants?: string;
3232
/** uint64 */
3333
Tablets?: string;
34-
34+
3535
Balancer?: string; // additional
3636
Solomon?: string; // additional
3737
}

src/types/api/storage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {TVDiskStateInfo} from './vdisk';
33

44
/**
55
* endpoint: /viewer/json/storage
6-
*
6+
*
77
* source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
88
*/
99
export interface TStorageInfo {

src/types/assets.d.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ declare module '*.jpg';
88
declare module '*.jpeg';
99
declare module '*.ico';
1010

11-
declare type SVGIconData =
12-
import('@gravity-ui/uikit/build/esm/components/Icon/types').SVGIconData;
11+
declare type SVGIconData = import('@gravity-ui/uikit/build/esm/components/Icon/types').SVGIconData;

src/utils/tests/providers.tsx

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, {PropsWithChildren} from 'react';
2-
import {Provider} from 'react-redux'
3-
import {render} from '@testing-library/react'
4-
import type {RenderOptions} from '@testing-library/react'
2+
import {Provider} from 'react-redux';
3+
import {render} from '@testing-library/react';
4+
import type {RenderOptions} from '@testing-library/react';
55

66
import configureStore from '../../store';
77

@@ -14,16 +14,13 @@ interface ExtendedRenderOptions extends Omit<RenderOptions, 'queries'> {
1414

1515
export const renderWithStore = (
1616
ui: React.ReactElement,
17-
{
18-
storeConfiguration = configureStore(),
19-
...renderOptions
20-
}: ExtendedRenderOptions = {}
17+
{storeConfiguration = configureStore(), ...renderOptions}: ExtendedRenderOptions = {},
2118
) => {
2219
const {store} = storeConfiguration;
2320

2421
function Wrapper({children}: PropsWithChildren<{}>) {
25-
return <Provider store={store}>{children}</Provider>
22+
return <Provider store={store}>{children}</Provider>;
2623
}
2724

28-
return {store, ...render(ui, {wrapper: Wrapper, ...renderOptions})}
25+
return {store, ...render(ui, {wrapper: Wrapper, ...renderOptions})};
2926
};

0 commit comments

Comments
 (0)