@culur/config-stylelint 1.7.0 → 1.7.2

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 (87) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/{factory-wCIsmB0H.mjs → factory-B33e_UAZ.mjs} +4 -13
  3. package/dist/factory-B33e_UAZ.mjs.map +1 -0
  4. package/dist/{factory-BTQtj5HJ.cjs → factory-BNS_YTTh.cjs} +4 -13
  5. package/dist/factory-BNS_YTTh.cjs.map +1 -0
  6. package/dist/factory.cjs +1 -1
  7. package/dist/factory.d.cts +0 -1
  8. package/dist/factory.d.mts +0 -1
  9. package/dist/factory.mjs +1 -1
  10. package/dist/shareable-configs/auto.cjs +1 -1
  11. package/dist/shareable-configs/auto.cjs.map +1 -1
  12. package/dist/shareable-configs/auto.d.cts +1 -3
  13. package/dist/shareable-configs/auto.d.mts +1 -3
  14. package/dist/shareable-configs/auto.mjs +1 -1
  15. package/dist/shareable-configs/auto.mjs.map +1 -1
  16. package/dist/shareable-configs/none.cjs +1 -1
  17. package/dist/shareable-configs/none.cjs.map +1 -1
  18. package/dist/shareable-configs/none.d.cts +1 -3
  19. package/dist/shareable-configs/none.d.mts +1 -3
  20. package/dist/shareable-configs/none.mjs +1 -1
  21. package/dist/shareable-configs/none.mjs.map +1 -1
  22. package/dist/shareable-configs/sass-vue.cjs +1 -1
  23. package/dist/shareable-configs/sass-vue.cjs.map +1 -1
  24. package/dist/shareable-configs/sass-vue.d.cts +1 -3
  25. package/dist/shareable-configs/sass-vue.d.mts +1 -3
  26. package/dist/shareable-configs/sass-vue.mjs +1 -1
  27. package/dist/shareable-configs/sass-vue.mjs.map +1 -1
  28. package/dist/shareable-configs/sass.cjs +1 -1
  29. package/dist/shareable-configs/sass.cjs.map +1 -1
  30. package/dist/shareable-configs/sass.d.cts +1 -3
  31. package/dist/shareable-configs/sass.d.mts +1 -3
  32. package/dist/shareable-configs/sass.mjs +1 -1
  33. package/dist/shareable-configs/sass.mjs.map +1 -1
  34. package/dist/shareable-configs/tailwind3-sass-vue.cjs +1 -1
  35. package/dist/shareable-configs/tailwind3-sass-vue.cjs.map +1 -1
  36. package/dist/shareable-configs/tailwind3-sass-vue.d.cts +1 -3
  37. package/dist/shareable-configs/tailwind3-sass-vue.d.mts +1 -3
  38. package/dist/shareable-configs/tailwind3-sass-vue.mjs +1 -1
  39. package/dist/shareable-configs/tailwind3-sass-vue.mjs.map +1 -1
  40. package/dist/shareable-configs/tailwind3-sass.cjs +1 -1
  41. package/dist/shareable-configs/tailwind3-sass.cjs.map +1 -1
  42. package/dist/shareable-configs/tailwind3-sass.d.cts +1 -3
  43. package/dist/shareable-configs/tailwind3-sass.d.mts +1 -3
  44. package/dist/shareable-configs/tailwind3-sass.mjs +1 -1
  45. package/dist/shareable-configs/tailwind3-sass.mjs.map +1 -1
  46. package/dist/shareable-configs/tailwind3.cjs +1 -1
  47. package/dist/shareable-configs/tailwind3.cjs.map +1 -1
  48. package/dist/shareable-configs/tailwind3.d.cts +1 -3
  49. package/dist/shareable-configs/tailwind3.d.mts +1 -3
  50. package/dist/shareable-configs/tailwind3.mjs +1 -1
  51. package/dist/shareable-configs/tailwind3.mjs.map +1 -1
  52. package/dist/shareable-configs/tailwind4-vue.cjs +1 -1
  53. package/dist/shareable-configs/tailwind4-vue.cjs.map +1 -1
  54. package/dist/shareable-configs/tailwind4-vue.d.cts +1 -3
  55. package/dist/shareable-configs/tailwind4-vue.d.mts +1 -3
  56. package/dist/shareable-configs/tailwind4-vue.mjs +1 -1
  57. package/dist/shareable-configs/tailwind4-vue.mjs.map +1 -1
  58. package/dist/shareable-configs/tailwind4.cjs +1 -1
  59. package/dist/shareable-configs/tailwind4.cjs.map +1 -1
  60. package/dist/shareable-configs/tailwind4.d.cts +1 -3
  61. package/dist/shareable-configs/tailwind4.d.mts +1 -3
  62. package/dist/shareable-configs/tailwind4.mjs +1 -1
  63. package/dist/shareable-configs/tailwind4.mjs.map +1 -1
  64. package/dist/shareable-configs/vue.cjs +1 -1
  65. package/dist/shareable-configs/vue.cjs.map +1 -1
  66. package/dist/shareable-configs/vue.d.cts +1 -3
  67. package/dist/shareable-configs/vue.d.mts +1 -3
  68. package/dist/shareable-configs/vue.mjs +1 -1
  69. package/dist/shareable-configs/vue.mjs.map +1 -1
  70. package/package.json +8 -8
  71. package/src/configs/css.test.ts +8 -0
  72. package/src/configs/scss.test.ts +7 -0
  73. package/src/configs/shared.test.ts +7 -0
  74. package/src/configs/vue.test.ts +17 -0
  75. package/src/factory.test.ts +30 -0
  76. package/src/rules/at-rule-no-unknown.test.ts +48 -0
  77. package/src/rules/declaration-block-no-redundant-longhand-properties.test.ts +36 -0
  78. package/src/rules/dollar-variable-pattern.test.ts +27 -0
  79. package/src/rules/function-no-unknown.test.ts +44 -0
  80. package/src/rules/import-notation.test.ts +16 -0
  81. package/src/rules/order.test.ts +53 -0
  82. package/src/rules/selector-pseudo-class-no-unknown.test.ts +40 -0
  83. package/src/shareable-configs/shareable-configs.test.ts +25 -0
  84. package/src/utils/utils.test.ts +46 -0
  85. package/src/utils/utils.ts +1 -4
  86. package/dist/factory-BTQtj5HJ.cjs.map +0 -1
  87. package/dist/factory-wCIsmB0H.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  //#region src/shareable-configs/tailwind4-vue.ts
2
- var tailwind4_vue_default = require("../factory-BTQtj5HJ.cjs").defineConfig({
2
+ var tailwind4_vue_default = require("../factory-BNS_YTTh.cjs").defineConfig({
3
3
  tailwind: 4,
4
4
  sass: false,
5
5
  vue: true
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind4-vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind4-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,2DAAeA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;CACN,CAAC"}
1
+ {"version":3,"file":"tailwind4-vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind4-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,yDAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
@@ -1,6 +1,4 @@
1
- import * as _$stylelint from "stylelint";
2
-
3
1
  //#region src/shareable-configs/tailwind4-vue.d.ts
4
- declare const _default: _$stylelint.Config;
2
+ declare const _default: import("stylelint").Config;
5
3
  export = _default;
6
4
  //# sourceMappingURL=tailwind4-vue.d.cts.map
@@ -1,7 +1,5 @@
1
- import * as _$stylelint from "stylelint";
2
-
3
1
  //#region src/shareable-configs/tailwind4-vue.d.ts
4
- declare const _default: _$stylelint.Config;
2
+ declare const _default: import("stylelint").Config;
5
3
  //#endregion
6
4
  export { _default as default };
7
5
  //# sourceMappingURL=tailwind4-vue.d.mts.map
@@ -1,4 +1,4 @@
1
- import { t as defineConfig } from "../factory-wCIsmB0H.mjs";
1
+ import { t as defineConfig } from "../factory-B33e_UAZ.mjs";
2
2
  //#region src/shareable-configs/tailwind4-vue.ts
3
3
  var tailwind4_vue_default = defineConfig({
4
4
  tailwind: 4,
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind4-vue.mjs","names":[],"sources":["../../src/shareable-configs/tailwind4-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: true,\n});\n"],"mappings":";;AAEA,IAAA,wBAAe,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;CACN,CAAC"}
1
+ {"version":3,"file":"tailwind4-vue.mjs","names":[],"sources":["../../src/shareable-configs/tailwind4-vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: true,\n});\n"],"mappings":";;AAEA,IAAA,wBAAe,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
@@ -1,5 +1,5 @@
1
1
  //#region src/shareable-configs/tailwind4.ts
2
- var tailwind4_default = require("../factory-BTQtj5HJ.cjs").defineConfig({
2
+ var tailwind4_default = require("../factory-BNS_YTTh.cjs").defineConfig({
3
3
  tailwind: 4,
4
4
  sass: false,
5
5
  vue: false
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind4.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind4.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,uDAAeA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;CACN,CAAC"}
1
+ {"version":3,"file":"tailwind4.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/tailwind4.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: false,\n});\n"],"mappings":";AAEA,IAAA,qDAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
@@ -1,6 +1,4 @@
1
- import * as _$stylelint from "stylelint";
2
-
3
1
  //#region src/shareable-configs/tailwind4.d.ts
4
- declare const _default: _$stylelint.Config;
2
+ declare const _default: import("stylelint").Config;
5
3
  export = _default;
6
4
  //# sourceMappingURL=tailwind4.d.cts.map
@@ -1,7 +1,5 @@
1
- import * as _$stylelint from "stylelint";
2
-
3
1
  //#region src/shareable-configs/tailwind4.d.ts
4
- declare const _default: _$stylelint.Config;
2
+ declare const _default: import("stylelint").Config;
5
3
  //#endregion
6
4
  export { _default as default };
7
5
  //# sourceMappingURL=tailwind4.d.mts.map
@@ -1,4 +1,4 @@
1
- import { t as defineConfig } from "../factory-wCIsmB0H.mjs";
1
+ import { t as defineConfig } from "../factory-B33e_UAZ.mjs";
2
2
  //#region src/shareable-configs/tailwind4.ts
3
3
  var tailwind4_default = defineConfig({
4
4
  tailwind: 4,
@@ -1 +1 @@
1
- {"version":3,"file":"tailwind4.mjs","names":[],"sources":["../../src/shareable-configs/tailwind4.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: false,\n});\n"],"mappings":";;AAEA,IAAA,oBAAe,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;CACN,CAAC"}
1
+ {"version":3,"file":"tailwind4.mjs","names":[],"sources":["../../src/shareable-configs/tailwind4.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: 4,\n sass: false,\n vue: false,\n});\n"],"mappings":";;AAEA,IAAA,oBAAe,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
@@ -1,5 +1,5 @@
1
1
  //#region src/shareable-configs/vue.ts
2
- var vue_default = require("../factory-BTQtj5HJ.cjs").defineConfig({
2
+ var vue_default = require("../factory-BNS_YTTh.cjs").defineConfig({
3
3
  tailwind: false,
4
4
  sass: false,
5
5
  vue: true
@@ -1 +1 @@
1
- {"version":3,"file":"vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: false,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,iDAAeA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;CACN,CAAC"}
1
+ {"version":3,"file":"vue.cjs","names":["defineConfig"],"sources":["../../src/shareable-configs/vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: false,\n vue: true,\n});\n"],"mappings":";AAEA,IAAA,+CAAeA,CAAAA,CAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
@@ -1,6 +1,4 @@
1
- import * as _$stylelint from "stylelint";
2
-
3
1
  //#region src/shareable-configs/vue.d.ts
4
- declare const _default: _$stylelint.Config;
2
+ declare const _default: import("stylelint").Config;
5
3
  export = _default;
6
4
  //# sourceMappingURL=vue.d.cts.map
@@ -1,7 +1,5 @@
1
- import * as _$stylelint from "stylelint";
2
-
3
1
  //#region src/shareable-configs/vue.d.ts
4
- declare const _default: _$stylelint.Config;
2
+ declare const _default: import("stylelint").Config;
5
3
  //#endregion
6
4
  export { _default as default };
7
5
  //# sourceMappingURL=vue.d.mts.map
@@ -1,4 +1,4 @@
1
- import { t as defineConfig } from "../factory-wCIsmB0H.mjs";
1
+ import { t as defineConfig } from "../factory-B33e_UAZ.mjs";
2
2
  //#region src/shareable-configs/vue.ts
3
3
  var vue_default = defineConfig({
4
4
  tailwind: false,
@@ -1 +1 @@
1
- {"version":3,"file":"vue.mjs","names":[],"sources":["../../src/shareable-configs/vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: false,\n vue: true,\n});\n"],"mappings":";;AAEA,IAAA,cAAe,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;CACN,CAAC"}
1
+ {"version":3,"file":"vue.mjs","names":[],"sources":["../../src/shareable-configs/vue.ts"],"sourcesContent":["import defineConfig from '~/factory';\n\nexport default defineConfig({\n tailwind: false,\n sass: false,\n vue: true,\n});\n"],"mappings":";;AAEA,IAAA,cAAe,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@culur/config-stylelint",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Culur's stylelint configuration",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -70,24 +70,24 @@
70
70
  "node": ">=20"
71
71
  },
72
72
  "dependencies": {
73
- "stylelint-config-clean-order": "^8.0.1",
73
+ "stylelint-config-clean-order": "^10.0.0",
74
74
  "stylelint-config-html": "^1.1.0",
75
75
  "stylelint-config-standard": "^40.0.0",
76
76
  "stylelint-config-standard-scss": "^17.0.0",
77
77
  "stylelint-config-standard-vue": "^1.0.0",
78
78
  "stylelint-order": "^8.1.1",
79
- "stylelint-scss": "^7.0.0",
80
- "stylelint-selector-bem-pattern": "^4.0.1",
81
- "@culur/utils-packages": "1.3.0"
79
+ "stylelint-scss": "^7.2.0",
80
+ "stylelint-selector-bem-pattern": "^5.0.0",
81
+ "@culur/utils-packages": "1.3.1"
82
82
  },
83
83
  "devDependencies": {
84
84
  "dedent": "^1.7.2",
85
- "postcss": "^8.5.8",
85
+ "postcss": "^8.5.23",
86
86
  "postcss-html": "^1.8.1",
87
87
  "postcss-sass": "^0.5.0",
88
88
  "postcss-scss": "^4.0.9",
89
- "stylelint": "^17.6.0",
90
- "@culur/config-tsdown": "1.1.0",
89
+ "stylelint": "^17.14.1",
90
+ "@culur/config-tsdown": "1.1.2",
91
91
  "@culur/config-typescript": "2.0.0"
92
92
  },
93
93
  "peerDependencies": {
@@ -0,0 +1,8 @@
1
+ import { assert } from 'vitest';
2
+ import { describeConfig } from '~/__tests__';
3
+ import { configCss } from './css';
4
+
5
+ describeConfig(configCss, config => {
6
+ assert(Array.isArray(config.extends));
7
+ assert(Array.isArray(config.plugins));
8
+ });
@@ -0,0 +1,7 @@
1
+ import { assert } from 'vitest';
2
+ import { describeConfig } from '~/__tests__';
3
+ import { configScss } from './scss';
4
+
5
+ describeConfig(configScss, config => {
6
+ assert(Array.isArray(config.extends));
7
+ });
@@ -0,0 +1,7 @@
1
+ import { assert } from 'vitest';
2
+ import { describeConfig } from '~/__tests__';
3
+ import { configShared } from './shared';
4
+
5
+ describeConfig(configShared, config => {
6
+ assert(Array.isArray(config.extends));
7
+ });
@@ -0,0 +1,17 @@
1
+ import { assert } from 'vitest';
2
+ import { describeConfig } from '~/__tests__';
3
+ import { configVue } from './vue';
4
+
5
+ describeConfig(
6
+ configVue,
7
+ [{ sass: true }, { sass: false }],
8
+ (config, testCase) => {
9
+ assert(Array.isArray(config.extends));
10
+ assert(Array.isArray(config.extends));
11
+ config.extends.includes(
12
+ testCase.sass
13
+ ? 'stylelint-config-standard-vue/scss'
14
+ : 'stylelint-config-standard-vue',
15
+ );
16
+ },
17
+ );
@@ -0,0 +1,30 @@
1
+ import { css, describeLintAndFix } from './__tests__';
2
+ import defineConfig from './factory';
3
+
4
+ describeLintAndFix(
5
+ () => defineConfig({ vue: true, sass: true }),
6
+ [
7
+ {
8
+ code: css`
9
+ a {
10
+ color: red;
11
+ }
12
+ `,
13
+ isError: false,
14
+ },
15
+ ],
16
+ );
17
+
18
+ describeLintAndFix(
19
+ () => defineConfig(),
20
+ [
21
+ {
22
+ code: css`
23
+ a {
24
+ color: red;
25
+ }
26
+ `,
27
+ isError: false,
28
+ },
29
+ ],
30
+ );
@@ -0,0 +1,48 @@
1
+ import { assert, expect } from 'vitest';
2
+ import { describeLintAndFix, describeRule, syntaxScss } from '~/__tests__';
3
+ import {
4
+ atRuleNoUnknownCSS,
5
+ atRuleNoUnknownRule,
6
+ atRuleNoUnknownSCSS,
7
+ } from './at-rule-no-unknown';
8
+
9
+ describeRule(
10
+ atRuleNoUnknownRule,
11
+ [
12
+ { tailwind: false, length: 0 },
13
+ { tailwind: 0, length: 5 },
14
+ { tailwind: 1, length: 6 },
15
+ { tailwind: 2, length: 6 },
16
+ { tailwind: 3, length: 4 },
17
+ { tailwind: 4, length: 10 },
18
+ ],
19
+ (rule, testCase) => {
20
+ assert(Array.isArray(rule));
21
+ assert(typeof rule[1] === 'object');
22
+ expect(rule[1].ignoreAtRules).toHaveLength(testCase.length);
23
+ },
24
+ );
25
+
26
+ describeLintAndFix(
27
+ o => ({ rules: atRuleNoUnknownCSS(o) }),
28
+ [
29
+ { tailwind: false, code: '@unknown {}', isError: true },
30
+ { tailwind: false, code: '@media {}', isError: false },
31
+ { tailwind: 3, code: '@tailwind {}', isError: false },
32
+ { tailwind: 4, code: '@tailwind {}', isError: true },
33
+ ],
34
+ );
35
+
36
+ describeLintAndFix(
37
+ o => ({
38
+ plugins: ['stylelint-scss'],
39
+ rules: atRuleNoUnknownSCSS(o),
40
+ overrides: [syntaxScss],
41
+ }),
42
+ [
43
+ { ext: 'scss', tailwind: false, code: '@unknown {}', isError: true },
44
+ { ext: 'scss', tailwind: false, code: '@media {}', isError: false },
45
+ { ext: 'scss', tailwind: 3, code: '@tailwind {}', isError: false },
46
+ { ext: 'scss', tailwind: 4, code: '@tailwind {}', isError: true },
47
+ ],
48
+ );
@@ -0,0 +1,36 @@
1
+ import { assert, expect } from 'vitest';
2
+ import { css, describeLintAndFix, describeRule } from '~/__tests__';
3
+ import {
4
+ declarationBlockNoRedundantLonghandProperties,
5
+ declarationBlockNoRedundantLonghandPropertiesRule,
6
+ } from './declaration-block-no-redundant-longhand-properties';
7
+
8
+ describeRule(
9
+ declarationBlockNoRedundantLonghandPropertiesRule, //
10
+ rule => {
11
+ assert(Array.isArray(rule));
12
+ assert(typeof rule[1] === 'object');
13
+ expect(rule[1].ignoreShorthands).toHaveLength(1);
14
+ },
15
+ );
16
+
17
+ describeLintAndFix(
18
+ { rules: declarationBlockNoRedundantLonghandProperties }, //
19
+ [
20
+ {
21
+ code: css`
22
+ a {
23
+ margin-top: 1px;
24
+ margin-right: 2px;
25
+ margin-bottom: 3px;
26
+ margin-left: 4px;
27
+ }
28
+ `,
29
+ fixedCode: css`
30
+ a {
31
+ margin: 1px 2px 3px 4px;
32
+ }
33
+ `,
34
+ },
35
+ ],
36
+ );
@@ -0,0 +1,27 @@
1
+ import { assert, expectTypeOf } from 'vitest';
2
+ import { describeLintAndFix, describeRule, scss } from '~/__tests__';
3
+ import {
4
+ dollarVariablePatternRule,
5
+ dollarVariablePatternSCSS,
6
+ } from './dollar-variable-pattern';
7
+
8
+ describeRule(
9
+ dollarVariablePatternRule, //
10
+ rule => {
11
+ assert(Array.isArray(rule));
12
+ assert(typeof rule[1] === 'object');
13
+ expectTypeOf(rule[1].message).toBeString();
14
+ },
15
+ );
16
+
17
+ describeLintAndFix(
18
+ {
19
+ extends: ['stylelint-config-standard-scss'],
20
+ rules: dollarVariablePatternSCSS,
21
+ },
22
+ [
23
+ { isError: false, code: scss`a { $kebab-case: 123; }` },
24
+ { isError: true, code: scss`a { $snake_case: 123; }` },
25
+ { isError: true, code: scss`a { $camelCase: 123; }` },
26
+ ],
27
+ );
@@ -0,0 +1,44 @@
1
+ import { assert, expect } from 'vitest';
2
+ import { describeLintAndFix, describeRule } from '~/__tests__';
3
+ import {
4
+ functionNoUnknown,
5
+ functionNoUnknownRule,
6
+ } from './function-no-unknown';
7
+
8
+ describeRule(
9
+ functionNoUnknownRule,
10
+ [
11
+ { tailwind: 0, sass: false, vue: false, length: 1 },
12
+ { tailwind: 1, sass: false, vue: false, length: 1 },
13
+ { tailwind: 2, sass: false, vue: false, length: 2 },
14
+ { tailwind: 3, sass: false, vue: false, length: 2 },
15
+ { tailwind: 4, sass: false, vue: false, length: 3 },
16
+ { tailwind: false, sass: true, vue: false, length: 1 },
17
+ { tailwind: false, sass: false, vue: true, length: 1 },
18
+ ],
19
+ (rule, options) => {
20
+ assert(Array.isArray(rule));
21
+ assert(typeof rule[1] === 'object');
22
+ expect(rule[1].ignoreFunctions).toHaveLength(options.length);
23
+ },
24
+ );
25
+
26
+ describeLintAndFix(
27
+ o => ({ rules: functionNoUnknown(o) }),
28
+ [
29
+ {
30
+ isError: true,
31
+ code: 'a { color: unknown(1); }',
32
+ },
33
+ {
34
+ tailwind: 3,
35
+ isError: false,
36
+ code: 'a { color: theme(colors.blue.500); }',
37
+ },
38
+ {
39
+ vue: true,
40
+ isError: false,
41
+ code: 'a { color: v-bind(colors); }',
42
+ },
43
+ ],
44
+ );
@@ -0,0 +1,16 @@
1
+ import { describeLintAndFix } from '~/__tests__';
2
+ import { importNotationCSS } from './import-notation';
3
+
4
+ describeLintAndFix(
5
+ o => ({
6
+ extends: ['stylelint-config-standard'],
7
+ rules: importNotationCSS(o),
8
+ }),
9
+ [
10
+ { tailwind: 0, code: '@import "tailwindcss";', isError: true },
11
+ { tailwind: 1, code: '@import "tailwindcss";', isError: true },
12
+ { tailwind: 2, code: '@import "tailwindcss";', isError: true },
13
+ { tailwind: 3, code: '@import "tailwindcss";', isError: true },
14
+ { tailwind: 4, code: '@import "tailwindcss";', isError: false },
15
+ ],
16
+ );
@@ -0,0 +1,53 @@
1
+ import { assert, expect } from 'vitest';
2
+ import { describeLintAndFix, describeRule, scss } from '~/__tests__';
3
+ import { order, orderRule } from './order';
4
+
5
+ describeRule(
6
+ orderRule,
7
+ [
8
+ { sass: false, length: 9 },
9
+ { sass: true, length: 17 },
10
+
11
+ { tailwind: 0, length: 14 },
12
+ { tailwind: 1, length: 15 },
13
+ { tailwind: 2, length: 15 },
14
+ { tailwind: 3, length: 13 },
15
+ { tailwind: 4, length: 19 },
16
+
17
+ { tailwind: 0, sass: true, length: 22 },
18
+ { tailwind: 1, sass: true, length: 23 },
19
+ { tailwind: 2, sass: true, length: 23 },
20
+ { tailwind: 3, sass: true, length: 21 },
21
+ ],
22
+ (rule, testCase) => {
23
+ assert(Array.isArray(rule));
24
+
25
+ assert(Array.isArray(rule[0]));
26
+ expect(rule[0]).toHaveLength(testCase.length);
27
+
28
+ assert(typeof rule[1] === 'object');
29
+ expect(rule[1]).toStrictEqual({ unspecified: 'bottom' });
30
+ },
31
+ );
32
+
33
+ describeLintAndFix(
34
+ o => ({
35
+ plugins: ['stylelint-order'],
36
+ rules: order(o),
37
+ }),
38
+ [
39
+ {
40
+ tailwind: false,
41
+ sass: false,
42
+ code: scss`
43
+ a {
44
+ $variable: 1px;
45
+ @variable: 2px;
46
+ --property: 3px;
47
+ width: 4px;
48
+ }
49
+ `,
50
+ isError: false,
51
+ },
52
+ ],
53
+ );
@@ -0,0 +1,40 @@
1
+ import { assert, expect } from 'vitest';
2
+ import { css, describeLintAndFix, describeRule } from '~/__tests__';
3
+ import {
4
+ selectorPseudoClassNoUnknown,
5
+ selectorPseudoClassNoUnknownRule,
6
+ } from './selector-pseudo-class-no-unknown';
7
+
8
+ describeRule(
9
+ selectorPseudoClassNoUnknownRule, //
10
+ rule => {
11
+ assert(Array.isArray(rule));
12
+ assert(typeof rule[1] === 'object');
13
+ expect(rule[1].ignorePseudoClasses).toHaveLength(2);
14
+ },
15
+ );
16
+
17
+ describeLintAndFix(
18
+ { rules: selectorPseudoClassNoUnknown }, //
19
+ [
20
+ {
21
+ code: css`
22
+ :global(.global-class) {
23
+ /* global */
24
+ }
25
+ :local(.local-class) {
26
+ /* local */
27
+ }
28
+ `,
29
+ isError: false,
30
+ },
31
+ {
32
+ code: css`
33
+ :invalid-pseudo(.some-class) {
34
+ /* */
35
+ }
36
+ `,
37
+ isError: true,
38
+ },
39
+ ],
40
+ );
@@ -0,0 +1,25 @@
1
+ import type { Config } from 'stylelint';
2
+ import { expectTypeOf, it } from 'vitest';
3
+ import autoConfig from './auto';
4
+ import noneConfig from './none';
5
+ import sassConfig from './sass';
6
+ import sassVueConfig from './sass-vue';
7
+ import tailwind3Config from './tailwind3';
8
+ import tailwind3SassConfig from './tailwind3-sass';
9
+ import tailwind3SassVueConfig from './tailwind3-sass-vue';
10
+ import tailwind4Config from './tailwind4';
11
+ import tailwind4VueConfig from './tailwind4-vue';
12
+ import vueConfig from './vue';
13
+
14
+ it('shareable configs', () => {
15
+ expectTypeOf(autoConfig).toEqualTypeOf<Config>();
16
+ expectTypeOf(noneConfig).toEqualTypeOf<Config>();
17
+ expectTypeOf(sassVueConfig).toEqualTypeOf<Config>();
18
+ expectTypeOf(sassConfig).toEqualTypeOf<Config>();
19
+ expectTypeOf(tailwind3SassVueConfig).toEqualTypeOf<Config>();
20
+ expectTypeOf(tailwind3SassConfig).toEqualTypeOf<Config>();
21
+ expectTypeOf(tailwind3Config).toEqualTypeOf<Config>();
22
+ expectTypeOf(tailwind4Config).toEqualTypeOf<Config>();
23
+ expectTypeOf(tailwind4VueConfig).toEqualTypeOf<Config>();
24
+ expectTypeOf(vueConfig).toEqualTypeOf<Config>();
25
+ });
@@ -0,0 +1,46 @@
1
+ import { assert, describe, expect, expectTypeOf, it } from 'vitest';
2
+ import { defineRule, defineRules, mergeConfigs } from './utils';
3
+
4
+ describe('rules', () => {
5
+ it('defineRule & rules', () => {
6
+ type PrimaryOption = true;
7
+ interface SecondaryOptions {
8
+ ignore: ['comments'];
9
+ }
10
+
11
+ const blockNoEmptyRule = defineRule<PrimaryOption, SecondaryOptions>([
12
+ true,
13
+ { ignore: ['comments'] },
14
+ ]);
15
+ const blockNoEmpty = defineRules({ 'block-no-empty': blockNoEmptyRule });
16
+
17
+ assert(Array.isArray(blockNoEmptyRule));
18
+ expectTypeOf(blockNoEmpty).toBeObject();
19
+ });
20
+ });
21
+
22
+ describe('merge configs', () => {
23
+ it('should merge plugins', () => {
24
+ const mergedConfigs = mergeConfigs(
25
+ { plugins: ['plugin-a'] }, //
26
+ { plugins: ['plugin-b'] },
27
+ { plugins: [] },
28
+ {},
29
+ );
30
+
31
+ assert(Array.isArray(mergedConfigs.plugins));
32
+ expect(mergedConfigs.plugins).toHaveLength(2);
33
+ });
34
+
35
+ it('should merge overrides', () => {
36
+ const mergedConfigs = mergeConfigs(
37
+ { overrides: [{ files: 'a.css' }] },
38
+ { overrides: [{ files: 'b.css' }] },
39
+ { overrides: [] },
40
+ {},
41
+ );
42
+
43
+ assert(Array.isArray(mergedConfigs.overrides));
44
+ expect(mergedConfigs.overrides).toHaveLength(2);
45
+ });
46
+ });
@@ -6,10 +6,7 @@ type StringOrRegex = string | RegExp;
6
6
  type OneOrMany<S> = S | S[];
7
7
 
8
8
  export type Primary =
9
- | number
10
- | true
11
- | OneOrMany<StringOrRegex>
12
- | Record<string, any>;
9
+ number | true | OneOrMany<StringOrRegex> | Record<string, any>;
13
10
  export type Secondary = Record<string, any>;
14
11
 
15
12
  export const defineRule = <