@node-core/ui-components 1.0.1-a0f03ae69979a5fea7c16262ff88cbeef11452c2 → 1.0.1-a356572cf397450a3eeeb973d6fe6d6803a24059

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/Common/AlertBox/index.js +5 -0
  2. package/Common/AlertBox/index.module.css +44 -50
  3. package/Common/AvatarGroup/Avatar/index.js +11 -0
  4. package/Common/AvatarGroup/Avatar/index.module.css +50 -30
  5. package/Common/AvatarGroup/Overlay/index.js +6 -0
  6. package/Common/AvatarGroup/Overlay/index.module.css +28 -21
  7. package/Common/AvatarGroup/index.js +21 -0
  8. package/Common/AvatarGroup/index.module.css +12 -11
  9. package/Common/Badge/index.js +7 -0
  10. package/Common/Badge/index.module.css +34 -26
  11. package/Common/BadgeGroup/index.js +6 -0
  12. package/Common/BadgeGroup/index.module.css +75 -51
  13. package/Common/Banner/index.js +4 -0
  14. package/Common/Banner/index.module.css +30 -27
  15. package/Common/BaseActiveLink/index.js +14 -0
  16. package/Common/BaseButton/index.js +10 -0
  17. package/Common/BaseButton/index.module.css +332 -105
  18. package/Common/BaseCodeBox/index.js +50 -0
  19. package/Common/BaseCodeBox/index.module.css +76 -58
  20. package/Common/BaseCrossLink/index.js +12 -0
  21. package/Common/BaseCrossLink/index.module.css +57 -39
  22. package/Common/BaseLinkTabs/index.js +5 -0
  23. package/Common/BaseLinkTabs/index.module.css +57 -33
  24. package/Common/BasePagination/Ellipsis/index.js +4 -0
  25. package/Common/BasePagination/Ellipsis/index.module.css +14 -8
  26. package/Common/BasePagination/PaginationListItem/index.js +6 -0
  27. package/Common/BasePagination/PaginationListItem/index.module.css +36 -21
  28. package/Common/BasePagination/PrevNextArrow.js +7 -0
  29. package/Common/BasePagination/index.js +10 -0
  30. package/Common/BasePagination/index.module.css +27 -26
  31. package/Common/BasePagination/useGetPageElements.js +77 -0
  32. package/Common/Blockquote/index.js +4 -0
  33. package/Common/Blockquote/index.module.css +44 -23
  34. package/Common/Breadcrumbs/BreadcrumbHomeLink/index.js +9 -0
  35. package/Common/Breadcrumbs/BreadcrumbHomeLink/index.module.css +3 -3
  36. package/Common/Breadcrumbs/BreadcrumbItem/index.js +6 -0
  37. package/Common/Breadcrumbs/BreadcrumbItem/index.module.css +38 -27
  38. package/Common/Breadcrumbs/BreadcrumbLink/index.js +5 -0
  39. package/Common/Breadcrumbs/BreadcrumbLink/index.module.css +26 -16
  40. package/Common/Breadcrumbs/BreadcrumbRoot/index.js +4 -0
  41. package/Common/Breadcrumbs/BreadcrumbRoot/index.module.css +8 -7
  42. package/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.js +4 -0
  43. package/Common/Breadcrumbs/index.js +22 -0
  44. package/Common/ChangeHistory/index.js +9 -0
  45. package/Common/ChangeHistory/index.module.css +181 -66
  46. package/Common/CodeTabs/index.js +5 -0
  47. package/Common/CodeTabs/index.module.css +47 -36
  48. package/Common/DataTag/index.js +18 -0
  49. package/Common/DataTag/index.module.css +30 -32
  50. package/Common/GlowingBackdrop/index.js +5 -0
  51. package/Common/GlowingBackdrop/index.module.css +126 -28
  52. package/Common/LanguageDropDown/index.js +11 -0
  53. package/Common/LanguageDropDown/index.module.css +140 -42
  54. package/Common/Modal/index.js +10 -0
  55. package/Common/Modal/index.module.css +217 -62
  56. package/Common/NodejsLogo/index.js +7 -0
  57. package/Common/NodejsLogo/index.module.css +3 -4
  58. package/Common/Notification/index.js +6 -0
  59. package/Common/Notification/index.module.css +101 -17
  60. package/Common/Preview/index.js +7 -0
  61. package/Common/Preview/index.module.css +269 -65
  62. package/Common/Select/index.js +46 -0
  63. package/Common/Select/index.module.css +294 -127
  64. package/Common/Separator/index.js +7 -0
  65. package/Common/Separator/index.module.css +7 -10
  66. package/Common/Skeleton/index.js +18 -0
  67. package/Common/Skeleton/index.module.css +118 -21
  68. package/Common/Tabs/index.js +6 -0
  69. package/Common/Tabs/index.module.css +58 -40
  70. package/Common/ThemeToggle/index.js +7 -0
  71. package/Common/ThemeToggle/index.module.css +18 -11
  72. package/Common/Tooltip/index.js +8 -0
  73. package/Common/Tooltip/index.module.css +119 -29
  74. package/Containers/Article/index.js +4 -0
  75. package/Containers/Article/index.module.css +127 -58
  76. package/Containers/DocSideBar/index.js +1 -0
  77. package/Containers/Footer/index.js +22 -0
  78. package/Containers/Footer/index.module.css +51 -36
  79. package/Containers/MetaBar/index.js +12 -0
  80. package/Containers/MetaBar/index.module.css +101 -69
  81. package/Containers/NavBar/NavItem/index.js +7 -0
  82. package/Containers/NavBar/NavItem/index.module.css +50 -36
  83. package/Containers/NavBar/index.js +18 -0
  84. package/Containers/NavBar/index.module.css +176 -96
  85. package/Containers/Sidebar/ProgressionIcon/index.js +3 -0
  86. package/Containers/Sidebar/SidebarGroup/index.js +9 -0
  87. package/Containers/Sidebar/SidebarGroup/index.module.css +180 -52
  88. package/Containers/Sidebar/SidebarItem/index.js +11 -0
  89. package/Containers/Sidebar/SidebarItem/index.module.css +49 -38
  90. package/Containers/Sidebar/index.js +15 -0
  91. package/Containers/Sidebar/index.module.css +42 -24
  92. package/Icons/HexagonGrid.js +3 -0
  93. package/Icons/InstallationMethod/Choco.js +3 -0
  94. package/Icons/InstallationMethod/Devbox.js +3 -0
  95. package/Icons/InstallationMethod/Docker.js +3 -0
  96. package/Icons/InstallationMethod/FNM.js +3 -0
  97. package/Icons/InstallationMethod/Homebrew.js +3 -0
  98. package/Icons/InstallationMethod/N.js +5 -0
  99. package/Icons/InstallationMethod/NVM.js +3 -0
  100. package/Icons/InstallationMethod/Volta.js +3 -0
  101. package/Icons/InstallationMethod/{index.ts → index.js} +0 -1
  102. package/Icons/Logos/JsGreen.js +3 -0
  103. package/Icons/Logos/JsWhite.js +3 -0
  104. package/Icons/Logos/Nodejs.js +6 -0
  105. package/Icons/Logos/NodejsStackedBlack.js +3 -0
  106. package/Icons/Logos/NodejsStackedDark.js +3 -0
  107. package/Icons/Logos/NodejsStackedLight.js +3 -0
  108. package/Icons/Logos/NodejsStackedWhite.js +3 -0
  109. package/Icons/Logos/{index.ts → index.js} +1 -10
  110. package/Icons/OperatingSystem/AIX.js +3 -0
  111. package/Icons/OperatingSystem/Apple.js +3 -0
  112. package/Icons/OperatingSystem/Linux.js +3 -0
  113. package/Icons/OperatingSystem/Microsoft.js +3 -0
  114. package/Icons/OperatingSystem/{index.ts → index.js} +0 -1
  115. package/Icons/PackageManager/Npm.js +3 -0
  116. package/Icons/PackageManager/Pnpm.js +3 -0
  117. package/Icons/PackageManager/Yarn.js +3 -0
  118. package/Icons/PackageManager/{index.ts → index.js} +0 -1
  119. package/Icons/Social/Bluesky.js +3 -0
  120. package/Icons/Social/Discord.js +3 -0
  121. package/Icons/Social/GitHub.js +3 -0
  122. package/Icons/Social/LinkedIn.js +3 -0
  123. package/Icons/Social/Mastodon.js +3 -0
  124. package/Icons/Social/Slack.js +3 -0
  125. package/Icons/Social/X.js +3 -0
  126. package/Icons/Social/{index.ts → index.js} +0 -1
  127. package/MDX/CodeTabs.js +16 -0
  128. package/package.json +6 -54
  129. package/stylelint/one-utility-class-per-line.mjs +34 -50
  130. package/stylelint/utils.mjs +19 -25
  131. package/styles/index.css +1127 -26
  132. package/types.js +1 -0
  133. package/Common/AlertBox/index.stories.tsx +0 -96
  134. package/Common/AlertBox/index.tsx +0 -24
  135. package/Common/AvatarGroup/Avatar/index.stories.tsx +0 -22
  136. package/Common/AvatarGroup/Avatar/index.tsx +0 -67
  137. package/Common/AvatarGroup/Overlay/index.stories.tsx +0 -33
  138. package/Common/AvatarGroup/Overlay/index.tsx +0 -37
  139. package/Common/AvatarGroup/__tests__/index.test.jsx +0 -55
  140. package/Common/AvatarGroup/index.stories.tsx +0 -56
  141. package/Common/AvatarGroup/index.tsx +0 -83
  142. package/Common/Badge/index.stories.tsx +0 -38
  143. package/Common/Badge/index.tsx +0 -35
  144. package/Common/BadgeGroup/index.stories.tsx +0 -35
  145. package/Common/BadgeGroup/index.tsx +0 -35
  146. package/Common/Banner/index.stories.tsx +0 -29
  147. package/Common/Banner/index.tsx +0 -18
  148. package/Common/BaseActiveLink/__tests__/index.test.jsx +0 -52
  149. package/Common/BaseActiveLink/index.tsx +0 -34
  150. package/Common/BaseButton/index.stories.tsx +0 -67
  151. package/Common/BaseButton/index.tsx +0 -59
  152. package/Common/BaseCodeBox/index.stories.tsx +0 -39
  153. package/Common/BaseCodeBox/index.tsx +0 -122
  154. package/Common/BaseCrossLink/index.stories.tsx +0 -38
  155. package/Common/BaseCrossLink/index.tsx +0 -46
  156. package/Common/BaseLinkTabs/index.stories.tsx +0 -34
  157. package/Common/BaseLinkTabs/index.tsx +0 -53
  158. package/Common/BasePagination/Ellipsis/index.stories.tsx +0 -10
  159. package/Common/BasePagination/Ellipsis/index.tsx +0 -11
  160. package/Common/BasePagination/PaginationListItem/__tests__/index.test.jsx +0 -58
  161. package/Common/BasePagination/PaginationListItem/index.stories.tsx +0 -40
  162. package/Common/BasePagination/PaginationListItem/index.tsx +0 -39
  163. package/Common/BasePagination/PrevNextArrow.tsx +0 -15
  164. package/Common/BasePagination/__tests__/index.test.jsx +0 -180
  165. package/Common/BasePagination/index.stories.tsx +0 -67
  166. package/Common/BasePagination/index.tsx +0 -77
  167. package/Common/BasePagination/useGetPageElements.tsx +0 -132
  168. package/Common/Blockquote/index.stories.tsx +0 -45
  169. package/Common/Blockquote/index.tsx +0 -11
  170. package/Common/Breadcrumbs/BreadcrumbHomeLink/index.tsx +0 -30
  171. package/Common/Breadcrumbs/BreadcrumbItem/index.tsx +0 -42
  172. package/Common/Breadcrumbs/BreadcrumbLink/index.tsx +0 -37
  173. package/Common/Breadcrumbs/BreadcrumbRoot/index.tsx +0 -20
  174. package/Common/Breadcrumbs/BreadcrumbTruncatedItem/index.tsx +0 -9
  175. package/Common/Breadcrumbs/index.stories.tsx +0 -94
  176. package/Common/Breadcrumbs/index.tsx +0 -81
  177. package/Common/ChangeHistory/index.stories.tsx +0 -130
  178. package/Common/ChangeHistory/index.tsx +0 -67
  179. package/Common/CodeTabs/index.stories.tsx +0 -73
  180. package/Common/CodeTabs/index.tsx +0 -16
  181. package/Common/DataTag/index.stories.tsx +0 -40
  182. package/Common/DataTag/index.tsx +0 -39
  183. package/Common/GlowingBackdrop/index.stories.tsx +0 -10
  184. package/Common/GlowingBackdrop/index.tsx +0 -13
  185. package/Common/LanguageDropDown/index.stories.tsx +0 -19
  186. package/Common/LanguageDropDown/index.tsx +0 -56
  187. package/Common/Modal/index.stories.tsx +0 -34
  188. package/Common/Modal/index.tsx +0 -50
  189. package/Common/NodejsLogo/index.stories.tsx +0 -14
  190. package/Common/NodejsLogo/index.tsx +0 -26
  191. package/Common/Notification/index.stories.tsx +0 -36
  192. package/Common/Notification/index.tsx +0 -34
  193. package/Common/Preview/index.stories.tsx +0 -44
  194. package/Common/Preview/index.tsx +0 -25
  195. package/Common/Select/__tests__/index.test.jsx +0 -67
  196. package/Common/Select/index.stories.tsx +0 -111
  197. package/Common/Select/index.tsx +0 -187
  198. package/Common/Separator/index.stories.tsx +0 -32
  199. package/Common/Separator/index.tsx +0 -27
  200. package/Common/Skeleton/index.tsx +0 -39
  201. package/Common/Tabs/__tests__/index.test.jsx +0 -52
  202. package/Common/Tabs/index.stories.tsx +0 -50
  203. package/Common/Tabs/index.tsx +0 -54
  204. package/Common/ThemeToggle/__tests__/index.test.jsx +0 -35
  205. package/Common/ThemeToggle/index.stories.tsx +0 -10
  206. package/Common/ThemeToggle/index.tsx +0 -15
  207. package/Common/Tooltip/index.stories.tsx +0 -73
  208. package/Common/Tooltip/index.tsx +0 -48
  209. package/Containers/Article/index.stories.tsx +0 -39
  210. package/Containers/Article/index.tsx +0 -9
  211. package/Containers/DocSideBar/index.tsx +0 -0
  212. package/Containers/Footer/index.stories.tsx +0 -27
  213. package/Containers/Footer/index.tsx +0 -95
  214. package/Containers/MetaBar/__tests__/index.test.jsx +0 -63
  215. package/Containers/MetaBar/index.stories.tsx +0 -80
  216. package/Containers/MetaBar/index.tsx +0 -72
  217. package/Containers/NavBar/NavItem/index.stories.tsx +0 -38
  218. package/Containers/NavBar/NavItem/index.tsx +0 -44
  219. package/Containers/NavBar/index.stories.tsx +0 -45
  220. package/Containers/NavBar/index.tsx +0 -94
  221. package/Containers/Sidebar/ProgressionIcon/index.tsx +0 -16
  222. package/Containers/Sidebar/SidebarGroup/index.stories.tsx +0 -36
  223. package/Containers/Sidebar/SidebarGroup/index.tsx +0 -49
  224. package/Containers/Sidebar/SidebarItem/index.stories.tsx +0 -15
  225. package/Containers/Sidebar/SidebarItem/index.tsx +0 -43
  226. package/Containers/Sidebar/index.stories.tsx +0 -88
  227. package/Containers/Sidebar/index.tsx +0 -70
  228. package/Icons/HexagonGrid.stories.tsx +0 -10
  229. package/Icons/HexagonGrid.tsx +0 -1434
  230. package/Icons/InstallationMethod/Choco.tsx +0 -78
  231. package/Icons/InstallationMethod/Devbox.tsx +0 -21
  232. package/Icons/InstallationMethod/Docker.tsx +0 -20
  233. package/Icons/InstallationMethod/FNM.tsx +0 -132
  234. package/Icons/InstallationMethod/Homebrew.tsx +0 -69
  235. package/Icons/InstallationMethod/N.tsx +0 -32
  236. package/Icons/InstallationMethod/NVM.tsx +0 -63
  237. package/Icons/InstallationMethod/Volta.tsx +0 -34
  238. package/Icons/Logos/JsGreen.tsx +0 -24
  239. package/Icons/Logos/JsWhite.tsx +0 -37
  240. package/Icons/Logos/Nodejs.tsx +0 -372
  241. package/Icons/Logos/NodejsStackedBlack.tsx +0 -98
  242. package/Icons/Logos/NodejsStackedDark.tsx +0 -124
  243. package/Icons/Logos/NodejsStackedLight.tsx +0 -123
  244. package/Icons/Logos/NodejsStackedWhite.tsx +0 -98
  245. package/Icons/OperatingSystem/AIX.tsx +0 -46
  246. package/Icons/OperatingSystem/Apple.tsx +0 -23
  247. package/Icons/OperatingSystem/Linux.tsx +0 -969
  248. package/Icons/OperatingSystem/Microsoft.tsx +0 -19
  249. package/Icons/PackageManager/Npm.tsx +0 -21
  250. package/Icons/PackageManager/Pnpm.tsx +0 -22
  251. package/Icons/PackageManager/Yarn.tsx +0 -22
  252. package/Icons/Social/Bluesky.tsx +0 -19
  253. package/Icons/Social/Discord.tsx +0 -20
  254. package/Icons/Social/GitHub.tsx +0 -16
  255. package/Icons/Social/LinkedIn.tsx +0 -16
  256. package/Icons/Social/Mastodon.tsx +0 -36
  257. package/Icons/Social/Slack.tsx +0 -31
  258. package/Icons/Social/X.tsx +0 -16
  259. package/MDX/CodeTabs.tsx +0 -47
  260. package/stylelint/__tests__/index.test.mjs +0 -80
  261. package/styles/animations.css +0 -47
  262. package/styles/base.css +0 -17
  263. package/styles/effects.css +0 -12
  264. package/styles/markdown.css +0 -173
  265. package/styles/theme.css +0 -175
  266. package/types.ts +0 -25
package/package.json CHANGED
@@ -1,24 +1,6 @@
1
1
  {
2
2
  "name": "@node-core/ui-components",
3
3
  "type": "module",
4
- "exports": {
5
- "./*": [
6
- "./*",
7
- "./*.tsx",
8
- "./*/index.tsx",
9
- "./*.ts",
10
- "./*/index.ts"
11
- ]
12
- },
13
- "files": [
14
- "Common",
15
- "Containers",
16
- "Icons",
17
- "MDX",
18
- "stylelint",
19
- "styles",
20
- "types.ts"
21
- ],
22
4
  "dependencies": {
23
5
  "@heroicons/react": "^2.2.0",
24
6
  "@radix-ui/react-avatar": "^1.1.10",
@@ -30,52 +12,22 @@
30
12
  "@radix-ui/react-tabs": "~1.1.12",
31
13
  "@radix-ui/react-toast": "~1.2.14",
32
14
  "@radix-ui/react-tooltip": "~1.2.7",
33
- "@tailwindcss/postcss": "~4.1.8",
34
15
  "@vcarl/remark-headings": "~0.1.0",
35
- "classnames": "~2.5.1",
36
- "postcss-calc": "^10.1.1",
37
- "tailwindcss": "~4.0.17"
38
- },
39
- "devDependencies": {
40
- "@storybook/addon-styling-webpack": "^1.0.1",
41
- "@storybook/addon-themes": "^9.0.3",
42
- "@storybook/addon-webpack5-compiler-swc": "^3.0.0",
43
- "@storybook/react": "^9.0.3",
44
- "@storybook/react-webpack5": "^9.0.3",
45
- "@testing-library/user-event": "~14.6.1",
46
- "@types/node": "22.15.3",
47
- "@types/react": "^19.1.6",
48
- "cross-env": "^7.0.3",
49
- "css-loader": "~7.1.2",
50
- "eslint-plugin-react": "~7.37.4",
51
- "eslint-plugin-storybook": "~9.0.3",
52
- "global-jsdom": "^26.0.0",
53
- "postcss-loader": "~8.1.1",
54
- "react": "^19.1.0",
55
- "storybook": "^9.0.3",
56
- "style-loader": "~4.0.0",
57
- "stylelint": "^16.20.0",
58
- "stylelint-config-standard": "^38.0.0",
59
- "stylelint-order": "7.0.0",
60
- "stylelint-selector-bem-pattern": "4.0.1",
61
- "tsx": "^4.19.3",
62
- "typescript": "~5.8.2",
63
- "typescript-eslint": "~8.33.1"
16
+ "classnames": "~2.5.1"
64
17
  },
65
18
  "imports": {
66
19
  "#ui/*": [
67
- "./*",
68
- "./*.tsx",
69
- "./*/index.tsx",
70
- "./*.ts",
71
- "./*/index.ts"
20
+ "./*"
72
21
  ]
73
22
  },
74
23
  "engines": {
75
24
  "node": ">=20"
76
25
  },
77
- "version": "1.0.1-a0f03ae69979a5fea7c16262ff88cbeef11452c2",
26
+ "version": "1.0.1-a356572cf397450a3eeeb973d6fe6d6803a24059",
78
27
  "scripts": {
28
+ "compile:ts": "tsc",
29
+ "compile:css": "postcss --dir dist --base src \"src/**/*.module.css\" src/styles/index.css",
30
+ "compile": "node --run compile:ts && node --run compile:css",
79
31
  "lint": "turbo run lint:js lint:css",
80
32
  "lint:css": "stylelint \"**/*.css\" --allow-empty-input --cache --cache-strategy=content --cache-location=.stylelintcache",
81
33
  "lint:fix": "node --run lint -- -- --fix",
@@ -1,64 +1,48 @@
1
1
  import stylelint from 'stylelint';
2
-
3
2
  import { indentClassNames } from './utils.mjs';
4
-
5
- const {
6
- createPlugin,
7
- utils: { report, ruleMessages },
8
- } = stylelint;
9
-
3
+ const { createPlugin, utils: { report, ruleMessages }, } = stylelint;
10
4
  const name = 'nodejs/one-utility-class-per-line';
11
-
12
5
  const messages = ruleMessages(name, {
13
- className: classNames =>
14
- `Each line should contain only one Tailwind utility class; "${classNames}"`,
15
- spacing: classNames =>
16
- `Each utility class used with @apply should be indented by 2 spaces on a new line; ${classNames}`,
6
+ className: classNames => `Each line should contain only one Tailwind utility class; "${classNames}"`,
7
+ spacing: classNames => `Each utility class used with @apply should be indented by 2 spaces on a new line; ${classNames}`,
17
8
  });
18
-
19
9
  const meta = {
20
- url: 'https://github.com/nodejs/nodejs.org/blob/main/COLLABORATOR_GUIDE.md#styling-a-component',
21
- fixable: true,
10
+ url: 'https://github.com/nodejs/nodejs.org/blob/main/COLLABORATOR_GUIDE.md#styling-a-component',
11
+ fixable: true,
22
12
  };
23
-
24
13
  /** @type {import('stylelint').Rule} */
25
14
  const rule = () => (root, result) => {
26
- root.walkAtRules('apply', rule => {
27
- if (!rule.params.includes(' ')) {
28
- // If there are no spaces in the params, we don't need to check anything
29
- return;
30
- }
31
-
32
- // Since we use 2 spaces for indentation, each line in the apply rule
33
- // should be indented with two extra whitespaces.
34
- const classes = rule.params.split(`${rule.raws.before} `);
35
- const classNames = classes.join('');
36
-
37
- // Check if the params contain any spaces
38
- if (classNames.includes(' ')) {
39
- if (classNames.includes('\n')) {
40
- return report({
41
- ruleName: name,
42
- result: result,
43
- message: messages.spacing(JSON.stringify(rule.params)),
44
- node: rule,
45
- fix: indentClassNames(rule),
46
- });
47
- }
48
-
49
- return report({
50
- ruleName: name,
51
- result,
52
- message: messages.className(rule.params),
53
- node: rule,
54
- fix: indentClassNames(rule),
55
- });
56
- }
57
- });
15
+ root.walkAtRules('apply', rule => {
16
+ if (!rule.params.includes(' ')) {
17
+ // If there are no spaces in the params, we don't need to check anything
18
+ return;
19
+ }
20
+ // Since we use 2 spaces for indentation, each line in the apply rule
21
+ // should be indented with two extra whitespaces.
22
+ const classes = rule.params.split(`${rule.raws.before} `);
23
+ const classNames = classes.join('');
24
+ // Check if the params contain any spaces
25
+ if (classNames.includes(' ')) {
26
+ if (classNames.includes('\n')) {
27
+ return report({
28
+ ruleName: name,
29
+ result: result,
30
+ message: messages.spacing(JSON.stringify(rule.params)),
31
+ node: rule,
32
+ fix: indentClassNames(rule),
33
+ });
34
+ }
35
+ return report({
36
+ ruleName: name,
37
+ result,
38
+ message: messages.className(rule.params),
39
+ node: rule,
40
+ fix: indentClassNames(rule),
41
+ });
42
+ }
43
+ });
58
44
  };
59
-
60
45
  rule.ruleName = name;
61
46
  rule.messages = messages;
62
47
  rule.meta = meta;
63
-
64
48
  export default createPlugin(name, rule);
@@ -8,22 +8,17 @@
8
8
  * @returns {Object|null} The modified rule with properly formatted class names, or null if the rule is invalid.
9
9
  */
10
10
  export const indentClassNames = rule => {
11
- // Ensure that the rule contains necessary properties
12
- if (!rule || !rule.params || !rule.raws || !rule.raws.before) {
13
- return null;
14
- }
15
-
16
- const indent = ' '.repeat(rule.raws.before.length + 1);
17
-
18
- // Clean and split the class names
19
- const cleanedClasses = cleanClassNames(rule.params);
20
-
21
- // Apply the indentation and join the class names back together
22
- rule.params = applyIndentation(cleanedClasses, indent);
23
-
24
- return rule;
11
+ // Ensure that the rule contains necessary properties
12
+ if (!rule || !rule.params || !rule.raws || !rule.raws.before) {
13
+ return null;
14
+ }
15
+ const indent = ' '.repeat(rule.raws.before.length + 1);
16
+ // Clean and split the class names
17
+ const cleanedClasses = cleanClassNames(rule.params);
18
+ // Apply the indentation and join the class names back together
19
+ rule.params = applyIndentation(cleanedClasses, indent);
20
+ return rule;
25
21
  };
26
-
27
22
  /**
28
23
  * Cleans the input string by removing unnecessary whitespace and newlines.
29
24
  *
@@ -31,12 +26,11 @@ export const indentClassNames = rule => {
31
26
  * @returns {string} The cleaned class names string.
32
27
  */
33
28
  export const cleanClassNames = params => {
34
- return params
35
- .replace(/[\n\r]+/g, '') // Remove new lines
36
- .replace(/\s+/g, ' ') // Replace multiple spaces with a single space
37
- .trim(); // Trim leading/trailing spaces
29
+ return params
30
+ .replace(/[\n\r]+/g, '') // Remove new lines
31
+ .replace(/\s+/g, ' ') // Replace multiple spaces with a single space
32
+ .trim(); // Trim leading/trailing spaces
38
33
  };
39
-
40
34
  /**
41
35
  * Applies the correct indentation to each class name in the string.
42
36
  *
@@ -45,9 +39,9 @@ export const cleanClassNames = params => {
45
39
  * @returns {string} The class names string with applied indentation.
46
40
  */
47
41
  export const applyIndentation = (classes, indent) => {
48
- return classes
49
- .split(' ') // Split into an array of class names
50
- .map(className => indent + className) // Add indentation to each class
51
- .join('\n') // Join with new lines
52
- .trim(); // Remove extra space at the end
42
+ return classes
43
+ .split(' ') // Split into an array of class names
44
+ .map(className => indent + className) // Add indentation to each class
45
+ .join('\n') // Join with new lines
46
+ .trim(); // Remove extra space at the end
53
47
  };