The Node.js® Website

meta: updated stylelint configs

+1
.editorconfig
··· 7 7 charset = utf-8 8 8 trim_trailing_whitespace = true 9 9 insert_final_newline = true 10 + max_line_length = 80
-1
.prettierrc.json
··· 1 1 { 2 - "printWidth": 80, 3 2 "tabWidth": 2, 4 3 "useTabs": false, 5 4 "semi": true,
+1 -1
.stylelintrc.json
··· 13 13 "scss/at-rule-no-unknown": [ 14 14 true, 15 15 { 16 - "ignoreAtRules": ["tailwind"] 16 + "ignoreAtRules": ["tailwind", "apply"] 17 17 } 18 18 ] 19 19 }
+16 -1
COLLABORATOR_GUIDE.md
··· 156 156 157 157 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). 158 158 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 + 159 173 > [!NOTE]\ 160 174 > Tailwind is already configured for this repository. You don't need to import any Tailwind module within your CSS modules. 161 175 > 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 205 #### How a new Component should look like when freshly created 192 206 193 207 ```tsx 208 + import type { FC } from 'react'; 209 + 194 210 import styles from './index.module.scss'; 195 - import type { FC } from 'react'; 196 211 197 212 type MyComponentProps = {}; // The types of the Props of your Component 198 213
+49 -14
components/Common/Badge/index.module.scss
··· 1 1 .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; 3 12 4 13 .icon { 5 14 @apply w-4 h-4; 6 15 } 7 16 8 17 .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; 10 24 } 11 25 12 26 .message { ··· 14 28 } 15 29 16 30 &.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; 18 35 19 36 .icon { 20 - @apply text-green-500 dark:text-green-300; 37 + @apply text-green-500 38 + dark:text-green-300; 21 39 } 22 40 23 41 .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; 25 45 } 26 46 27 47 .message { 28 - @apply text-green-700 dark:text-green-300; 48 + @apply text-green-700 49 + dark:text-green-300; 29 50 } 30 51 } 31 52 32 53 &.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; 34 58 35 59 .icon { 36 - @apply text-danger-500 dark:text-danger-300; 60 + @apply text-danger-500 61 + dark:text-danger-300; 37 62 } 38 63 39 64 .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; 41 68 } 42 69 43 70 .message { 44 - @apply text-danger-700 dark:text-danger-300; 71 + @apply text-danger-700 72 + dark:text-danger-300; 45 73 } 46 74 } 47 75 48 76 &.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; 50 81 51 82 .icon { 52 - @apply text-warning-500 dark:text-warning-300; 83 + @apply text-warning-500 84 + dark:text-warning-300; 53 85 } 54 86 55 87 .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; 57 91 } 58 92 59 93 .message { 60 - @apply text-warning-700 dark:text-warning-300; 94 + @apply text-warning-700 95 + dark:text-warning-300; 61 96 } 62 97 } 63 98 }
+9 -1
components/Common/Banner/index.module.scss
··· 1 1 .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; 3 11 4 12 a { 5 13 @apply underline;
+1 -1
package.json
··· 28 28 "deploy": "cross-env NEXT_STATIC_EXPORT=true npm run build", 29 29 "lint:js": "eslint \"**/*.{mjs,ts,tsx}\" --cache --cache-strategy content --cache-file .eslintjscache --report-unused-disable-directives", 30 30 "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}\"", 32 32 "lint": "npm run lint:js && npm run lint:md && npm run lint:scss", 33 33 "lint:fix": "npm run lint:js -- --fix && npm run lint:md -- --fix && npm run lint:scss -- --fix", 34 34 "prettier": "prettier \"**/*.{mjs,ts,tsx,md,mdx,json,yml,css,sass,scss}\" --check --cache --cache-strategy content --cache-location=.prettiercache",
+2 -1
postcss.config.js
··· 1 1 module.exports = { 2 + syntax: 'postcss-scss', 2 3 plugins: { 3 4 tailwindcss: {}, 4 5 autoprefixer: {}, 5 6 }, 6 - } 7 + };