Skip to content

Commit 2ff2290

Browse files
committed
fix: updated with review comments.
1 parent 1d957a2 commit 2ff2290

28 files changed

+201
-160
lines changed

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export default [
115115
'one-var': ['error', 'never'],
116116
'prefer-const': 'error',
117117
radix: ['error', 'as-needed'],
118+
'react/react-in-jsx-scope': 'off',
118119
'react/prop-types': 0,
119120
'react/display-name': 0,
120121
'react-compiler/react-compiler': 'warn',

package-lock.json

Lines changed: 43 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,27 @@
88
"build": "astro check && astro build",
99
"preview": "astro preview",
1010
"astro": "astro",
11+
"prettier": "prettier --write ./src",
1112
"lint": "eslint . --cache --cache-strategy content",
1213
"test": "vitest --config ./tsconfig.vitest.json",
1314
"test:watch": "vitest --watch"
1415
},
16+
"prettier": {
17+
"plugins": [
18+
"prettier-plugin-astro"
19+
],
20+
"overrides": [
21+
{
22+
"files": "*.astro",
23+
"options": {
24+
"parser": "astro"
25+
}
26+
}
27+
],
28+
"semi": false,
29+
"singleQuote": true,
30+
"trailingComma": "all"
31+
},
1532
"dependencies": {
1633
"@astrojs/check": "^0.9.4",
1734
"@astrojs/react": "^3.6.3",
@@ -42,6 +59,8 @@
4259
"eslint-plugin-react-compiler": "^19.0.0-beta-df7b47d-20241124",
4360
"eslint-plugin-react-hooks": "^5.1.0",
4461
"globals": "^15.12.0",
62+
"prettier": "^3.4.2",
63+
"prettier-plugin-astro": "^0.14.1",
4564
"semantic-release": "^24.2.0",
4665
"ts-node": "^10.9.2",
4766
"typescript-eslint": "^8.15.0",

src/__mocks__/styleMock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// We aren't actually using CSS modules, so we don't need to mock what `require('@patternfly/react-styles/css/whatever')` would do
2+
module.exports = {}

src/components/Breadcrumbs.astro

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
import React from 'react';
3-
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";
2+
import { Breadcrumb, BreadcrumbItem } from '@patternfly/react-core'
43
---
54

65
<Breadcrumb>

src/components/KebabDropdownItems.astro

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
2-
import React from "react";
3-
import { DropdownItem } from "@patternfly/react-core";
4-
import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon";
5-
import HelpIcon from "@patternfly/react-icons/dist/esm/icons/help-icon";
2+
import { DropdownItem } from '@patternfly/react-core'
3+
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon'
4+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon'
65
---
76

87
<>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React from "react";
2-
import { DropdownItem } from "@patternfly/react-core";
3-
import CogIcon from "@patternfly/react-icons/dist/esm/icons/cog-icon";
4-
import HelpIcon from "@patternfly/react-icons/dist/esm/icons/help-icon";
1+
import React from 'react'
2+
import { DropdownItem } from '@patternfly/react-core'
3+
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon'
4+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon'
55

66
export const KebabDropdownItems: React.FunctionComponent = () => (
77
<>
@@ -12,4 +12,4 @@ export const KebabDropdownItems: React.FunctionComponent = () => (
1212
<HelpIcon /> Help
1313
</DropdownItem>
1414
</>
15-
);
15+
)

src/components/Masthead.astro

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
import React from "react";
32
import {
43
Brand,
54
Masthead as PFMasthead,
@@ -8,20 +7,20 @@ import {
87
MastheadBrand,
98
MastheadLogo,
109
MastheadContent,
11-
} from "@patternfly/react-core";
12-
import pfLogo from "/PF-HorizontalLogo-Color.svg?url";
13-
import Toolbar from "./Toolbar.astro";
14-
import { PageToggle } from "./PageToggle";
10+
} from '@patternfly/react-core'
11+
import pfLogo from '/PF-HorizontalLogo-Color.svg?url'
12+
import Toolbar from './Toolbar.astro'
13+
import { PageToggle } from './PageToggle'
1514
---
1615

1716
<PFMasthead>
1817
<MastheadMain>
1918
<MastheadToggle>
20-
<PageToggle client:idle/>
19+
<PageToggle client:idle />
2120
</MastheadToggle>
2221
<MastheadBrand>
2322
<MastheadLogo component="a" href="/">
24-
<Brand src={pfLogo} alt="PatternFly" heights={{ default: "36px" }} />
23+
<Brand src={pfLogo} alt="PatternFly" heights={{ default: '36px' }} />
2524
</MastheadLogo>
2625
</MastheadBrand>
2726
</MastheadMain>

src/components/Navigation.astro

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
import React from "react";
3-
import { getCollection } from "astro:content";
2+
import { getCollection } from 'astro:content'
43
5-
import { Navigation as ReactNav } from "./Navigation.tsx";
4+
import { Navigation as ReactNav } from './Navigation.tsx'
65
7-
const navEntries = await getCollection("test");
6+
const navEntries = await getCollection('test')
87
---
98

109
<ReactNav client:idle navEntries={navEntries} />

src/components/Navigation.tsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
import React, { useState } from "react";
1+
import React, { useState } from 'react'
22
import {
33
Nav,
44
NavList,
55
NavItem,
66
PageSidebar,
77
PageSidebarBody,
8-
} from "@patternfly/react-core";
9-
import { useStore } from "@nanostores/react";
10-
import { isNavOpen } from "../stores/navStore";
8+
} from '@patternfly/react-core'
9+
import { useStore } from '@nanostores/react'
10+
import { isNavOpen } from '../stores/navStore'
1111

1212
interface NavOnSelectProps {
13-
groupId: number | string;
14-
itemId: number | string;
15-
to: string;
13+
groupId: number | string
14+
itemId: number | string
15+
to: string
1616
}
1717

1818
interface NavEntry {
19-
id: string;
20-
slug: string;
19+
id: string
20+
slug: string
2121
data: {
22-
title: string;
23-
};
24-
collection: string;
22+
title: string
23+
}
24+
collection: string
2525
}
2626

2727
interface NavigationProps {
28-
navEntries: NavEntry[];
28+
navEntries: NavEntry[]
2929
}
3030

3131
export const Navigation: React.FunctionComponent<NavigationProps> = ({
3232
navEntries,
3333
}: NavigationProps) => {
34-
const [activeItem, setActiveItem] = useState("");
34+
const [activeItem, setActiveItem] = useState('')
3535

3636
const onNavSelect = (
3737
_event: React.FormEvent<HTMLInputElement>,
38-
selectedItem: NavOnSelectProps
38+
selectedItem: NavOnSelectProps,
3939
) => {
4040
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
41-
typeof selectedItem.itemId === "string" &&
42-
setActiveItem(selectedItem.itemId);
43-
};
41+
typeof selectedItem.itemId === 'string' &&
42+
setActiveItem(selectedItem.itemId)
43+
}
4444

45-
const $isNavOpen = useStore(isNavOpen);
45+
const $isNavOpen = useStore(isNavOpen)
4646

4747
const navItems = navEntries.map((entry) => (
4848
<NavItem
@@ -53,7 +53,7 @@ export const Navigation: React.FunctionComponent<NavigationProps> = ({
5353
>
5454
{entry.data.title}
5555
</NavItem>
56-
));
56+
))
5757

5858
return (
5959
<PageSidebar isSidebarOpen={$isNavOpen}>
@@ -63,5 +63,5 @@ export const Navigation: React.FunctionComponent<NavigationProps> = ({
6363
</Nav>
6464
</PageSidebarBody>
6565
</PageSidebar>
66-
);
67-
};
66+
)
67+
}

0 commit comments

Comments
 (0)