Skip to content

Commit 32e3afe

Browse files
authored
Merge pull request #13397 from ethereum/prettier-lintstaged
Prettier + lintstaged
2 parents 7acd81c + e0f82ad commit 32e3afe

Some content is hidden

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

51 files changed

+152
-159
lines changed

.lintstagedrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const buildEslintCommand = (filenames) =>
55
.map((f) => path.relative(process.cwd(), f))
66
.join(" --file ")}`
77

8+
const formatCommand = "prettier --write"
9+
810
module.exports = {
9-
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
11+
"*.{js,jsx,ts,tsx}": [buildEslintCommand, formatCommand],
1012
}

.storybook/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ const config: StorybookConfig = {
2525
{
2626
name: "@storybook/addon-essentials",
2727
options: {
28-
backgrounds: false
29-
}
28+
backgrounds: false,
29+
},
3030
},
3131
"@storybook/addon-interactions",
3232
"storybook-react-i18next",
3333
"@storybook/addon-themes",
34-
"@chromatic-com/storybook"
34+
"@chromatic-com/storybook",
3535
],
3636
staticDirs: ["../public"],
3737
framework: {
@@ -79,7 +79,7 @@ const config: StorybookConfig = {
7979
},
8080
},
8181

82-
reactDocgen: "react-docgen-typescript"
82+
reactDocgen: "react-docgen-typescript",
8383
},
8484
}
8585
export default config

.storybook/types.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import type { ArgTypes } from "@storybook/react"
1111
type KeyOf<T> = [T] extends [never]
1212
? never
1313
: T extends object
14-
? Extract<keyof T, string>
15-
: never
14+
? Extract<keyof T, string>
15+
: never
1616

1717
export type ThemingArgTypeKey = "variant" | "size"
1818

@@ -49,8 +49,10 @@ export type ThemingArgTypeKey = "variant" | "size"
4949
* @param componentName component name to create the ArgTypes for
5050
*/
5151
export function getThemingArgTypes<
52-
Theme extends Record<string, unknown> & { components?: Record<string, StyleConfig> },
53-
ComponentName extends KeyOf<Theme["components"]>
52+
Theme extends Record<string, unknown> & {
53+
components?: Record<string, StyleConfig>
54+
},
55+
ComponentName extends KeyOf<Theme["components"]>,
5456
>(theme: Theme, componentName: ComponentName) {
5557
const component = theme.components?.[componentName]
5658
if (!component) {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"start": "next start",
1111
"lint": "next lint",
1212
"lint:fix": "next lint --fix",
13-
"format": "prettier --write .",
13+
"format": "prettier \"**/*.{js,jsx,ts,tsx}\" --write",
1414
"preversion": "bash ./src/scripts/updatePublishDate.sh",
1515
"crowdin-contributors": "ts-node -O '{ \"module\": \"commonjs\" }' src/scripts/crowdin/getCrowdinContributors.ts",
1616
"storybook": "storybook dev -p 6006",
@@ -109,7 +109,7 @@
109109
"plaiceholder": "^3.0.0",
110110
"polished": "^4.2.2",
111111
"postcss": "^8.4.39",
112-
"prettier": "3.3.2",
112+
"prettier": "^3.3.3",
113113
"prettier-plugin-tailwindcss": "^0.6.5",
114114
"raw-loader": "^4.0.2",
115115
"storybook": "8.1.10",

src/@chakra-ui/components/Popover.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const baseStyle = definePartsStyle(
3535
maxWidth: "xs", // 20rem
3636
lineHeight: "base",
3737
w: "auto",
38-
_focusVisible: {
39-
boxShadow: 'none',
38+
_focusVisible: {
39+
boxShadow: "none",
4040
},
4141
},
4242
body: {

src/@chakra-ui/stories/Colors.stories.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ const ColorGroupWrapper = ({
7979
color === "gray"
8080
? `linear-gradient(180deg, #1b1b1b 35%, #fff 35%)`
8181
: color === "orange"
82-
? "gray.800"
83-
: undefined
82+
? "gray.800"
83+
: undefined
8484
}
8585
>
8686
{children}
@@ -131,12 +131,12 @@ export const SemanticScheme: StoryObj = {
131131
const tokenObj = semanticTokenColors[tokenName]
132132

133133
const filteredTokenObj =
134-
"base" in tokenObj
135-
? Object.keys(semanticTokens["colors"][tokenName]).filter(
136-
(key) => !currentDeprecatedTokens.includes(key)
137-
)
134+
"base" in tokenObj
135+
? Object.keys(semanticTokens["colors"][tokenName]).filter(
136+
(key) => !currentDeprecatedTokens.includes(key)
137+
)
138138
: undefined
139-
139+
140140
return (
141141
<Flex key={tokenName} direction="column" gap="4">
142142
<Heading>{capitalize(tokenName)}</Heading>
@@ -180,6 +180,8 @@ const SemanticColorBlock = ({
180180
size="20"
181181
bg={tokenName === nestedKey ? tokenName : `${tokenName}.${nestedKey}`}
182182
/>
183-
<Text>{tokenName}.{nestedKey}</Text>
183+
<Text>
184+
{tokenName}.{nestedKey}
185+
</Text>
184186
</Flex>
185187
)

src/components/ActionCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Heading,
88
LinkBox,
99
type LinkBoxProps,
10-
LinkOverlay
10+
LinkOverlay,
1111
} from "@chakra-ui/react"
1212

1313
import { Image } from "@/components/Image"

src/components/Banners/DismissableBanner/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ const DismissableBanner = ({
2828
}
2929

3030
return (
31-
<BannerNotification shouldShow={show} gap='8'>
32-
<Center marginInlineStart='auto'>{children}</Center>
33-
<CloseButton marginInlineStart='auto' onClick={onClose} aria-label="Close Banner" />
31+
<BannerNotification shouldShow={show} gap="8">
32+
<Center marginInlineStart="auto">{children}</Center>
33+
<CloseButton
34+
marginInlineStart="auto"
35+
onClick={onClose}
36+
aria-label="Close Banner"
37+
/>
3438
</BannerNotification>
3539
)
3640
}

src/components/ButtonDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,4 @@ const ButtonDropdown = ({ list, ...rest }: ButtonDropdownProps) => {
121121
)
122122
}
123123

124-
export default ButtonDropdown
124+
export default ButtonDropdown

src/components/DataProductCard.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import React from "react"
22
import { StaticImageData } from "next/image"
3-
import {
4-
Box,
5-
Flex,
6-
Heading,
7-
LinkBox,
8-
LinkOverlay,
9-
} from "@chakra-ui/react"
3+
import { Box, Flex, Heading, LinkBox, LinkOverlay } from "@chakra-ui/react"
104

115
import { Image } from "@/components/Image"
126

0 commit comments

Comments
 (0)