Skip to content

Commit d62a494

Browse files
chore: Ensure class names conform to PascalCase (#5716)
Co-authored-by: Jon Rohan <yes@jonrohan.codes>
1 parent 0cfafe8 commit d62a494

20 files changed

+315
-40
lines changed

.changeset/seven-falcons-fry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": minor
3+
---
4+
5+
chore: Ensure class names conform to PascalCase

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ blob-report
4040

4141
# ESLint
4242
.eslintcache
43+
44+
# CSS modules type definitions
45+
*.module.css.d.ts
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
.header {
1+
.Header {
22
display: flex;
33
justify-content: space-between;
44
align-items: center;
55
min-height: 4rem;
66
padding: var(--base-size-16);
77
}
88

9-
.logo {
9+
.Logo {
1010
color: inherit;
1111
text-decoration: none;
1212
}

examples/theming/src/app/components/PageHeader/PageHeader.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import classes from './PageHeader.module.css'
44

55
export function PageHeader() {
66
return (
7-
<header className={classes.header}>
8-
<Link href="/" className={classes.logo}>
7+
<header className={classes.Header}>
8+
<Link href="/" className={classes.Logo}>
99
Primer
1010
</Link>
1111
<ThemePreference />
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* stylelint-disable selector-no-qualifying-type */
2-
html[data-color-mode='dark'] .light {
2+
html[data-color-mode='dark'] .Light {
33
display: none !important;
44
}
55

6-
html[data-color-mode='light'] .dark,
7-
html[data-color-mode='auto'] .dark {
6+
html[data-color-mode='light'] .Dark,
7+
html[data-color-mode='auto'] .Dark {
88
display: none !important;
99
}

examples/theming/src/app/components/ThemePreference/ThemePreference.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import {SunIcon, MoonIcon} from '@primer/octicons-react'
44
import {Button, useTheme} from '@primer/react'
5-
import {clsx} from 'clsx'
65
import classes from './ThemePreference.module.css'
76

87
export function ThemePreference() {
@@ -30,8 +29,8 @@ export function ThemePreference() {
3029
})
3130
}}
3231
>
33-
<SunIcon className={clsx(classes.icon, classes.light)} />
34-
<MoonIcon className={clsx(classes.icon, classes.dark)} />
32+
<SunIcon className={classes.Light} />
33+
<MoonIcon className={classes.Dark} />
3534
</Button>
3635
)
3736
}

package-lock.json

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

package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"build:docs:preview": "NODE_OPTIONS=--openssl-legacy-provider script/build-docs preview",
2121
"build:components.json": "npm run build:components.json -w @primer/react",
2222
"build:hooks.json": "npm run build:hooks.json -w @primer/react",
23-
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=0",
23+
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=0 --ignore-pattern '**/*.module.css.d.ts'",
2424
"lint:css": "stylelint --rd -q '**/*.css'",
2525
"lint:css:fix": "npm run lint:css -- --fix",
2626
"lint:fix": "npm run lint -- --fix",
@@ -29,8 +29,9 @@
2929
"test:update": "npm run test -- --updateSnapshot",
3030
"test:watch": "npm run test -- --watch",
3131
"test:coverage": "npm run test -- --coverage",
32-
"test:type-check": "tsc --noEmit",
33-
"type-check": "tsc --noEmit && npm run type-check -ws --if-present",
32+
"test:type-check": "npm run type-css-modules && tsc --noEmit",
33+
"type-check": "npm run type-css-modules && tsc --noEmit && npm run type-check -ws --if-present",
34+
"type-css-modules": "tcm -p **/packages/react/src/**/*.module.css",
3435
"release": "npm run build && changeset publish",
3536
"reset": "script/reset",
3637
"size": "size-limit"
@@ -46,8 +47,8 @@
4647
"@changesets/changelog-github": "0.5.0",
4748
"@changesets/cli": "2.27.1",
4849
"@github/axe-github": "0.6.1",
49-
"@github/mini-throttle": "2.1.1",
5050
"@github/markdownlint-github": "^0.6.0",
51+
"@github/mini-throttle": "2.1.1",
5152
"@github/prettier-config": "0.0.6",
5253
"@mdx-js/react": "1.6.22",
5354
"@playwright/test": "^1.50.0",
@@ -80,6 +81,7 @@
8081
"rimraf": "5.0.5",
8182
"size-limit": "11.1.5",
8283
"stylelint": "16.9.0",
84+
"typed-css-modules": "0.9.1",
8385
"typescript": "^5.7.2"
8486
},
8587
"optionalDependencies": {

0 commit comments

Comments
 (0)