The Node.js® Website

meta: updated stylelint configs

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