@culur/config-stylelint 1.6.5 → 1.7.1
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.
- package/CHANGELOG.md +48 -0
- package/dist/factory-B33e_UAZ.mjs +264 -0
- package/dist/factory-B33e_UAZ.mjs.map +1 -0
- package/dist/factory-BNS_YTTh.cjs +269 -0
- package/dist/factory-BNS_YTTh.cjs.map +1 -0
- package/dist/factory.cjs +2 -10
- package/dist/factory.d.cts +5 -4
- package/dist/factory.d.mts +8 -0
- package/dist/factory.mjs +2 -0
- package/dist/shareable-configs/auto.cjs +10 -9
- package/dist/shareable-configs/auto.cjs.map +1 -1
- package/dist/shareable-configs/auto.d.cts +4 -5
- package/dist/shareable-configs/auto.d.mts +5 -0
- package/dist/shareable-configs/auto.mjs +13 -0
- package/dist/shareable-configs/auto.mjs.map +1 -0
- package/dist/shareable-configs/none.cjs +8 -9
- package/dist/shareable-configs/none.cjs.map +1 -1
- package/dist/shareable-configs/none.d.cts +4 -5
- package/dist/shareable-configs/none.d.mts +5 -0
- package/dist/shareable-configs/none.mjs +11 -0
- package/dist/shareable-configs/none.mjs.map +1 -0
- package/dist/shareable-configs/sass-vue.cjs +8 -9
- package/dist/shareable-configs/sass-vue.cjs.map +1 -1
- package/dist/shareable-configs/sass-vue.d.cts +4 -5
- package/dist/shareable-configs/sass-vue.d.mts +5 -0
- package/dist/shareable-configs/sass-vue.mjs +11 -0
- package/dist/shareable-configs/sass-vue.mjs.map +1 -0
- package/dist/shareable-configs/sass.cjs +8 -9
- package/dist/shareable-configs/sass.cjs.map +1 -1
- package/dist/shareable-configs/sass.d.cts +4 -5
- package/dist/shareable-configs/sass.d.mts +5 -0
- package/dist/shareable-configs/sass.mjs +11 -0
- package/dist/shareable-configs/sass.mjs.map +1 -0
- package/dist/shareable-configs/tailwind3-sass-vue.cjs +8 -9
- package/dist/shareable-configs/tailwind3-sass-vue.cjs.map +1 -1
- package/dist/shareable-configs/tailwind3-sass-vue.d.cts +4 -5
- package/dist/shareable-configs/tailwind3-sass-vue.d.mts +5 -0
- package/dist/shareable-configs/tailwind3-sass-vue.mjs +11 -0
- package/dist/shareable-configs/tailwind3-sass-vue.mjs.map +1 -0
- package/dist/shareable-configs/tailwind3-sass.cjs +8 -9
- package/dist/shareable-configs/tailwind3-sass.cjs.map +1 -1
- package/dist/shareable-configs/tailwind3-sass.d.cts +4 -5
- package/dist/shareable-configs/tailwind3-sass.d.mts +5 -0
- package/dist/shareable-configs/tailwind3-sass.mjs +11 -0
- package/dist/shareable-configs/tailwind3-sass.mjs.map +1 -0
- package/dist/shareable-configs/tailwind3.cjs +8 -9
- package/dist/shareable-configs/tailwind3.cjs.map +1 -1
- package/dist/shareable-configs/tailwind3.d.cts +4 -5
- package/dist/shareable-configs/tailwind3.d.mts +5 -0
- package/dist/shareable-configs/tailwind3.mjs +11 -0
- package/dist/shareable-configs/tailwind3.mjs.map +1 -0
- package/dist/shareable-configs/tailwind4-vue.cjs +8 -9
- package/dist/shareable-configs/tailwind4-vue.cjs.map +1 -1
- package/dist/shareable-configs/tailwind4-vue.d.cts +4 -5
- package/dist/shareable-configs/tailwind4-vue.d.mts +5 -0
- package/dist/shareable-configs/tailwind4-vue.mjs +11 -0
- package/dist/shareable-configs/tailwind4-vue.mjs.map +1 -0
- package/dist/shareable-configs/tailwind4.cjs +8 -9
- package/dist/shareable-configs/tailwind4.cjs.map +1 -1
- package/dist/shareable-configs/tailwind4.d.cts +4 -5
- package/dist/shareable-configs/tailwind4.d.mts +5 -0
- package/dist/shareable-configs/tailwind4.mjs +11 -0
- package/dist/shareable-configs/tailwind4.mjs.map +1 -0
- package/dist/shareable-configs/vue.cjs +8 -9
- package/dist/shareable-configs/vue.cjs.map +1 -1
- package/dist/shareable-configs/vue.d.cts +4 -5
- package/dist/shareable-configs/vue.d.mts +5 -0
- package/dist/shareable-configs/vue.mjs +11 -0
- package/dist/shareable-configs/vue.mjs.map +1 -0
- package/package.json +19 -18
- package/src/__tests__/describe-rule-or-config.ts +5 -12
- package/src/configs/css.test.ts +8 -0
- package/src/configs/scss.test.ts +7 -0
- package/src/configs/shared.test.ts +7 -0
- package/src/configs/vue.test.ts +17 -0
- package/src/factory.test.ts +30 -0
- package/src/rules/at-rule-no-unknown.test.ts +48 -0
- package/src/rules/declaration-block-no-redundant-longhand-properties.test.ts +36 -0
- package/src/rules/dollar-variable-pattern.test.ts +27 -0
- package/src/rules/function-no-unknown.test.ts +44 -0
- package/src/rules/function-no-unknown.ts +2 -1
- package/src/rules/import-notation.test.ts +16 -0
- package/src/rules/order.test.ts +53 -0
- package/src/rules/order.ts +3 -1
- package/src/rules/selector-pseudo-class-no-unknown.test.ts +40 -0
- package/src/shareable-configs/shareable-configs.test.ts +25 -0
- package/src/utils/index.ts +1 -4
- package/src/utils/utils.test.ts +46 -0
- package/src/utils/utils.ts +11 -6
- package/dist/chunk-4NUI5NSE.js +0 -12
- package/dist/chunk-4NUI5NSE.js.map +0 -1
- package/dist/chunk-4YAD5VQL.js +0 -12
- package/dist/chunk-4YAD5VQL.js.map +0 -1
- package/dist/chunk-5UBWHXRE.js +0 -12
- package/dist/chunk-5UBWHXRE.js.map +0 -1
- package/dist/chunk-6OBN7KHD.js +0 -294
- package/dist/chunk-6OBN7KHD.js.map +0 -1
- package/dist/chunk-7ZUITFGA.js +0 -12
- package/dist/chunk-7ZUITFGA.js.map +0 -1
- package/dist/chunk-AFCQFKUH.js +0 -13
- package/dist/chunk-AFCQFKUH.js.map +0 -1
- package/dist/chunk-BHT5EOA2.cjs +0 -14
- package/dist/chunk-BHT5EOA2.cjs.map +0 -1
- package/dist/chunk-EQCVQC35.js +0 -31
- package/dist/chunk-EQCVQC35.js.map +0 -1
- package/dist/chunk-EWMD7NRS.cjs +0 -35
- package/dist/chunk-EWMD7NRS.cjs.map +0 -1
- package/dist/chunk-FWOPRDUM.js +0 -12
- package/dist/chunk-FWOPRDUM.js.map +0 -1
- package/dist/chunk-GCV5C6BZ.cjs +0 -14
- package/dist/chunk-GCV5C6BZ.cjs.map +0 -1
- package/dist/chunk-IA64Z5UZ.cjs +0 -14
- package/dist/chunk-IA64Z5UZ.cjs.map +0 -1
- package/dist/chunk-J25EZAJ4.js +0 -12
- package/dist/chunk-J25EZAJ4.js.map +0 -1
- package/dist/chunk-JYXCCHVU.cjs +0 -14
- package/dist/chunk-JYXCCHVU.cjs.map +0 -1
- package/dist/chunk-MIEGJBQU.js +0 -12
- package/dist/chunk-MIEGJBQU.js.map +0 -1
- package/dist/chunk-OENPZ3K4.cjs +0 -14
- package/dist/chunk-OENPZ3K4.cjs.map +0 -1
- package/dist/chunk-R2TQLDIH.cjs +0 -14
- package/dist/chunk-R2TQLDIH.cjs.map +0 -1
- package/dist/chunk-RD436EBS.cjs +0 -14
- package/dist/chunk-RD436EBS.cjs.map +0 -1
- package/dist/chunk-TB3LMVRG.js +0 -12
- package/dist/chunk-TB3LMVRG.js.map +0 -1
- package/dist/chunk-TKBQZWT7.cjs +0 -14
- package/dist/chunk-TKBQZWT7.cjs.map +0 -1
- package/dist/chunk-VZLSZBBN.js +0 -12
- package/dist/chunk-VZLSZBBN.js.map +0 -1
- package/dist/chunk-XZC4I6JL.cjs +0 -15
- package/dist/chunk-XZC4I6JL.cjs.map +0 -1
- package/dist/chunk-YZM2MVV3.cjs +0 -14
- package/dist/chunk-YZM2MVV3.cjs.map +0 -1
- package/dist/chunk-ZQACBLEL.cjs +0 -296
- package/dist/chunk-ZQACBLEL.cjs.map +0 -1
- package/dist/factory.cjs.map +0 -1
- package/dist/factory.d.ts +0 -6
- package/dist/factory.js +0 -4
- package/dist/factory.js.map +0 -1
- package/dist/magic-string.es-6P4WW7RB.js +0 -1307
- package/dist/magic-string.es-6P4WW7RB.js.map +0 -1
- package/dist/magic-string.es-PN2DQOGS.cjs +0 -1313
- package/dist/magic-string.es-PN2DQOGS.cjs.map +0 -1
- package/dist/shareable-configs/auto.d.ts +0 -5
- package/dist/shareable-configs/auto.js +0 -5
- package/dist/shareable-configs/auto.js.map +0 -1
- package/dist/shareable-configs/none.d.ts +0 -5
- package/dist/shareable-configs/none.js +0 -5
- package/dist/shareable-configs/none.js.map +0 -1
- package/dist/shareable-configs/sass-vue.d.ts +0 -5
- package/dist/shareable-configs/sass-vue.js +0 -5
- package/dist/shareable-configs/sass-vue.js.map +0 -1
- package/dist/shareable-configs/sass.d.ts +0 -5
- package/dist/shareable-configs/sass.js +0 -5
- package/dist/shareable-configs/sass.js.map +0 -1
- package/dist/shareable-configs/tailwind3-sass-vue.d.ts +0 -5
- package/dist/shareable-configs/tailwind3-sass-vue.js +0 -5
- package/dist/shareable-configs/tailwind3-sass-vue.js.map +0 -1
- package/dist/shareable-configs/tailwind3-sass.d.ts +0 -5
- package/dist/shareable-configs/tailwind3-sass.js +0 -5
- package/dist/shareable-configs/tailwind3-sass.js.map +0 -1
- package/dist/shareable-configs/tailwind3.d.ts +0 -5
- package/dist/shareable-configs/tailwind3.js +0 -5
- package/dist/shareable-configs/tailwind3.js.map +0 -1
- package/dist/shareable-configs/tailwind4-vue.d.ts +0 -5
- package/dist/shareable-configs/tailwind4-vue.js +0 -5
- package/dist/shareable-configs/tailwind4-vue.js.map +0 -1
- package/dist/shareable-configs/tailwind4.d.ts +0 -5
- package/dist/shareable-configs/tailwind4.js +0 -5
- package/dist/shareable-configs/tailwind4.js.map +0 -1
- package/dist/shareable-configs/vue.d.ts +0 -5
- package/dist/shareable-configs/vue.js +0 -5
- package/dist/shareable-configs/vue.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { _default as default };
|
|
1
|
+
//#region src/shareable-configs/tailwind4.d.ts
|
|
2
|
+
declare const _default: import("stylelint").Config;
|
|
3
|
+
export = _default;
|
|
4
|
+
//# sourceMappingURL=tailwind4.d.cts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as defineConfig } from "../factory-B33e_UAZ.mjs";
|
|
2
|
+
//#region src/shareable-configs/tailwind4.ts
|
|
3
|
+
var tailwind4_default = defineConfig({
|
|
4
|
+
tailwind: 4,
|
|
5
|
+
sass: false,
|
|
6
|
+
vue: false
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { tailwind4_default as default };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=tailwind4.mjs.map
|
|
@@ -0,0 +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;AACP,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/shareable-configs/vue.ts
|
|
2
|
+
var vue_default = require("../factory-BNS_YTTh.cjs").defineConfig({
|
|
3
|
+
tailwind: false,
|
|
4
|
+
sass: false,
|
|
5
|
+
vue: true
|
|
6
|
+
});
|
|
7
|
+
//#endregion
|
|
8
|
+
module.exports = vue_default;
|
|
2
9
|
|
|
3
|
-
var chunkOENPZ3K4_cjs = require('../chunk-OENPZ3K4.cjs');
|
|
4
|
-
require('../chunk-ZQACBLEL.cjs');
|
|
5
|
-
require('../chunk-EWMD7NRS.cjs');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
module.exports = chunkOENPZ3K4_cjs.vue_default;
|
|
10
|
-
//# sourceMappingURL=vue.cjs.map
|
|
11
10
|
//# sourceMappingURL=vue.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,EAAAA,aAAa;CAC1B,UAAU;CACV,MAAM;CACN,KAAK;AACP,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export { _default as default };
|
|
1
|
+
//#region src/shareable-configs/vue.d.ts
|
|
2
|
+
declare const _default: import("stylelint").Config;
|
|
3
|
+
export = _default;
|
|
4
|
+
//# sourceMappingURL=vue.d.cts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { t as defineConfig } from "../factory-B33e_UAZ.mjs";
|
|
2
|
+
//#region src/shareable-configs/vue.ts
|
|
3
|
+
var vue_default = defineConfig({
|
|
4
|
+
tailwind: false,
|
|
5
|
+
sass: false,
|
|
6
|
+
vue: true
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { vue_default as default };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=vue.mjs.map
|
|
@@ -0,0 +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;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@culur/config-stylelint",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Culur's stylelint configuration",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
27
|
"import": {
|
|
28
|
-
"types": "./dist/shareable-configs/auto.d.
|
|
29
|
-
"default": "./dist/shareable-configs/auto.
|
|
28
|
+
"types": "./dist/shareable-configs/auto.d.mts",
|
|
29
|
+
"default": "./dist/shareable-configs/auto.mjs"
|
|
30
30
|
},
|
|
31
31
|
"require": {
|
|
32
32
|
"types": "./dist/shareable-configs/auto.d.cts",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"./*": {
|
|
37
37
|
"import": {
|
|
38
|
-
"types": "./dist/shareable-configs/*.d.
|
|
39
|
-
"default": "./dist/shareable-configs/*.
|
|
38
|
+
"types": "./dist/shareable-configs/*.d.mts",
|
|
39
|
+
"default": "./dist/shareable-configs/*.mjs"
|
|
40
40
|
},
|
|
41
41
|
"require": {
|
|
42
42
|
"types": "./dist/shareable-configs/*.d.cts",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"./factory": {
|
|
47
47
|
"import": {
|
|
48
|
-
"types": "./dist/factory.d.
|
|
49
|
-
"default": "./dist/factory.
|
|
48
|
+
"types": "./dist/factory.d.mts",
|
|
49
|
+
"default": "./dist/factory.mjs"
|
|
50
50
|
},
|
|
51
51
|
"require": {
|
|
52
52
|
"types": "./dist/factory.d.cts",
|
|
@@ -70,31 +70,32 @@
|
|
|
70
70
|
"node": ">=20"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"stylelint-config-clean-order": "^
|
|
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
|
-
"stylelint-order": "^
|
|
79
|
-
"stylelint-scss": "^7.
|
|
80
|
-
"stylelint-selector-bem-pattern": "^
|
|
81
|
-
"@culur/utils-packages": "1.
|
|
78
|
+
"stylelint-order": "^8.1.1",
|
|
79
|
+
"stylelint-scss": "^7.1.1",
|
|
80
|
+
"stylelint-selector-bem-pattern": "^5.0.0",
|
|
81
|
+
"@culur/utils-packages": "1.3.0"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"dedent": "^1.7.
|
|
85
|
-
"postcss": "^8.5.
|
|
84
|
+
"dedent": "^1.7.2",
|
|
85
|
+
"postcss": "^8.5.15",
|
|
86
86
|
"postcss-html": "^1.8.1",
|
|
87
87
|
"postcss-sass": "^0.5.0",
|
|
88
88
|
"postcss-scss": "^4.0.9",
|
|
89
|
-
"
|
|
90
|
-
"@culur/config-
|
|
89
|
+
"stylelint": "^17.12.0",
|
|
90
|
+
"@culur/config-tsdown": "1.1.1",
|
|
91
|
+
"@culur/config-typescript": "2.0.0"
|
|
91
92
|
},
|
|
92
93
|
"peerDependencies": {
|
|
93
|
-
"stylelint": ">=
|
|
94
|
+
"stylelint": ">=17.0.0"
|
|
94
95
|
},
|
|
95
96
|
"scripts": {
|
|
96
97
|
"clean": "rimraf dist coverage",
|
|
97
|
-
"build": "
|
|
98
|
+
"build": "tsdown",
|
|
98
99
|
"test": "tsc --noEmit && vitest run",
|
|
99
100
|
"🧹 ----- LINT ----- 🧹": "",
|
|
100
101
|
"es-config": "eslint-config-inspector",
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import type { Packages } from '@culur/utils-packages';
|
|
2
2
|
import type { Config, ConfigRuleSettings } from 'stylelint';
|
|
3
|
-
import type {
|
|
4
|
-
ConfigRulePrimaryOption,
|
|
5
|
-
ConfigRuleSecondaryOptions,
|
|
6
|
-
} from '~/utils';
|
|
3
|
+
import type { Primary, Secondary } from '~/utils';
|
|
7
4
|
import { describe, expect, it } from 'vitest';
|
|
8
5
|
|
|
9
6
|
type Fn<
|
|
10
|
-
TRuleOrConfig extends
|
|
11
|
-
| ConfigRuleSettings<ConfigRulePrimaryOption, ConfigRuleSecondaryOptions>
|
|
12
|
-
| Config,
|
|
7
|
+
TRuleOrConfig extends ConfigRuleSettings<Primary, Secondary> | Config,
|
|
13
8
|
TTestCase extends Partial<Packages>,
|
|
14
9
|
> = (rule: TRuleOrConfig, testCase: TTestCase) => Promise<void> | void;
|
|
15
10
|
|
|
16
11
|
function describeRuleOrConfigFactory<
|
|
17
|
-
TBaseRuleOrConfig extends
|
|
18
|
-
| ConfigRuleSettings<ConfigRulePrimaryOption, ConfigRuleSecondaryOptions>
|
|
19
|
-
| Config,
|
|
12
|
+
TBaseRuleOrConfig extends ConfigRuleSettings<Primary, Secondary> | Config,
|
|
20
13
|
>(describeName: string) {
|
|
21
14
|
return function describeRuleOrConfig<
|
|
22
15
|
TRuleOrConfig extends TBaseRuleOrConfig,
|
|
@@ -60,7 +53,7 @@ function describeRuleOrConfigFactory<
|
|
|
60
53
|
export const describeConfig = describeRuleOrConfigFactory<Config>('config');
|
|
61
54
|
export const describeRule = describeRuleOrConfigFactory<
|
|
62
55
|
ConfigRuleSettings<
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
Primary, //
|
|
57
|
+
Secondary
|
|
65
58
|
>
|
|
66
59
|
>('rule');
|
|
@@ -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
|
+
);
|
|
@@ -30,6 +30,7 @@ const getIgnoreFunctionsByTailwindVersion = (
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
const sassFunctionRegex = /^(list|math|color)\..+/;
|
|
33
34
|
const getIgnoreFunctions = (packages: Partial<Packages>) => [
|
|
34
35
|
// https://tailwindcss.com
|
|
35
36
|
...getIgnoreFunctionsByTailwindVersion(packages.tailwind),
|
|
@@ -38,7 +39,7 @@ const getIgnoreFunctions = (packages: Partial<Packages>) => [
|
|
|
38
39
|
// https://sass-lang.com/documentation/modules/math
|
|
39
40
|
// https://sass-lang.com/documentation/modules/color
|
|
40
41
|
...(packages.sass //
|
|
41
|
-
? [
|
|
42
|
+
? [sassFunctionRegex]
|
|
42
43
|
: []),
|
|
43
44
|
|
|
44
45
|
// https://vuejs.org/api/sfc-css-features.html#v-bind-in-css
|
|
@@ -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
|
+
);
|
package/src/rules/order.ts
CHANGED
|
@@ -33,6 +33,8 @@ interface SecondaryOptions {
|
|
|
33
33
|
const definePrimaryOption = (...options: (PrimaryOption[number] | false | undefined)[]) =>
|
|
34
34
|
options.filter((option): option is PrimaryOption[number] => !!option);
|
|
35
35
|
|
|
36
|
+
const blockRuleRegex = /^&::[\w-]+/;
|
|
37
|
+
|
|
36
38
|
export const orderRule = (packages: Partial<Packages>) =>
|
|
37
39
|
defineRule<PrimaryOption, SecondaryOptions>([
|
|
38
40
|
definePrimaryOption(
|
|
@@ -73,7 +75,7 @@ export const orderRule = (packages: Partial<Packages>) =>
|
|
|
73
75
|
'declarations', // css: display: block;
|
|
74
76
|
|
|
75
77
|
//! block rules
|
|
76
|
-
{ type: 'rule', selector:
|
|
78
|
+
{ type: 'rule', selector: blockRuleRegex }, // css: &::after {}
|
|
77
79
|
'rules', // css: child-component {}
|
|
78
80
|
|
|
79
81
|
//! blocks nested
|
|
@@ -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
|
+
});
|
package/src/utils/index.ts
CHANGED