You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/instructions/general.instructions.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ applyTo: "**"
17
17
- Do not leave trailing spaces on lines.
18
18
- Do not use run-astro-dev, always use "npm run dev".
19
19
- Always create TypeScript files, not JavaScript files.
20
+
- For every `*.module.css` file, also create the matching `*.module.css.d.ts` file, import it as `styles`, and access classnames via dot syntax (e.g., `styles.someClass`) instead of bracket syntax.
20
21
- Prefer destructured imports over namespace imports when importing specific functions from modules (e.g., `import { resolve } from 'path'` instead of `import * as path from 'path'`).
21
22
- Do not access nanostore observables (e.g., `$consent`) directly from components; expose helper/action methods in `@components/scripts/store` and import those instead.
22
23
- Preact exists only for the Markdown E2E harness under `src/lib/markdown/__tests__/e2e`; all production UI components must use Lit web components instead of Preact.
In a number of components where we've moved styles into a *.module.css file and imported it into the Astro layout, we've been inconsistent with naming the import and resolved lint errors concerning accessing object properties by using bracket access, such as:
157
-
158
-
import menuStyles from './menu.module.css'
159
-
menuStyles['navItemActive']
160
-
161
-
In all of these cases, we need to refactor to use the pattern show in the Button and Footer components, where we create a *.module.css.d.ts to provide types, name the import consistently as "styles", and access those styles as follows:
162
-
163
-
styles.footerGrid
164
-
165
-
Components that need refactoring are as follows. Let's do this next.
0 commit comments