@culur/config-stylelint 1.6.5 → 1.7.0
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 +29 -0
- package/dist/factory-BTQtj5HJ.cjs +278 -0
- package/dist/factory-BTQtj5HJ.cjs.map +1 -0
- package/dist/factory-wCIsmB0H.mjs +273 -0
- package/dist/factory-wCIsmB0H.mjs.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 +5 -4
- package/dist/shareable-configs/auto.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/none.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/sass-vue.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/sass.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/tailwind3-sass-vue.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/tailwind3-sass.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/tailwind3.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/tailwind4-vue.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/tailwind4.d.mts +7 -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 +5 -4
- package/dist/shareable-configs/vue.d.mts +7 -0
- package/dist/shareable-configs/vue.mjs +11 -0
- package/dist/shareable-configs/vue.mjs.map +1 -0
- package/package.json +16 -15
- package/src/__tests__/describe-rule-or-config.ts +5 -12
- package/src/rules/function-no-unknown.ts +2 -1
- package/src/rules/order.ts +3 -1
- package/src/utils/index.ts +1 -4
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @culur/config-stylelint
|
|
2
2
|
|
|
3
|
+
## 1.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ⚙️ Migrate build system from `tsup` to `tsdown` across all packages ([`83b3791`](https://github.com/culur/culur/commit/83b379149b9e9536f4cd161976762afb35b6b61a)) ([@phamhongphuc](https://github.com/phamhongphuc)).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- ✨ Rename `ConfigRulePrimaryOption` and `ConfigRuleSecondaryOptions` to `Primary` and `Secondary` ([`cd6d18a`](https://github.com/culur/culur/commit/cd6d18a54a082ca44e90d557bf93f92bf1166bf4)) ([@phamhongphuc](https://github.com/phamhongphuc)).
|
|
12
|
+
Inline `Primary` and `Secondary` type definitions from `stylelint` source code to avoid direct dependency imports.
|
|
13
|
+
|
|
14
|
+
- ✨ Remove `baseUrl` and add `paths` in `tsconfig.json` to maintain compatibility with TypeScript 6 ([`926521c`](https://github.com/culur/culur/commit/926521c4545630ed5adfee614740ac6b9fa708b0)) ([@phamhongphuc](https://github.com/phamhongphuc)).
|
|
15
|
+
|
|
16
|
+
- 🎨 Format code ([`2e1b21c`](https://github.com/culur/culur/commit/2e1b21cffc3cec6b3896070af071519dc5a8ccfc)) ([@phamhongphuc](https://github.com/phamhongphuc)).
|
|
17
|
+
|
|
18
|
+
- 📦 Update dependencies ([`9ad8540`](https://github.com/culur/culur/commit/9ad85406891191012385edf0f8e31ee653e9ecbe)) ([@renovate](https://github.com/apps/renovate)):
|
|
19
|
+
- `dependencies`:
|
|
20
|
+
- `stylelint-order@^8.1.1`
|
|
21
|
+
|
|
22
|
+
- ⚙️ Update dependencies ([`5c2c972`](https://github.com/culur/culur/commit/5c2c9722dc9366e8d2208d01a6cc55f8772e0b16)) ([@renovate](https://github.com/apps/renovate)):
|
|
23
|
+
- `devDependencies`:
|
|
24
|
+
- `dedent@^1.7.2`
|
|
25
|
+
- `postcss@^8.5.8`
|
|
26
|
+
|
|
27
|
+
- ⚙️ Added `stylelint` to `devDependencies` and updated `peerDependencies` to support Stylelint 17 ([`ea635d6`](https://github.com/culur/culur/commit/ea635d60a6e2bdf0eee9651c462143edb05b35db)) ([@phamhongphuc](https://github.com/phamhongphuc)).
|
|
28
|
+
|
|
29
|
+
- 📦 Update workspace dependencies:
|
|
30
|
+
- [`@culur/utils-packages@1.3.0`](https://github.com/culur/culur/tree/main/packages/utils-packages#readme)
|
|
31
|
+
|
|
3
32
|
## 1.6.5
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
//#region src/utils/utils.ts
|
|
2
|
+
const defineRule = (rule) => rule;
|
|
3
|
+
const defineRules = (rule) => rule;
|
|
4
|
+
const mergeConfigs = (...configsOrNull) => {
|
|
5
|
+
const configs = configsOrNull.filter((c) => !!c);
|
|
6
|
+
return {
|
|
7
|
+
plugins: [...new Set(configs.flatMap((c) => c.plugins ?? []))],
|
|
8
|
+
overrides: [...new Set(configs.flatMap((c) => c.overrides ?? []))],
|
|
9
|
+
extends: configs.flatMap((c) => c.extends ?? []).filter((item, index, arr) => arr.lastIndexOf(item) === index),
|
|
10
|
+
rules: configs.reduce((acc, config) => ({
|
|
11
|
+
...acc,
|
|
12
|
+
...config.rules
|
|
13
|
+
}), {}),
|
|
14
|
+
...configs.reduce((acc, { plugins: _p, overrides: _o, extends: _e, rules: _r, ...config }) => ({
|
|
15
|
+
...acc,
|
|
16
|
+
...config
|
|
17
|
+
}), {})
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const isInRange = (version, ...versions) => typeof version === "number" && versions.includes(version);
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/rules/at-rule-no-unknown.ts
|
|
23
|
+
const getIgnoreAtRulesByTailwindVersion = (tailwindVersion) => {
|
|
24
|
+
switch (tailwindVersion) {
|
|
25
|
+
case 0: return [
|
|
26
|
+
"tailwind",
|
|
27
|
+
"apply",
|
|
28
|
+
"variants",
|
|
29
|
+
"responsive",
|
|
30
|
+
"screen"
|
|
31
|
+
];
|
|
32
|
+
case 1:
|
|
33
|
+
case 2: return [
|
|
34
|
+
"tailwind",
|
|
35
|
+
"apply",
|
|
36
|
+
"layer",
|
|
37
|
+
"variants",
|
|
38
|
+
"responsive",
|
|
39
|
+
"screen"
|
|
40
|
+
];
|
|
41
|
+
case 3: return [
|
|
42
|
+
"tailwind",
|
|
43
|
+
"layer",
|
|
44
|
+
"apply",
|
|
45
|
+
"config"
|
|
46
|
+
];
|
|
47
|
+
case 4: return [
|
|
48
|
+
"import",
|
|
49
|
+
"theme",
|
|
50
|
+
"source",
|
|
51
|
+
"utility",
|
|
52
|
+
"variant",
|
|
53
|
+
"custom-variant",
|
|
54
|
+
"apply",
|
|
55
|
+
"reference",
|
|
56
|
+
"config",
|
|
57
|
+
"plugin"
|
|
58
|
+
];
|
|
59
|
+
default: return [];
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const atRuleNoUnknownRule = (packages) => defineRule([true, { ignoreAtRules: getIgnoreAtRulesByTailwindVersion(packages.tailwind) }]);
|
|
63
|
+
const atRuleNoUnknownCSS = (packages) => defineRules({ "at-rule-no-unknown": atRuleNoUnknownRule(packages) });
|
|
64
|
+
const atRuleNoUnknownSCSS = (packages) => defineRules({
|
|
65
|
+
"at-rule-no-unknown": null,
|
|
66
|
+
"scss/at-rule-no-unknown": atRuleNoUnknownRule(packages)
|
|
67
|
+
});
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/rules/declaration-block-no-redundant-longhand-properties.ts
|
|
70
|
+
const declarationBlockNoRedundantLonghandPropertiesRule = defineRule([true, { ignoreShorthands: ["grid-template"] }]);
|
|
71
|
+
const declarationBlockNoRedundantLonghandProperties = defineRules({ "declaration-block-no-redundant-longhand-properties": declarationBlockNoRedundantLonghandPropertiesRule });
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/rules/function-no-unknown.ts
|
|
74
|
+
const getIgnoreFunctionsByTailwindVersion = (tailwindVersion) => {
|
|
75
|
+
switch (tailwindVersion) {
|
|
76
|
+
case 0: return ["config"];
|
|
77
|
+
case 1: return ["theme"];
|
|
78
|
+
case 2: return ["screen", "theme"];
|
|
79
|
+
case 3: return ["theme", "screen"];
|
|
80
|
+
case 4: return [
|
|
81
|
+
"--alpha",
|
|
82
|
+
"--spacing",
|
|
83
|
+
"theme"
|
|
84
|
+
];
|
|
85
|
+
default: return [];
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const sassFunctionRegex = /^(list|math|color)\..+/;
|
|
89
|
+
const getIgnoreFunctions = (packages) => [
|
|
90
|
+
...getIgnoreFunctionsByTailwindVersion(packages.tailwind),
|
|
91
|
+
...packages.sass ? [sassFunctionRegex] : [],
|
|
92
|
+
...packages.vue ? ["v-bind"] : []
|
|
93
|
+
];
|
|
94
|
+
function functionNoUnknownRule(packages) {
|
|
95
|
+
return defineRule([true, { ignoreFunctions: getIgnoreFunctions(packages) }]);
|
|
96
|
+
}
|
|
97
|
+
const functionNoUnknown = (packages) => defineRules({ "function-no-unknown": functionNoUnknownRule(packages) });
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/rules/import-notation.ts
|
|
100
|
+
const importNotationCSS = (packages) => defineRules(isInRange(packages.tailwind, 4) ? { "import-notation": null } : {});
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/rules/order.ts
|
|
103
|
+
const definePrimaryOption = (...options) => options.filter((option) => !!option);
|
|
104
|
+
const blockRuleRegex = /^&::[\w-]+/;
|
|
105
|
+
const orderRule = (packages) => defineRule([definePrimaryOption(
|
|
106
|
+
//! import
|
|
107
|
+
packages.sass && {
|
|
108
|
+
type: "at-rule",
|
|
109
|
+
name: "use"
|
|
110
|
+
},
|
|
111
|
+
packages.sass && {
|
|
112
|
+
type: "at-rule",
|
|
113
|
+
name: "forward"
|
|
114
|
+
},
|
|
115
|
+
packages.sass && {
|
|
116
|
+
type: "at-rule",
|
|
117
|
+
name: "import"
|
|
118
|
+
},
|
|
119
|
+
isInRange(packages.tailwind, 4) && {
|
|
120
|
+
type: "at-rule",
|
|
121
|
+
name: "import"
|
|
122
|
+
},
|
|
123
|
+
isInRange(packages.tailwind, 4) && {
|
|
124
|
+
type: "at-rule",
|
|
125
|
+
name: "source"
|
|
126
|
+
},
|
|
127
|
+
isInRange(packages.tailwind, 4) && {
|
|
128
|
+
type: "at-rule",
|
|
129
|
+
name: "reference"
|
|
130
|
+
},
|
|
131
|
+
//! root
|
|
132
|
+
isInRange(packages.tailwind, 0, 1, 2, 3) && {
|
|
133
|
+
type: "at-rule",
|
|
134
|
+
name: "tailwind"
|
|
135
|
+
},
|
|
136
|
+
isInRange(packages.tailwind, 3, 4) && {
|
|
137
|
+
type: "at-rule",
|
|
138
|
+
name: "config"
|
|
139
|
+
},
|
|
140
|
+
isInRange(packages.tailwind, 4) && {
|
|
141
|
+
type: "at-rule",
|
|
142
|
+
name: "plugin"
|
|
143
|
+
},
|
|
144
|
+
isInRange(packages.tailwind, 1, 2, 3) && {
|
|
145
|
+
type: "at-rule",
|
|
146
|
+
name: "layer"
|
|
147
|
+
},
|
|
148
|
+
//! variables
|
|
149
|
+
"dollar-variables",
|
|
150
|
+
"at-variables",
|
|
151
|
+
{
|
|
152
|
+
type: "at-rule",
|
|
153
|
+
hasBlock: false
|
|
154
|
+
},
|
|
155
|
+
"custom-properties",
|
|
156
|
+
//! tailwind
|
|
157
|
+
isInRange(packages.tailwind, 4) && {
|
|
158
|
+
type: "at-rule",
|
|
159
|
+
name: "theme"
|
|
160
|
+
},
|
|
161
|
+
isInRange(packages.tailwind, 4) && {
|
|
162
|
+
type: "at-rule",
|
|
163
|
+
name: "custom-variant"
|
|
164
|
+
},
|
|
165
|
+
//! functions, methods
|
|
166
|
+
packages.sass && {
|
|
167
|
+
type: "at-rule",
|
|
168
|
+
name: "function"
|
|
169
|
+
},
|
|
170
|
+
packages.sass && {
|
|
171
|
+
type: "at-rule",
|
|
172
|
+
name: "mixin"
|
|
173
|
+
},
|
|
174
|
+
isInRange(packages.tailwind, 4) && {
|
|
175
|
+
type: "at-rule",
|
|
176
|
+
name: "utility"
|
|
177
|
+
},
|
|
178
|
+
//! declarations
|
|
179
|
+
packages.sass && {
|
|
180
|
+
type: "at-rule",
|
|
181
|
+
name: "extend"
|
|
182
|
+
},
|
|
183
|
+
packages.sass && {
|
|
184
|
+
type: "at-rule",
|
|
185
|
+
name: "include"
|
|
186
|
+
},
|
|
187
|
+
isInRange(packages.tailwind, 0, 1, 2, 3, 4) && {
|
|
188
|
+
type: "at-rule",
|
|
189
|
+
name: "apply"
|
|
190
|
+
},
|
|
191
|
+
"less-mixins",
|
|
192
|
+
"declarations",
|
|
193
|
+
//! block rules
|
|
194
|
+
{
|
|
195
|
+
type: "rule",
|
|
196
|
+
selector: blockRuleRegex
|
|
197
|
+
},
|
|
198
|
+
"rules",
|
|
199
|
+
//! blocks nested
|
|
200
|
+
packages.sass && {
|
|
201
|
+
type: "at-rule",
|
|
202
|
+
name: "at-root"
|
|
203
|
+
},
|
|
204
|
+
isInRange(packages.tailwind, 0, 1, 2) && {
|
|
205
|
+
type: "at-rule",
|
|
206
|
+
name: "responsive"
|
|
207
|
+
},
|
|
208
|
+
isInRange(packages.tailwind, 0, 1, 2) && {
|
|
209
|
+
type: "at-rule",
|
|
210
|
+
name: "variants"
|
|
211
|
+
},
|
|
212
|
+
isInRange(packages.tailwind, 0, 1, 2) && {
|
|
213
|
+
type: "at-rule",
|
|
214
|
+
name: "screen"
|
|
215
|
+
},
|
|
216
|
+
isInRange(packages.tailwind, 4) && {
|
|
217
|
+
type: "at-rule",
|
|
218
|
+
name: "variants"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
type: "at-rule",
|
|
222
|
+
hasBlock: true
|
|
223
|
+
}
|
|
224
|
+
), { unspecified: "bottom" }]);
|
|
225
|
+
const order = (packages) => defineRules({ "order/order": orderRule(packages) });
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/rules/selector-pseudo-class-no-unknown.ts
|
|
228
|
+
const selectorPseudoClassNoUnknownRule = defineRule([true, { ignorePseudoClasses: ["global", "local"] }]);
|
|
229
|
+
const selectorPseudoClassNoUnknown = defineRules({ "selector-pseudo-class-no-unknown": selectorPseudoClassNoUnknownRule });
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/configs/css.ts
|
|
232
|
+
const configCss = (packages) => ({
|
|
233
|
+
extends: ["stylelint-config-standard", "stylelint-config-clean-order"],
|
|
234
|
+
plugins: ["stylelint-order", "stylelint-selector-bem-pattern"],
|
|
235
|
+
rules: {
|
|
236
|
+
...atRuleNoUnknownCSS(packages),
|
|
237
|
+
...declarationBlockNoRedundantLonghandProperties,
|
|
238
|
+
...functionNoUnknown(packages),
|
|
239
|
+
...importNotationCSS(packages),
|
|
240
|
+
...order(packages),
|
|
241
|
+
...selectorPseudoClassNoUnknown,
|
|
242
|
+
"declaration-empty-line-before": null
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/rules/dollar-variable-pattern.ts
|
|
247
|
+
const dollarVariablePatternRule = defineRule(["^(-{0,2}?[a-z][a-z0-9]*)(-[a-z0-9]+)*$", { message: "Expected variable to be kebab-case" }]);
|
|
248
|
+
const dollarVariablePatternSCSS = defineRules({ "scss/dollar-variable-pattern": dollarVariablePatternRule });
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/configs/scss.ts
|
|
251
|
+
const configScss = (packages) => ({
|
|
252
|
+
extends: ["stylelint-config-standard-scss"],
|
|
253
|
+
rules: {
|
|
254
|
+
...atRuleNoUnknownSCSS(packages),
|
|
255
|
+
...dollarVariablePatternSCSS
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/configs/shared.ts
|
|
260
|
+
const configShared = () => ({ extends: ["stylelint-config-html"] });
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/configs/vue.ts
|
|
263
|
+
const configVue = (packages) => ({ extends: [packages.sass ? "stylelint-config-standard-vue/scss" : "stylelint-config-standard-vue"] });
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/factory.ts
|
|
266
|
+
function defineConfig(packages, config) {
|
|
267
|
+
const packages_ = packages ?? {};
|
|
268
|
+
return mergeConfigs(configShared(), configCss(packages_), packages_.sass && configScss(packages_), packages_.vue && configVue(packages_), config);
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
Object.defineProperty(exports, "defineConfig", {
|
|
272
|
+
enumerable: true,
|
|
273
|
+
get: function() {
|
|
274
|
+
return defineConfig;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
//# sourceMappingURL=factory-BTQtj5HJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-BTQtj5HJ.cjs","names":[],"sources":["../src/utils/utils.ts","../src/rules/at-rule-no-unknown.ts","../src/rules/declaration-block-no-redundant-longhand-properties.ts","../src/rules/function-no-unknown.ts","../src/rules/import-notation.ts","../src/rules/order.ts","../src/rules/selector-pseudo-class-no-unknown.ts","../src/configs/css.ts","../src/rules/dollar-variable-pattern.ts","../src/configs/scss.ts","../src/configs/shared.ts","../src/configs/vue.ts","../src/factory.ts"],"sourcesContent":["import type { Config, ConfigRuleSettings } from 'stylelint';\n\n// import type Primary, Secondary from stylelint\n\ntype StringOrRegex = string | RegExp;\ntype OneOrMany<S> = S | S[];\n\nexport type Primary =\n | number\n | true\n | OneOrMany<StringOrRegex>\n | Record<string, any>;\nexport type Secondary = Record<string, any>;\n\nexport const defineRule = <\n PrimaryOption extends Primary,\n SecondaryOptions extends Secondary = object,\n>(\n rule: ConfigRuleSettings<PrimaryOption, SecondaryOptions>,\n) => rule;\n\nexport const defineRules = <TRules extends Config['rules']>(rule: TRules) =>\n rule;\n\n// clone function mergeConfigs from stylelint repository\nexport const mergeConfigs = (\n ...configsOrNull: (Config | undefined | null | false)[]\n) => {\n const configs = configsOrNull.filter((c): c is Config => !!c);\n\n return {\n plugins: [...new Set(configs.flatMap(c => c.plugins ?? []))],\n overrides: [...new Set(configs.flatMap(c => c.overrides ?? []))],\n extends: configs\n .flatMap(c => c.extends ?? [])\n .filter((item, index, arr) => arr.lastIndexOf(item) === index),\n rules: configs.reduce(\n (acc, config) => ({ ...acc, ...config.rules }),\n {} as Config['rules'],\n ),\n ...configs.reduce(\n (\n acc,\n { plugins: _p, overrides: _o, extends: _e, rules: _r, ...config },\n ) => ({ ...acc, ...config }),\n {} as Config,\n ),\n };\n};\n\nexport const isInRange = (\n version: false | number | undefined,\n ...versions: number[]\n) => typeof version === 'number' && versions.includes(version);\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreAtRulesByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return [\n // Directives\n 'tailwind',\n 'apply',\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 1:\n case 2:\n return [\n // Directives\n 'tailwind',\n 'apply',\n 'layer', // new\n\n 'variants',\n 'responsive',\n 'screen',\n ];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return [\n // Directives\n 'tailwind',\n 'layer',\n 'apply',\n 'config', // new\n ];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return [\n // Directives\n 'import',\n 'theme',\n 'source',\n 'utility',\n 'variant',\n 'custom-variant',\n 'apply',\n 'reference',\n\n // Compatibility\n 'config',\n 'plugin',\n ];\n\n default:\n return [];\n }\n};\n\nexport const atRuleNoUnknownRule = (packages: Partial<Packages>) =>\n defineRule<true, { ignoreAtRules: (string | RegExp)[] }>([\n true,\n { ignoreAtRules: getIgnoreAtRulesByTailwindVersion(packages.tailwind) },\n ]);\n\nexport const atRuleNoUnknownCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n\nexport const atRuleNoUnknownSCSS = (packages: Partial<Packages>) =>\n defineRules({\n 'at-rule-no-unknown': null,\n 'scss/at-rule-no-unknown': atRuleNoUnknownRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const declarationBlockNoRedundantLonghandPropertiesRule = defineRule<\n true,\n { ignoreShorthands?: (string | RegExp)[] }\n>([true, { ignoreShorthands: ['grid-template'] }]);\n\nexport const declarationBlockNoRedundantLonghandProperties = defineRules({\n 'declaration-block-no-redundant-longhand-properties':\n declarationBlockNoRedundantLonghandPropertiesRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules } from '~/utils';\n\nconst getIgnoreFunctionsByTailwindVersion = (\n tailwindVersion: false | number | undefined,\n) => {\n switch (tailwindVersion) {\n // https://tailwindcss-v0.netlify.app//docs/functions-and-directives\n case 0:\n return ['config'];\n\n // https://v1.tailwindcss.com/docs/functions-and-directives\n case 1:\n return ['theme'];\n\n // https://v2.tailwindcss.com/docs/functions-and-directives\n case 2:\n return ['screen', 'theme'];\n\n // https://v3.tailwindcss.com/docs/functions-and-directives\n case 3:\n return ['theme', 'screen'];\n\n // https://tailwindcss.com/docs/functions-and-directives\n case 4:\n return ['--alpha', '--spacing', 'theme'];\n\n default:\n return [];\n }\n};\n\nconst sassFunctionRegex = /^(list|math|color)\\..+/;\nconst getIgnoreFunctions = (packages: Partial<Packages>) => [\n // https://tailwindcss.com\n ...getIgnoreFunctionsByTailwindVersion(packages.tailwind),\n\n // https://sass-lang.com/documentation/modules/list\n // https://sass-lang.com/documentation/modules/math\n // https://sass-lang.com/documentation/modules/color\n ...(packages.sass //\n ? [sassFunctionRegex]\n : []),\n\n // https://vuejs.org/api/sfc-css-features.html#v-bind-in-css\n ...(packages.vue //\n ? ['v-bind']\n : []),\n];\n\nexport function functionNoUnknownRule(packages: Partial<Packages>) {\n return defineRule<true, { ignoreFunctions: (string | RegExp)[] }>([\n true,\n { ignoreFunctions: getIgnoreFunctions(packages) },\n ]);\n}\n\nexport const functionNoUnknown = (packages: Partial<Packages>) =>\n defineRules({\n 'function-no-unknown': functionNoUnknownRule(packages),\n });\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRules, isInRange } from '~/utils';\n\nexport const importNotationCSS = (packages: Partial<Packages>) =>\n defineRules(\n isInRange(packages.tailwind, 4) //\n ? { 'import-notation': null }\n : {},\n );\n","import type { Packages } from '@culur/utils-packages';\nimport { defineRule, defineRules, isInRange } from '~/utils';\n\n// https://github.com/hudochenkov/stylelint-order/blob/master/rules/order/README.md#options\n\ntype Keyword =\n | 'custom-properties' /**/ // Custom properties (e.g. --property: 10px;)\n | 'dollar-variables' /***/ // Dollar variables (e.g. $variable)\n | 'at-variables' /*******/ // At-variables (e.g. @variable available in Less syntax)\n | 'declarations' /*******/ // CSS declarations (e.g. display: block)\n | 'rules' /**************/ // Nested rules (e.g. a { span {} })\n | 'at-rules' /***********/ // Nested at-rules (e.g. div { @media () {} })\n | 'less-mixins'; /*******/ // Mixins in Less syntax (e.g. .mixin();)\n\ninterface AtRule {\n type: 'at-rule';\n name?: string;\n parameter?: string | RegExp;\n hasBlock?: boolean;\n}\n\ninterface Rule {\n type: 'rule';\n selector?: string | RegExp;\n name?: string;\n}\n\ntype PrimaryOption = Array<Keyword | AtRule | Rule>;\ninterface SecondaryOptions {\n unspecified?: 'top' | 'bottom' | 'ignore';\n}\n\nconst definePrimaryOption = (...options: (PrimaryOption[number] | false | undefined)[]) =>\n options.filter((option): option is PrimaryOption[number] => !!option);\n\nconst blockRuleRegex = /^&::[\\w-]+/;\n\nexport const orderRule = (packages: Partial<Packages>) =>\n defineRule<PrimaryOption, SecondaryOptions>([\n definePrimaryOption(\n //! import\n packages.sass /**********************************/ && { type: 'at-rule', name: 'use' }, // scss: @use 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'forward' }, // scss: @forward 'path/path';\n packages.sass /**********************************/ && { type: 'at-rule', name: 'import' }, // scss: @import 'path/path';\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'import' }, // tailwind 4: @import \"tailwindcss\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'source' }, // tailwind 4: @source \"../node_modules/@culur/ui-lib\";\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'reference' }, // tailwind 4: @reference \"../../app.css\";\n\n //! root\n isInRange(packages.tailwind, 0, 1, 2, 3) /*******/ && { type: 'at-rule', name: 'tailwind' }, // tailwind 0,1,2,3 : @tailwind base;\n isInRange(packages.tailwind, 3, 4) /*************/ && { type: 'at-rule', name: 'config' }, // tailwind 3,4: @config 'tailwind.custom.config.js'\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'plugin' }, // tailwind 4: @plugin '@tailwindcss/typography'\n isInRange(packages.tailwind, 1, 2, 3) /**********/ && { type: 'at-rule', name: 'layer' }, // tailwind 1,2,3 : @layer base {}\n\n //! variables\n 'dollar-variables', // css: $variable: 10px;\n 'at-variables', // css: @variable: 10px;\n { type: 'at-rule', hasBlock: false }, // css: @variable: 10px;\n 'custom-properties', // css: --property: 10px;\n\n //! tailwind\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'theme' }, // tailwind 4: @theme {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'custom-variant' }, // tailwind 4: @custom-variant pointer-coarse (@media (pointer: coarse));\n\n //! functions, methods\n packages.sass /**********************************/ && { type: 'at-rule', name: 'function' }, // scss: @function sum() {}\n packages.sass /**********************************/ && { type: 'at-rule', name: 'mixin' }, // scss: @mixin mixin-name {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'utility' }, // tailwind 4: @utility tab-4 { tab-size: 4; }\n\n //! declarations\n packages.sass /**********************************/ && { type: 'at-rule', name: 'extend' }, // scss: @extend .class-name;\n packages.sass /**********************************/ && { type: 'at-rule', name: 'include' }, // scss: @include mixin-name;\n isInRange(packages.tailwind, 0, 1, 2, 3, 4) /****/ && { type: 'at-rule', name: 'apply' }, // tailwind 0,1,2,3,4: @apply p-3;\n 'less-mixins', // less: .mixin();\n 'declarations', // css: display: block;\n\n //! block rules\n { type: 'rule', selector: blockRuleRegex }, // css: &::after {}\n 'rules', // css: child-component {}\n\n //! blocks nested\n packages.sass && { type: 'at-rule', name: 'at-root' }, // scss: @at-root selector { /* content */ }\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'responsive' }, // tailwind 0,1,2 : @responsive {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'variants' }, // tailwind 0,1,2 : @variants hover {}\n isInRange(packages.tailwind, 0, 1, 2) /**********/ && { type: 'at-rule', name: 'screen' }, // tailwind 0,1,2 : @screen sm {}\n isInRange(packages.tailwind, 4) /****************/ && { type: 'at-rule', name: 'variants' }, // tailwind 4: @variant dark {}\n { type: 'at-rule', hasBlock: true }, // css: @media () {}\n ),\n {\n unspecified: 'bottom',\n },\n ]);\n\nexport const order = (packages: Partial<Packages>) =>\n defineRules({\n 'order/order': orderRule(packages),\n });\n","import { defineRule, defineRules } from '~/utils';\n\nexport const selectorPseudoClassNoUnknownRule = defineRule<\n true,\n { ignorePseudoClasses?: (string | RegExp)[] }\n>([true, { ignorePseudoClasses: ['global', 'local'] }]);\n\nexport const selectorPseudoClassNoUnknown = defineRules({\n 'selector-pseudo-class-no-unknown': selectorPseudoClassNoUnknownRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownCSS } from '~/rules/at-rule-no-unknown';\nimport { declarationBlockNoRedundantLonghandProperties } from '~/rules/declaration-block-no-redundant-longhand-properties';\nimport { functionNoUnknown } from '~/rules/function-no-unknown';\nimport { importNotationCSS } from '~/rules/import-notation';\nimport { order } from '~/rules/order';\nimport { selectorPseudoClassNoUnknown } from '~/rules/selector-pseudo-class-no-unknown';\n\nexport const configCss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard', 'stylelint-config-clean-order'],\n plugins: ['stylelint-order', 'stylelint-selector-bem-pattern'],\n rules: {\n ...atRuleNoUnknownCSS(packages),\n ...declarationBlockNoRedundantLonghandProperties,\n ...functionNoUnknown(packages),\n ...importNotationCSS(packages),\n ...order(packages),\n ...selectorPseudoClassNoUnknown,\n 'declaration-empty-line-before': null,\n },\n});\n","import { defineRule, defineRules } from '~/utils';\n\ntype PrimaryOption = string;\ninterface SecondaryOptions {\n message: string;\n}\n\nexport const dollarVariablePatternRule = defineRule<\n PrimaryOption,\n SecondaryOptions\n>([\n '^(-{0,2}?[a-z][a-z0-9]*)(-[a-z0-9]+)*$',\n { message: 'Expected variable to be kebab-case' },\n]);\n\nexport const dollarVariablePatternSCSS = defineRules({\n 'scss/dollar-variable-pattern': dollarVariablePatternRule,\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { atRuleNoUnknownSCSS } from '~/rules/at-rule-no-unknown';\nimport { dollarVariablePatternSCSS } from '~/rules/dollar-variable-pattern';\n\nexport const configScss = (packages: Partial<Packages>): Config => ({\n extends: ['stylelint-config-standard-scss'],\n rules: {\n ...atRuleNoUnknownSCSS(packages),\n ...dollarVariablePatternSCSS,\n },\n});\n","import type { Config } from 'stylelint';\n\nexport const configShared = (): Config => ({\n extends: ['stylelint-config-html'],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\n\nexport const configVue = (packages: Partial<Packages>): Config => ({\n extends: [\n packages.sass\n ? 'stylelint-config-standard-vue/scss'\n : 'stylelint-config-standard-vue',\n ],\n});\n","import type { Packages } from '@culur/utils-packages';\nimport type { Config } from 'stylelint';\nimport { configCss } from './configs/css';\nimport { configScss } from './configs/scss';\nimport { configShared } from './configs/shared';\nimport { configVue } from './configs/vue';\nimport { mergeConfigs } from './utils';\n\nexport default function defineConfig(\n packages?: Partial<Packages>,\n config?: Config,\n): Config {\n const packages_ = packages ?? {};\n\n return mergeConfigs(\n configShared(),\n configCss(packages_),\n packages_.sass && configScss(packages_),\n packages_.vue && configVue(packages_),\n config,\n );\n}\n"],"mappings":";AAcA,MAAa,cAIX,SACG;AAEL,MAAa,eAA+C,SAC1D;AAGF,MAAa,gBACX,GAAG,kBACA;CACH,MAAM,UAAU,cAAc,QAAQ,MAAmB,CAAC,CAAC,EAAE;AAE7D,QAAO;EACL,SAAS,CAAC,GAAG,IAAI,IAAI,QAAQ,SAAQ,MAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;EAC5D,WAAW,CAAC,GAAG,IAAI,IAAI,QAAQ,SAAQ,MAAK,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC;EAChE,SAAS,QACN,SAAQ,MAAK,EAAE,WAAW,EAAE,CAAC,CAC7B,QAAQ,MAAM,OAAO,QAAQ,IAAI,YAAY,KAAK,KAAK,MAAM;EAChE,OAAO,QAAQ,QACZ,KAAK,YAAY;GAAE,GAAG;GAA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,CAAC,UAAU,QAAQ,EAAE,CAAC,CAAC;AAEvD,MAAa,+BAA+B,YAAY,EACtD,oCAAoC,kCACrC,CAAC;;;ACAF,MAAa,aAAa,cAAyC;CACjE,SAAS,CAAC,6BAA6B,+BAA+B;CACtE,SAAS,CAAC,mBAAmB,iCAAiC;CAC9D,OAAO;EACL,GAAG,mBAAmB,SAAS;EAC/B,GAAG;EACH,GAAG,kBAAkB,SAAS;EAC9B,GAAG,kBAAkB,SAAS;EAC9B,GAAG,MAAM,SAAS;EAClB,GAAG;EACH,iCAAiC;EAClC;CACF;;;ACdD,MAAa,4BAA4B,WAGvC,CACA,0CACA,EAAE,SAAS,sCAAsC,CAClD,CAAC;AAEF,MAAa,4BAA4B,YAAY,EACnD,gCAAgC,2BACjC,CAAC;;;ACZF,MAAa,cAAc,cAAyC;CAClE,SAAS,CAAC,iCAAiC;CAC3C,OAAO;EACL,GAAG,oBAAoB,SAAS;EAChC,GAAG;EACJ;CACF;;;ACTD,MAAa,sBAA8B,EACzC,SAAS,CAAC,wBAAwB,EACnC;;;ACDD,MAAa,aAAa,cAAyC,EACjE,SAAS,CACP,SAAS,OACL,uCACA,gCACL,EACF;;;ACDD,SAAwB,aACtB,UACA,QACQ;CACR,MAAM,YAAY,YAAY,EAAE;AAEhC,QAAO,aACL,cAAc,EACd,UAAU,UAAU,EACpB,UAAU,QAAQ,WAAW,UAAU,EACvC,UAAU,OAAO,UAAU,UAAU,EACrC,OACD"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
//#region src/utils/utils.ts
|
|
2
|
+
const defineRule = (rule) => rule;
|
|
3
|
+
const defineRules = (rule) => rule;
|
|
4
|
+
const mergeConfigs = (...configsOrNull) => {
|
|
5
|
+
const configs = configsOrNull.filter((c) => !!c);
|
|
6
|
+
return {
|
|
7
|
+
plugins: [...new Set(configs.flatMap((c) => c.plugins ?? []))],
|
|
8
|
+
overrides: [...new Set(configs.flatMap((c) => c.overrides ?? []))],
|
|
9
|
+
extends: configs.flatMap((c) => c.extends ?? []).filter((item, index, arr) => arr.lastIndexOf(item) === index),
|
|
10
|
+
rules: configs.reduce((acc, config) => ({
|
|
11
|
+
...acc,
|
|
12
|
+
...config.rules
|
|
13
|
+
}), {}),
|
|
14
|
+
...configs.reduce((acc, { plugins: _p, overrides: _o, extends: _e, rules: _r, ...config }) => ({
|
|
15
|
+
...acc,
|
|
16
|
+
...config
|
|
17
|
+
}), {})
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const isInRange = (version, ...versions) => typeof version === "number" && versions.includes(version);
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/rules/at-rule-no-unknown.ts
|
|
23
|
+
const getIgnoreAtRulesByTailwindVersion = (tailwindVersion) => {
|
|
24
|
+
switch (tailwindVersion) {
|
|
25
|
+
case 0: return [
|
|
26
|
+
"tailwind",
|
|
27
|
+
"apply",
|
|
28
|
+
"variants",
|
|
29
|
+
"responsive",
|
|
30
|
+
"screen"
|
|
31
|
+
];
|
|
32
|
+
case 1:
|
|
33
|
+
case 2: return [
|
|
34
|
+
"tailwind",
|
|
35
|
+
"apply",
|
|
36
|
+
"layer",
|
|
37
|
+
"variants",
|
|
38
|
+
"responsive",
|
|
39
|
+
"screen"
|
|
40
|
+
];
|
|
41
|
+
case 3: return [
|
|
42
|
+
"tailwind",
|
|
43
|
+
"layer",
|
|
44
|
+
"apply",
|
|
45
|
+
"config"
|
|
46
|
+
];
|
|
47
|
+
case 4: return [
|
|
48
|
+
"import",
|
|
49
|
+
"theme",
|
|
50
|
+
"source",
|
|
51
|
+
"utility",
|
|
52
|
+
"variant",
|
|
53
|
+
"custom-variant",
|
|
54
|
+
"apply",
|
|
55
|
+
"reference",
|
|
56
|
+
"config",
|
|
57
|
+
"plugin"
|
|
58
|
+
];
|
|
59
|
+
default: return [];
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const atRuleNoUnknownRule = (packages) => defineRule([true, { ignoreAtRules: getIgnoreAtRulesByTailwindVersion(packages.tailwind) }]);
|
|
63
|
+
const atRuleNoUnknownCSS = (packages) => defineRules({ "at-rule-no-unknown": atRuleNoUnknownRule(packages) });
|
|
64
|
+
const atRuleNoUnknownSCSS = (packages) => defineRules({
|
|
65
|
+
"at-rule-no-unknown": null,
|
|
66
|
+
"scss/at-rule-no-unknown": atRuleNoUnknownRule(packages)
|
|
67
|
+
});
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/rules/declaration-block-no-redundant-longhand-properties.ts
|
|
70
|
+
const declarationBlockNoRedundantLonghandPropertiesRule = defineRule([true, { ignoreShorthands: ["grid-template"] }]);
|
|
71
|
+
const declarationBlockNoRedundantLonghandProperties = defineRules({ "declaration-block-no-redundant-longhand-properties": declarationBlockNoRedundantLonghandPropertiesRule });
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/rules/function-no-unknown.ts
|
|
74
|
+
const getIgnoreFunctionsByTailwindVersion = (tailwindVersion) => {
|
|
75
|
+
switch (tailwindVersion) {
|
|
76
|
+
case 0: return ["config"];
|
|
77
|
+
case 1: return ["theme"];
|
|
78
|
+
case 2: return ["screen", "theme"];
|
|
79
|
+
case 3: return ["theme", "screen"];
|
|
80
|
+
case 4: return [
|
|
81
|
+
"--alpha",
|
|
82
|
+
"--spacing",
|
|
83
|
+
"theme"
|
|
84
|
+
];
|
|
85
|
+
default: return [];
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const sassFunctionRegex = /^(list|math|color)\..+/;
|
|
89
|
+
const getIgnoreFunctions = (packages) => [
|
|
90
|
+
...getIgnoreFunctionsByTailwindVersion(packages.tailwind),
|
|
91
|
+
...packages.sass ? [sassFunctionRegex] : [],
|
|
92
|
+
...packages.vue ? ["v-bind"] : []
|
|
93
|
+
];
|
|
94
|
+
function functionNoUnknownRule(packages) {
|
|
95
|
+
return defineRule([true, { ignoreFunctions: getIgnoreFunctions(packages) }]);
|
|
96
|
+
}
|
|
97
|
+
const functionNoUnknown = (packages) => defineRules({ "function-no-unknown": functionNoUnknownRule(packages) });
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/rules/import-notation.ts
|
|
100
|
+
const importNotationCSS = (packages) => defineRules(isInRange(packages.tailwind, 4) ? { "import-notation": null } : {});
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/rules/order.ts
|
|
103
|
+
const definePrimaryOption = (...options) => options.filter((option) => !!option);
|
|
104
|
+
const blockRuleRegex = /^&::[\w-]+/;
|
|
105
|
+
const orderRule = (packages) => defineRule([definePrimaryOption(
|
|
106
|
+
//! import
|
|
107
|
+
packages.sass && {
|
|
108
|
+
type: "at-rule",
|
|
109
|
+
name: "use"
|
|
110
|
+
},
|
|
111
|
+
packages.sass && {
|
|
112
|
+
type: "at-rule",
|
|
113
|
+
name: "forward"
|
|
114
|
+
},
|
|
115
|
+
packages.sass && {
|
|
116
|
+
type: "at-rule",
|
|
117
|
+
name: "import"
|
|
118
|
+
},
|
|
119
|
+
isInRange(packages.tailwind, 4) && {
|
|
120
|
+
type: "at-rule",
|
|
121
|
+
name: "import"
|
|
122
|
+
},
|
|
123
|
+
isInRange(packages.tailwind, 4) && {
|
|
124
|
+
type: "at-rule",
|
|
125
|
+
name: "source"
|
|
126
|
+
},
|
|
127
|
+
isInRange(packages.tailwind, 4) && {
|
|
128
|
+
type: "at-rule",
|
|
129
|
+
name: "reference"
|
|
130
|
+
},
|
|
131
|
+
//! root
|
|
132
|
+
isInRange(packages.tailwind, 0, 1, 2, 3) && {
|
|
133
|
+
type: "at-rule",
|
|
134
|
+
name: "tailwind"
|
|
135
|
+
},
|
|
136
|
+
isInRange(packages.tailwind, 3, 4) && {
|
|
137
|
+
type: "at-rule",
|
|
138
|
+
name: "config"
|
|
139
|
+
},
|
|
140
|
+
isInRange(packages.tailwind, 4) && {
|
|
141
|
+
type: "at-rule",
|
|
142
|
+
name: "plugin"
|
|
143
|
+
},
|
|
144
|
+
isInRange(packages.tailwind, 1, 2, 3) && {
|
|
145
|
+
type: "at-rule",
|
|
146
|
+
name: "layer"
|
|
147
|
+
},
|
|
148
|
+
//! variables
|
|
149
|
+
"dollar-variables",
|
|
150
|
+
"at-variables",
|
|
151
|
+
{
|
|
152
|
+
type: "at-rule",
|
|
153
|
+
hasBlock: false
|
|
154
|
+
},
|
|
155
|
+
"custom-properties",
|
|
156
|
+
//! tailwind
|
|
157
|
+
isInRange(packages.tailwind, 4) && {
|
|
158
|
+
type: "at-rule",
|
|
159
|
+
name: "theme"
|
|
160
|
+
},
|
|
161
|
+
isInRange(packages.tailwind, 4) && {
|
|
162
|
+
type: "at-rule",
|
|
163
|
+
name: "custom-variant"
|
|
164
|
+
},
|
|
165
|
+
//! functions, methods
|
|
166
|
+
packages.sass && {
|
|
167
|
+
type: "at-rule",
|
|
168
|
+
name: "function"
|
|
169
|
+
},
|
|
170
|
+
packages.sass && {
|
|
171
|
+
type: "at-rule",
|
|
172
|
+
name: "mixin"
|
|
173
|
+
},
|
|
174
|
+
isInRange(packages.tailwind, 4) && {
|
|
175
|
+
type: "at-rule",
|
|
176
|
+
name: "utility"
|
|
177
|
+
},
|
|
178
|
+
//! declarations
|
|
179
|
+
packages.sass && {
|
|
180
|
+
type: "at-rule",
|
|
181
|
+
name: "extend"
|
|
182
|
+
},
|
|
183
|
+
packages.sass && {
|
|
184
|
+
type: "at-rule",
|
|
185
|
+
name: "include"
|
|
186
|
+
},
|
|
187
|
+
isInRange(packages.tailwind, 0, 1, 2, 3, 4) && {
|
|
188
|
+
type: "at-rule",
|
|
189
|
+
name: "apply"
|
|
190
|
+
},
|
|
191
|
+
"less-mixins",
|
|
192
|
+
"declarations",
|
|
193
|
+
//! block rules
|
|
194
|
+
{
|
|
195
|
+
type: "rule",
|
|
196
|
+
selector: blockRuleRegex
|
|
197
|
+
},
|
|
198
|
+
"rules",
|
|
199
|
+
//! blocks nested
|
|
200
|
+
packages.sass && {
|
|
201
|
+
type: "at-rule",
|
|
202
|
+
name: "at-root"
|
|
203
|
+
},
|
|
204
|
+
isInRange(packages.tailwind, 0, 1, 2) && {
|
|
205
|
+
type: "at-rule",
|
|
206
|
+
name: "responsive"
|
|
207
|
+
},
|
|
208
|
+
isInRange(packages.tailwind, 0, 1, 2) && {
|
|
209
|
+
type: "at-rule",
|
|
210
|
+
name: "variants"
|
|
211
|
+
},
|
|
212
|
+
isInRange(packages.tailwind, 0, 1, 2) && {
|
|
213
|
+
type: "at-rule",
|
|
214
|
+
name: "screen"
|
|
215
|
+
},
|
|
216
|
+
isInRange(packages.tailwind, 4) && {
|
|
217
|
+
type: "at-rule",
|
|
218
|
+
name: "variants"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
type: "at-rule",
|
|
222
|
+
hasBlock: true
|
|
223
|
+
}
|
|
224
|
+
), { unspecified: "bottom" }]);
|
|
225
|
+
const order = (packages) => defineRules({ "order/order": orderRule(packages) });
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/rules/selector-pseudo-class-no-unknown.ts
|
|
228
|
+
const selectorPseudoClassNoUnknownRule = defineRule([true, { ignorePseudoClasses: ["global", "local"] }]);
|
|
229
|
+
const selectorPseudoClassNoUnknown = defineRules({ "selector-pseudo-class-no-unknown": selectorPseudoClassNoUnknownRule });
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/configs/css.ts
|
|
232
|
+
const configCss = (packages) => ({
|
|
233
|
+
extends: ["stylelint-config-standard", "stylelint-config-clean-order"],
|
|
234
|
+
plugins: ["stylelint-order", "stylelint-selector-bem-pattern"],
|
|
235
|
+
rules: {
|
|
236
|
+
...atRuleNoUnknownCSS(packages),
|
|
237
|
+
...declarationBlockNoRedundantLonghandProperties,
|
|
238
|
+
...functionNoUnknown(packages),
|
|
239
|
+
...importNotationCSS(packages),
|
|
240
|
+
...order(packages),
|
|
241
|
+
...selectorPseudoClassNoUnknown,
|
|
242
|
+
"declaration-empty-line-before": null
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/rules/dollar-variable-pattern.ts
|
|
247
|
+
const dollarVariablePatternRule = defineRule(["^(-{0,2}?[a-z][a-z0-9]*)(-[a-z0-9]+)*$", { message: "Expected variable to be kebab-case" }]);
|
|
248
|
+
const dollarVariablePatternSCSS = defineRules({ "scss/dollar-variable-pattern": dollarVariablePatternRule });
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/configs/scss.ts
|
|
251
|
+
const configScss = (packages) => ({
|
|
252
|
+
extends: ["stylelint-config-standard-scss"],
|
|
253
|
+
rules: {
|
|
254
|
+
...atRuleNoUnknownSCSS(packages),
|
|
255
|
+
...dollarVariablePatternSCSS
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/configs/shared.ts
|
|
260
|
+
const configShared = () => ({ extends: ["stylelint-config-html"] });
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/configs/vue.ts
|
|
263
|
+
const configVue = (packages) => ({ extends: [packages.sass ? "stylelint-config-standard-vue/scss" : "stylelint-config-standard-vue"] });
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/factory.ts
|
|
266
|
+
function defineConfig(packages, config) {
|
|
267
|
+
const packages_ = packages ?? {};
|
|
268
|
+
return mergeConfigs(configShared(), configCss(packages_), packages_.sass && configScss(packages_), packages_.vue && configVue(packages_), config);
|
|
269
|
+
}
|
|
270
|
+
//#endregion
|
|
271
|
+
export { defineConfig as t };
|
|
272
|
+
|
|
273
|
+
//# sourceMappingURL=factory-wCIsmB0H.mjs.map
|