Skip to content

Commit b6031b1

Browse files
committed
meta: updated stylelint configs
1 parent fad2b7e commit b6031b1

8 files changed

+79
-20
lines changed

.editorconfig

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ end_of_line = lf
77
charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
10+
max_line_length = 80

.prettierrc.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"printWidth": 80,
32
"tabWidth": 2,
43
"useTabs": false,
54
"semi": true,

.stylelintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"scss/at-rule-no-unknown": [
1414
true,
1515
{
16-
"ignoreAtRules": ["tailwind"]
16+
"ignoreAtRules": ["tailwind", "apply"]
1717
}
1818
]
1919
}

COLLABORATOR_GUIDE.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,20 @@ We also recommend reading [this guide for setting up Tailwind on your IDE](https
156156

157157
Finally, if you're unfamiliar with how to use Tailwind or how to use Tailwind within CSS Modules, we recommend reading [this guide](https://tailwindcss.com/docs/using-with-preprocessors).
158158

159+
#### Example of a CSS Module
160+
161+
```scss
162+
.myComponent {
163+
@apply some
164+
tailwind
165+
classes;
166+
}
167+
```
168+
169+
- We use Camel Case for defining Class Names
170+
- We use Tailwind's `@apply` selector to apply Tailwind Styles
171+
- Note that we should have one tailwind token per line as shown in the example above; This improves readability
172+
159173
> [!NOTE]\
160174
> Tailwind is already configured for this repository. You don't need to import any Tailwind module within your CSS modules.
161175
> You can apply Tailwind classes by regularly using CSS variables or SCSS's `@apply` statement, for example. If you have questions, please raise them on Pull Requests or Issues.
@@ -191,9 +205,10 @@ Finally, if you're unfamiliar with how to use Tailwind or how to use Tailwind wi
191205
#### How a new Component should look like when freshly created
192206

193207
```tsx
194-
import styles from './index.module.scss';
195208
import type { FC } from 'react';
196209

210+
import styles from './index.module.scss';
211+
197212
type MyComponentProps = {}; // The types of the Props of your Component
198213

199214
const MyComponent: FC<MyComponentProps> = ({ prop1, prop2... }) => (
+49-14
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,98 @@
11
.wrapper {
2-
@apply border rounded-full flex items-center w-fit py-1 pl-1 pr-2.5 text-sm font-medium;
2+
@apply border
3+
rounded-full
4+
flex
5+
items-center
6+
w-fit
7+
py-1
8+
pl-1
9+
pr-2.5
10+
text-sm
11+
font-medium;
312

413
.icon {
514
@apply w-4 h-4;
615
}
716

817
.badge {
9-
@apply rounded-full border px-2.5 py-0.5 mr-2 text-white;
18+
@apply rounded-full
19+
border
20+
px-2.5
21+
py-0.5
22+
mr-2
23+
text-white;
1024
}
1125

1226
.message {
1327
@apply mr-1;
1428
}
1529

1630
&.default {
17-
@apply border-green-200 bg-green-100 dark:border-green-700 dark:bg-neutral-900;
31+
@apply border-green-200
32+
bg-green-100
33+
dark:border-green-700
34+
dark:bg-neutral-900;
1835

1936
.icon {
20-
@apply text-green-500 dark:text-green-300;
37+
@apply text-green-500
38+
dark:text-green-300;
2139
}
2240

2341
.badge {
24-
@apply border-green-200 dark:border-green-600 bg-green-600;
42+
@apply border-green-200
43+
dark:border-green-600
44+
bg-green-600;
2545
}
2646

2747
.message {
28-
@apply text-green-700 dark:text-green-300;
48+
@apply text-green-700
49+
dark:text-green-300;
2950
}
3051
}
3152

3253
&.error {
33-
@apply border-danger-200 dark:border-danger-700 bg-danger-100 dark:bg-neutral-900;
54+
@apply border-danger-200
55+
dark:border-danger-700
56+
bg-danger-100
57+
dark:bg-neutral-900;
3458

3559
.icon {
36-
@apply text-danger-500 dark:text-danger-300;
60+
@apply text-danger-500
61+
dark:text-danger-300;
3762
}
3863

3964
.badge {
40-
@apply border-danger-200 dark:border-danger-600 bg-danger-600;
65+
@apply border-danger-200
66+
dark:border-danger-600
67+
bg-danger-600;
4168
}
4269

4370
.message {
44-
@apply text-danger-700 dark:text-danger-300;
71+
@apply text-danger-700
72+
dark:text-danger-300;
4573
}
4674
}
4775

4876
&.warning {
49-
@apply border-warning-200 dark:border-warning-700 bg-warning-100 dark:bg-neutral-900;
77+
@apply border-warning-200
78+
dark:border-warning-700
79+
bg-warning-100
80+
dark:bg-neutral-900;
5081

5182
.icon {
52-
@apply text-warning-500 dark:text-warning-300;
83+
@apply text-warning-500
84+
dark:text-warning-300;
5385
}
5486

5587
.badge {
56-
@apply border-warning-200 dark:border-warning-600 bg-warning-600;
88+
@apply border-warning-200
89+
dark:border-warning-600
90+
bg-warning-600;
5791
}
5892

5993
.message {
60-
@apply text-warning-700 dark:text-warning-300;
94+
@apply text-warning-700
95+
dark:text-warning-300;
6196
}
6297
}
6398
}

components/Common/Banner/index.module.scss

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
.banner {
2-
@apply text-sm text-white flex flex-row items-center justify-center gap-2 py-3 w-full;
2+
@apply text-sm
3+
text-white
4+
flex
5+
flex-row
6+
items-center
7+
justify-center
8+
gap-2
9+
py-3
10+
w-full;
311

412
a {
513
@apply underline;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"deploy": "cross-env NEXT_STATIC_EXPORT=true npm run build",
2929
"lint:js": "eslint \"**/*.{mjs,ts,tsx}\" --cache --cache-strategy content --cache-file .eslintjscache --report-unused-disable-directives",
3030
"lint:md": "eslint \"**/*.md?(x)\" --cache --cache-strategy content --cache-file .eslintmdcache",
31-
"lint:scss": "stylelint --config .stylelintrc.json \"**/*.{css,sass,scss}\"",
31+
"lint:scss": "stylelint \"**/*.{css,sass,scss}\"",
3232
"lint": "npm run lint:js && npm run lint:md && npm run lint:scss",
3333
"lint:fix": "npm run lint:js -- --fix && npm run lint:md -- --fix && npm run lint:scss -- --fix",
3434
"prettier": "prettier \"**/*.{mjs,ts,tsx,md,mdx,json,yml,css,sass,scss}\" --check --cache --cache-strategy content --cache-location=.prettiercache",

postcss.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = {
2+
syntax: 'postcss-scss',
23
plugins: {
34
tailwindcss: {},
45
autoprefixer: {},
56
},
6-
}
7+
};

0 commit comments

Comments
 (0)