@brnshkr/config 0.0.1-beta.2 → 0.0.1-beta.4
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/README.md +177 -228
- package/conf/.gitignore.dist +15 -0
- package/conf/Makefile +3778 -0
- package/conf/Makefile.dist +13 -0
- package/conf/bunfig.dist.toml +5 -0
- package/conf/commitlint.dist.mjs +1 -0
- package/conf/editorconfig.dist +19 -0
- package/conf/launch.dist.json +31 -0
- package/conf/markdownlint.dist.mjs +1 -0
- package/conf/spelling/defaults.json +185 -0
- package/conf/tsconfig.dist.json +3 -0
- package/conf/tsconfig.json +31 -27
- package/conf/vitest.dist.mjs +1 -0
- package/conf/vscode-css-custom-data.dist.json +95 -0
- package/conf/vscode-extensions.dist.json +21 -0
- package/conf/vscode-settings.dist.jsonc +338 -0
- package/dist/commitlint/index.d.mts +72 -0
- package/dist/commitlint/index.mjs +239 -0
- package/dist/eslint/index.d.mts +3897 -1383
- package/dist/eslint/index.mjs +2784 -419
- package/dist/markdownlint/index.d.mts +2304 -0
- package/dist/markdownlint/index.mjs +440 -0
- package/dist/shared.mjs +405 -65
- package/dist/spelling/index.d.mts +30 -0
- package/dist/spelling/index.mjs +2 -0
- package/dist/spelling/spelling.test.d.mts +1 -0
- package/dist/spelling/spelling.test.mjs +12 -0
- package/dist/stylelint/index.d.mts +47 -9
- package/dist/stylelint/index.mjs +145 -47
- package/dist/vitest/index.d.mts +73 -0
- package/dist/vitest/index.mjs +181 -0
- package/package.json +192 -105
- package/conf/tsconfig.json.example +0 -3
- package/dist/scripts/eslint.mjs +0 -16
- package/dist/scripts/stylelint.mjs +0 -29
- /package/conf/{eslint.config.mjs.example → eslint.dist.mjs} +0 -0
- /package/conf/{stylelint.config.mjs.example → stylelint.dist.mjs} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Config } from "stylelint";
|
|
2
|
-
|
|
3
2
|
//#region ../src/js/stylelint/types/config.d.ts
|
|
4
|
-
type Config$1 = { [Key in keyof Config]: Config[Key] };
|
|
3
|
+
type Config$1 = { [Key in keyof Config]: Config[Key]; };
|
|
5
4
|
//#endregion
|
|
6
5
|
//#region ../src/js/stylelint/types/options.d.ts
|
|
7
6
|
interface ConfigOptions {
|
|
@@ -31,13 +30,13 @@ interface ConfigOptions {
|
|
|
31
30
|
*/
|
|
32
31
|
html: boolean;
|
|
33
32
|
/**
|
|
34
|
-
* Enables `stylelint-
|
|
33
|
+
* Enables `stylelint-config-standard-less`.
|
|
35
34
|
*
|
|
36
|
-
* @default `Enabled when "stylelint-
|
|
35
|
+
* @default `Enabled when "stylelint-config-standard-less" is installed.`
|
|
37
36
|
*
|
|
38
|
-
* @see https://github.com/
|
|
37
|
+
* @see https://github.com/stylelint-less/stylelint-less/tree/main/packages/stylelint-config-standard-less
|
|
39
38
|
*/
|
|
40
|
-
|
|
39
|
+
less: boolean;
|
|
41
40
|
/**
|
|
42
41
|
* Enables `stylelint-config-css-modules`.
|
|
43
42
|
*
|
|
@@ -88,10 +87,49 @@ interface ConfigOptions {
|
|
|
88
87
|
*/
|
|
89
88
|
style: boolean;
|
|
90
89
|
}
|
|
91
|
-
type UserOptions = Partial<ConfigOptions> & Omit<Config$1, 'ignorePatterns' | '_processorFunctions'>;
|
|
90
|
+
type UserOptions = Partial<ConfigOptions> & Omit<Config$1, 'computeEditInfo' | 'ignorePatterns' | '_processorFunctions'>;
|
|
92
91
|
//#endregion
|
|
93
92
|
//#region ../src/js/stylelint/index.d.ts
|
|
94
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Build the `@brnshkr` Stylelint config object.
|
|
95
|
+
*
|
|
96
|
+
* Merges sensible defaults for every supported module (SCSS, Less, HTML, etc.) with user
|
|
97
|
+
* overrides and any additional configs.
|
|
98
|
+
*
|
|
99
|
+
* @api
|
|
100
|
+
*
|
|
101
|
+
* @param optionsAndGlobalConfig per-module toggles and global Stylelint fields merged with the defaults
|
|
102
|
+
* @param additionalConfigs extra Stylelint config entries merged after the built-in ones
|
|
103
|
+
*
|
|
104
|
+
* @returns final Stylelint config ready to be consumed by Stylelint
|
|
105
|
+
*
|
|
106
|
+
* @see https://github.com/brnshkr/config/blob/master/docs/js/stylelint.md
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```js
|
|
110
|
+
* import { getConfig } from '@brnshkr/config/stylelint';
|
|
111
|
+
*
|
|
112
|
+
* getConfig(undefined);
|
|
113
|
+
* getConfig({});
|
|
114
|
+
*
|
|
115
|
+
* getConfig({
|
|
116
|
+
* scss: false,
|
|
117
|
+
* ignoreFiles: ['dist/**'],
|
|
118
|
+
* }, {
|
|
119
|
+
* rules: { 'color-no-hex': null },
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
122
|
+
* getConfig(undefined, {
|
|
123
|
+
* rules: { 'color-no-hex': null },
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare const getConfig: (optionsAndGlobalConfig?: UserOptions, ...additionalConfigs: Config$1[]) => Config$1;
|
|
128
|
+
/**
|
|
129
|
+
* Default-exported pre-built config for direct re-export from a Stylelint config file.
|
|
130
|
+
*
|
|
131
|
+
* @api
|
|
132
|
+
*/
|
|
95
133
|
declare const _default: Config$1;
|
|
96
134
|
//#endregion
|
|
97
|
-
export { _default as default
|
|
135
|
+
export { _default as default };
|
package/dist/stylelint/index.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as objectKeys, O as packageOrganization, b as STYLELINT_PACKAGES, f as createModuleState, g as resolvePackagesSharedSynchronously, m as isModuleEnabledByDefault, n as QUOTES, u as GLOB_IGNORES, w as objectEntries } from "../shared.mjs";
|
|
2
2
|
//#region ../src/js/stylelint/utils/module.ts
|
|
3
|
+
/**
|
|
4
|
+
* @internal @brnshkr/config/stylelint
|
|
5
|
+
*/
|
|
3
6
|
const MODULES = {
|
|
4
7
|
baseline: {
|
|
5
8
|
name: "baseline",
|
|
@@ -13,9 +16,9 @@ const MODULES = {
|
|
|
13
16
|
name: "html",
|
|
14
17
|
packages: { requiredAll: [STYLELINT_PACKAGES.POSTCSS_HTML, STYLELINT_PACKAGES.STYLELINT_CONFIG_HTML] }
|
|
15
18
|
},
|
|
16
|
-
|
|
17
|
-
name: "
|
|
18
|
-
packages: { requiredAll: [STYLELINT_PACKAGES.
|
|
19
|
+
less: {
|
|
20
|
+
name: "less",
|
|
21
|
+
packages: { requiredAll: [STYLELINT_PACKAGES.STYLELINT_CONFIG_STANDARD_LESS] }
|
|
19
22
|
},
|
|
20
23
|
modules: {
|
|
21
24
|
name: "modules",
|
|
@@ -45,14 +48,13 @@ const MODULES = {
|
|
|
45
48
|
packages: { requiredAll: [STYLELINT_PACKAGES.STYLISTIC_STYLELINT_CONFIG] }
|
|
46
49
|
}
|
|
47
50
|
};
|
|
48
|
-
const resolvePackages =
|
|
49
|
-
const
|
|
50
|
-
const isModuleEnabled = (moduleInfo) => enabledStates[moduleInfo.name] ?? isModuleEnabledByDefault(moduleInfo);
|
|
51
|
-
const setModuleEnabled = (moduleInfo, state) => {
|
|
52
|
-
enabledStates[moduleInfo.name] = state;
|
|
53
|
-
};
|
|
51
|
+
const resolvePackages = resolvePackagesSharedSynchronously;
|
|
52
|
+
const { isModuleEnabled, setModuleEnabled } = createModuleState();
|
|
54
53
|
//#endregion
|
|
55
54
|
//#region ../src/js/stylelint/configs/baseline.ts
|
|
55
|
+
/**
|
|
56
|
+
* @internal @brnshkr/config/stylelint
|
|
57
|
+
*/
|
|
56
58
|
const baseline = () => {
|
|
57
59
|
const { requiredAll: [isStylelintPluginUseBaselineInstalled] } = resolvePackages(MODULES.baseline);
|
|
58
60
|
if (!isStylelintPluginUseBaselineInstalled) return [];
|
|
@@ -69,6 +71,10 @@ const css = () => [{
|
|
|
69
71
|
reportInvalidScopeDisables: true,
|
|
70
72
|
reportNeedlessDisables: true,
|
|
71
73
|
reportUnscopedDisables: true,
|
|
74
|
+
languageOptions: { directionality: {
|
|
75
|
+
block: "top-to-bottom",
|
|
76
|
+
inline: "left-to-right"
|
|
77
|
+
} },
|
|
72
78
|
rules: {
|
|
73
79
|
"at-rule-disallowed-list": ["debug"],
|
|
74
80
|
"at-rule-property-required-list": { "font-face": [
|
|
@@ -106,20 +112,30 @@ const css = () => [{
|
|
|
106
112
|
"no-unknown-animations": true,
|
|
107
113
|
"no-unknown-custom-media": true,
|
|
108
114
|
"no-unknown-custom-properties": true,
|
|
115
|
+
"property-layout-mappings": "flow-relative",
|
|
116
|
+
"relative-selector-nesting-notation": "implicit",
|
|
109
117
|
"selector-class-pattern": ["^[a-z]([-]?[a-z0-9]+)*(__[a-z0-9]([-]?[a-z0-9]+)*)?(--[a-z0-9]([-]?[a-z0-9]+)*)?$", {
|
|
110
118
|
resolveNestedSelectors: true,
|
|
111
119
|
message: (value) => `Expected class selector "${value}" to match BEM methodology (https://getbem.com/). Selector validation tool: https://regexr.com/3apms`
|
|
112
120
|
}],
|
|
121
|
+
"selector-no-deprecated": true,
|
|
122
|
+
"selector-no-invalid": true,
|
|
123
|
+
"selector-no-unmatchable": true,
|
|
113
124
|
"string-no-newline": true,
|
|
125
|
+
"unit-layout-mappings": "flow-relative",
|
|
114
126
|
"unit-no-unknown": true,
|
|
115
127
|
"value-keyword-case": ["lower", {
|
|
116
128
|
camelCaseSvgKeywords: true,
|
|
117
129
|
ignoreKeywords: [/^geometricPrecision$/v]
|
|
118
|
-
}]
|
|
130
|
+
}],
|
|
131
|
+
"value-keyword-layout-mappings": "flow-relative"
|
|
119
132
|
}
|
|
120
133
|
}];
|
|
121
134
|
//#endregion
|
|
122
135
|
//#region ../src/js/stylelint/configs/defensive.ts
|
|
136
|
+
/**
|
|
137
|
+
* @internal @brnshkr/config/stylelint
|
|
138
|
+
*/
|
|
123
139
|
const defensive = () => {
|
|
124
140
|
const { requiredAll: [isStylelintPluginDefensiveCssInstalled] } = resolvePackages(MODULES.defensive);
|
|
125
141
|
if (!isStylelintPluginDefensiveCssInstalled) return [];
|
|
@@ -142,12 +158,19 @@ const defensive = () => {
|
|
|
142
158
|
};
|
|
143
159
|
//#endregion
|
|
144
160
|
//#region ../src/js/stylelint/types/overrides.ts
|
|
161
|
+
/**
|
|
162
|
+
* @internal @brnshkr/config/stylelint
|
|
163
|
+
*/
|
|
145
164
|
const OVERRIDES = {
|
|
165
|
+
LESS: "less",
|
|
146
166
|
SCSS: "scss",
|
|
147
167
|
SVELTE: "svelte"
|
|
148
168
|
};
|
|
149
169
|
//#endregion
|
|
150
170
|
//#region ../src/js/stylelint/utils/config.ts
|
|
171
|
+
/**
|
|
172
|
+
* @internal @brnshkr/config/stylelint
|
|
173
|
+
*/
|
|
151
174
|
const buildOverrideName = (override) => [packageOrganization, override].filter(Boolean).join("/");
|
|
152
175
|
const isValidGlobalAdditionalConfigKey = (key) => [
|
|
153
176
|
"extends",
|
|
@@ -170,21 +193,22 @@ const isValidGlobalAdditionalConfigKey = (key) => [
|
|
|
170
193
|
"allowEmptyInput",
|
|
171
194
|
"cache",
|
|
172
195
|
"fix",
|
|
173
|
-
"
|
|
174
|
-
"
|
|
196
|
+
"validate",
|
|
197
|
+
"maxWarnings",
|
|
198
|
+
"referenceFiles"
|
|
175
199
|
].includes(key);
|
|
176
200
|
const getGlobalAdditionalConfig = (options) => {
|
|
177
201
|
const config = {};
|
|
178
202
|
for (const [key, value] of objectEntries(options)) if (isValidGlobalAdditionalConfigKey(key)) config[key] = value;
|
|
179
|
-
if (
|
|
203
|
+
if (objectKeys(config).length === 0) return;
|
|
180
204
|
return config;
|
|
181
205
|
};
|
|
182
206
|
const getUserConfigs = (resolvedOptions, additionalConfigs) => [getGlobalAdditionalConfig(resolvedOptions), ...additionalConfigs].filter(Boolean);
|
|
183
207
|
const includeConfigs = (config, configsToInclude) => {
|
|
184
208
|
for (const configToInclude of configsToInclude) {
|
|
185
|
-
if (configToInclude.extends !== void 0) config.extends = [
|
|
186
|
-
if (configToInclude.plugins !== void 0) config.plugins = [
|
|
187
|
-
if (configToInclude.ignoreFiles !== void 0) config.ignoreFiles = [
|
|
209
|
+
if (configToInclude.extends !== void 0) config.extends = [.../* @__PURE__ */ new Set([...Array.isArray(config.extends) ? config.extends ?? [] : [config.extends].filter(Boolean), ...Array.isArray(configToInclude.extends) ? configToInclude.extends ?? [] : [configToInclude.extends].filter(Boolean)])];
|
|
210
|
+
if (configToInclude.plugins !== void 0) config.plugins = [.../* @__PURE__ */ new Set([...Array.isArray(config.plugins) ? config.plugins ?? [] : [config.plugins].filter(Boolean), ...Array.isArray(configToInclude.plugins) ? configToInclude.plugins ?? [] : [configToInclude.plugins].filter(Boolean)])];
|
|
211
|
+
if (configToInclude.ignoreFiles !== void 0) config.ignoreFiles = [.../* @__PURE__ */ new Set([...Array.isArray(config.ignoreFiles) ? config.ignoreFiles ?? [] : [config.ignoreFiles].filter(Boolean), ...Array.isArray(configToInclude.ignoreFiles) ? configToInclude.ignoreFiles ?? [] : [configToInclude.ignoreFiles].filter(Boolean)])];
|
|
188
212
|
if (configToInclude.rules !== void 0) config.rules = {
|
|
189
213
|
...config.rules,
|
|
190
214
|
...configToInclude.rules
|
|
@@ -199,11 +223,11 @@ const includeConfigs = (config, configsToInclude) => {
|
|
|
199
223
|
if (configToInclude.reportUnscopedDisables !== void 0) config.reportUnscopedDisables = configToInclude.reportUnscopedDisables;
|
|
200
224
|
if (configToInclude.configurationComment !== void 0) config.configurationComment = configToInclude.configurationComment;
|
|
201
225
|
if (configToInclude.overrides !== void 0) {
|
|
202
|
-
const
|
|
203
|
-
config.overrides = [...(config.overrides ?? []).filter((existingOverride) =>
|
|
226
|
+
const overridesToInclude = configToInclude.overrides;
|
|
227
|
+
config.overrides = [...(config.overrides ?? []).filter((existingOverride) => overridesToInclude.every((overrideToInclude) => overrideToInclude.name === void 0 || overrideToInclude.name !== existingOverride.name)), ...overridesToInclude];
|
|
204
228
|
}
|
|
205
229
|
if (configToInclude.customSyntax !== void 0) config.customSyntax = configToInclude.customSyntax;
|
|
206
|
-
if (configToInclude.processors !== void 0) config.processors = [
|
|
230
|
+
if (configToInclude.processors !== void 0) config.processors = [.../* @__PURE__ */ new Set([...config.processors ?? [], ...configToInclude.processors])];
|
|
207
231
|
if (configToInclude.languageOptions !== void 0) config.languageOptions = {
|
|
208
232
|
...config.languageOptions,
|
|
209
233
|
...configToInclude.languageOptions,
|
|
@@ -212,7 +236,7 @@ const includeConfigs = (config, configsToInclude) => {
|
|
|
212
236
|
...config.languageOptions?.syntax?.atRules,
|
|
213
237
|
...configToInclude.languageOptions.syntax?.atRules
|
|
214
238
|
},
|
|
215
|
-
cssWideKeywords: [
|
|
239
|
+
cssWideKeywords: [.../* @__PURE__ */ new Set([...config.languageOptions?.syntax?.cssWideKeywords ?? [], ...configToInclude.languageOptions.syntax?.cssWideKeywords ?? []])],
|
|
216
240
|
properties: {
|
|
217
241
|
...config.languageOptions?.syntax?.properties,
|
|
218
242
|
...configToInclude.languageOptions.syntax?.properties
|
|
@@ -226,12 +250,14 @@ const includeConfigs = (config, configsToInclude) => {
|
|
|
226
250
|
if (configToInclude.allowEmptyInput !== void 0) config.allowEmptyInput = configToInclude.allowEmptyInput;
|
|
227
251
|
if (configToInclude.cache !== void 0) config.cache = configToInclude.cache;
|
|
228
252
|
if (configToInclude.fix !== void 0) config.fix = configToInclude.fix;
|
|
229
|
-
if (configToInclude.computeEditInfo !== void 0) config.computeEditInfo = configToInclude.computeEditInfo;
|
|
230
253
|
if (configToInclude.validate !== void 0) config.validate = configToInclude.validate;
|
|
231
254
|
}
|
|
232
255
|
};
|
|
233
256
|
//#endregion
|
|
234
257
|
//#region ../src/js/stylelint/configs/html.ts
|
|
258
|
+
/**
|
|
259
|
+
* @internal @brnshkr/config/stylelint
|
|
260
|
+
*/
|
|
235
261
|
const html = () => {
|
|
236
262
|
const { requiredAll: [isPostcssHtmlInstalled, isStylelintConfigHtmlInstalled] } = resolvePackages(MODULES.html);
|
|
237
263
|
if (!isPostcssHtmlInstalled || !isStylelintConfigHtmlInstalled) return [];
|
|
@@ -249,19 +275,35 @@ const html = () => {
|
|
|
249
275
|
};
|
|
250
276
|
//#endregion
|
|
251
277
|
//#region ../src/js/stylelint/configs/ignores.ts
|
|
252
|
-
|
|
278
|
+
/**
|
|
279
|
+
* @internal @brnshkr/config/stylelint
|
|
280
|
+
*/
|
|
281
|
+
const ignores = () => [{ ignoreFiles: GLOB_IGNORES.map((glob) => glob.replace(/^\*\*/v, () => `${process.cwd()}/**`)) }];
|
|
253
282
|
//#endregion
|
|
254
|
-
//#region ../src/js/stylelint/configs/
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
283
|
+
//#region ../src/js/stylelint/configs/less.ts
|
|
284
|
+
/**
|
|
285
|
+
* @internal @brnshkr/config/stylelint
|
|
286
|
+
*/
|
|
287
|
+
const less = () => {
|
|
288
|
+
const { requiredAll: [isStylelintConfigStandardLessInstalled] } = resolvePackages(MODULES.less);
|
|
289
|
+
if (!isStylelintConfigStandardLessInstalled) return [];
|
|
290
|
+
return [{ overrides: [{
|
|
291
|
+
name: buildOverrideName(OVERRIDES.LESS),
|
|
292
|
+
files: ["**/*.less"],
|
|
293
|
+
extends: STYLELINT_PACKAGES.STYLELINT_CONFIG_STANDARD_LESS,
|
|
294
|
+
rules: {
|
|
295
|
+
"function-no-unknown": null,
|
|
296
|
+
"less/color-hex-case": "lower",
|
|
297
|
+
"less/container-name-pattern": ["^(--)?([a-z][a-z0-9]*)(-[a-z0-9]+)*$"],
|
|
298
|
+
"less/declaration-property-value-no-unknown": true
|
|
299
|
+
}
|
|
300
|
+
}] }];
|
|
262
301
|
};
|
|
263
302
|
//#endregion
|
|
264
303
|
//#region ../src/js/stylelint/configs/modules.ts
|
|
304
|
+
/**
|
|
305
|
+
* @internal @brnshkr/config/stylelint
|
|
306
|
+
*/
|
|
265
307
|
const modules = () => {
|
|
266
308
|
const { requiredAll: [isStylelintConfigCssModulesInstalled] } = resolvePackages(MODULES.modules);
|
|
267
309
|
if (!isStylelintConfigCssModulesInstalled) return [];
|
|
@@ -269,6 +311,9 @@ const modules = () => {
|
|
|
269
311
|
};
|
|
270
312
|
//#endregion
|
|
271
313
|
//#region ../src/js/stylelint/configs/nesting.ts
|
|
314
|
+
/**
|
|
315
|
+
* @internal @brnshkr/config/stylelint
|
|
316
|
+
*/
|
|
272
317
|
const nesting = () => {
|
|
273
318
|
const { requiredAll: [isStylelintUseNestingInstalled] } = resolvePackages(MODULES.nesting);
|
|
274
319
|
if (!isStylelintUseNestingInstalled) return [];
|
|
@@ -279,6 +324,9 @@ const nesting = () => {
|
|
|
279
324
|
};
|
|
280
325
|
//#endregion
|
|
281
326
|
//#region ../src/js/stylelint/configs/order.ts
|
|
327
|
+
/**
|
|
328
|
+
* @internal @brnshkr/config/stylelint
|
|
329
|
+
*/
|
|
282
330
|
const order = () => {
|
|
283
331
|
const { requiredAll: [isStylelintConfigRecessOrderInstalled] } = resolvePackages(MODULES.order);
|
|
284
332
|
if (!isStylelintConfigRecessOrderInstalled) return [];
|
|
@@ -286,10 +334,15 @@ const order = () => {
|
|
|
286
334
|
};
|
|
287
335
|
//#endregion
|
|
288
336
|
//#region ../src/js/stylelint/configs/scss.ts
|
|
337
|
+
/**
|
|
338
|
+
* @internal @brnshkr/config/stylelint
|
|
339
|
+
*/
|
|
289
340
|
const scss = () => {
|
|
290
341
|
const { requiredAll: [isStylelintConfigStandardScssInstalled], optional: [isStylelintPluginUseBaselineInstalled] } = resolvePackages(MODULES.scss);
|
|
291
342
|
if (!isStylelintConfigStandardScssInstalled) return [];
|
|
292
|
-
return [{
|
|
343
|
+
return [{ overrides: [{
|
|
344
|
+
name: buildOverrideName(OVERRIDES.SCSS),
|
|
345
|
+
files: ["**/*.scss"],
|
|
293
346
|
extends: STYLELINT_PACKAGES.STYLELINT_CONFIG_STANDARD_SCSS,
|
|
294
347
|
rules: {
|
|
295
348
|
"scss/at-each-key-value-single-line": true,
|
|
@@ -322,22 +375,22 @@ const scss = () => {
|
|
|
322
375
|
"scss/no-unused-private-members": true,
|
|
323
376
|
"scss/partial-no-import": true,
|
|
324
377
|
"scss/at-import-partial-extension-disallowed-list": ["scss"],
|
|
378
|
+
"scss/declaration-property-value-no-unknown": true,
|
|
379
|
+
"function-no-unknown": null,
|
|
380
|
+
"scss/function-no-unknown": true,
|
|
325
381
|
"property-no-unknown": null,
|
|
326
382
|
"scss/property-no-unknown": true,
|
|
327
|
-
"scss/selector-no-redundant-nesting-selector": true
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
rules: {
|
|
333
|
-
"scss/comment-no-loud": true,
|
|
334
|
-
...isStylelintPluginUseBaselineInstalled ? { "plugin/use-baseline": [true, { ignoreAtRules: ["function"] }] } : void 0
|
|
335
|
-
}
|
|
336
|
-
}]
|
|
337
|
-
}];
|
|
383
|
+
"scss/selector-no-redundant-nesting-selector": true,
|
|
384
|
+
"scss/comment-no-loud": true,
|
|
385
|
+
...isStylelintPluginUseBaselineInstalled ? { "plugin/use-baseline": [true, { ignoreAtRules: ["function"] }] } : void 0
|
|
386
|
+
}
|
|
387
|
+
}] }];
|
|
338
388
|
};
|
|
339
389
|
//#endregion
|
|
340
390
|
//#region ../src/js/stylelint/configs/strict.ts
|
|
391
|
+
/**
|
|
392
|
+
* @internal @brnshkr/config/stylelint
|
|
393
|
+
*/
|
|
341
394
|
const strict = () => {
|
|
342
395
|
const { requiredAll: [isStylelintDeclarationStrictValueInstalled] } = resolvePackages(MODULES.strict);
|
|
343
396
|
if (!isStylelintDeclarationStrictValueInstalled) return [];
|
|
@@ -352,6 +405,9 @@ const strict = () => {
|
|
|
352
405
|
};
|
|
353
406
|
//#endregion
|
|
354
407
|
//#region ../src/js/stylelint/configs/style.ts
|
|
408
|
+
/**
|
|
409
|
+
* @internal @brnshkr/config/stylelint
|
|
410
|
+
*/
|
|
355
411
|
const style = () => {
|
|
356
412
|
const { requiredAll: [isStylisticStylelintConfigInstalled] } = resolvePackages(MODULES.style);
|
|
357
413
|
if (!isStylisticStylelintConfigInstalled) return [];
|
|
@@ -381,13 +437,16 @@ const style = () => {
|
|
|
381
437
|
};
|
|
382
438
|
//#endregion
|
|
383
439
|
//#region ../src/js/stylelint/configs/index.ts
|
|
440
|
+
/**
|
|
441
|
+
* @internal @brnshkr/config/stylelint
|
|
442
|
+
*/
|
|
384
443
|
const configs = {
|
|
385
444
|
baseline,
|
|
386
445
|
css,
|
|
387
446
|
defensive,
|
|
388
447
|
html,
|
|
389
448
|
ignores,
|
|
390
|
-
|
|
449
|
+
less,
|
|
391
450
|
modules,
|
|
392
451
|
nesting,
|
|
393
452
|
order,
|
|
@@ -397,12 +456,46 @@ const configs = {
|
|
|
397
456
|
};
|
|
398
457
|
//#endregion
|
|
399
458
|
//#region ../src/js/stylelint/index.ts
|
|
459
|
+
/**
|
|
460
|
+
* Build the `@brnshkr` Stylelint config object.
|
|
461
|
+
*
|
|
462
|
+
* Merges sensible defaults for every supported module (SCSS, Less, HTML, etc.) with user
|
|
463
|
+
* overrides and any additional configs.
|
|
464
|
+
*
|
|
465
|
+
* @api
|
|
466
|
+
*
|
|
467
|
+
* @param optionsAndGlobalConfig per-module toggles and global Stylelint fields merged with the defaults
|
|
468
|
+
* @param additionalConfigs extra Stylelint config entries merged after the built-in ones
|
|
469
|
+
*
|
|
470
|
+
* @returns final Stylelint config ready to be consumed by Stylelint
|
|
471
|
+
*
|
|
472
|
+
* @see https://github.com/brnshkr/config/blob/master/docs/js/stylelint.md
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```js
|
|
476
|
+
* import { getConfig } from '@brnshkr/config/stylelint';
|
|
477
|
+
*
|
|
478
|
+
* getConfig(undefined);
|
|
479
|
+
* getConfig({});
|
|
480
|
+
*
|
|
481
|
+
* getConfig({
|
|
482
|
+
* scss: false,
|
|
483
|
+
* ignoreFiles: ['dist/**'],
|
|
484
|
+
* }, {
|
|
485
|
+
* rules: { 'color-no-hex': null },
|
|
486
|
+
* });
|
|
487
|
+
*
|
|
488
|
+
* getConfig(undefined, {
|
|
489
|
+
* rules: { 'color-no-hex': null },
|
|
490
|
+
* });
|
|
491
|
+
* ```
|
|
492
|
+
*/
|
|
400
493
|
const getConfig = (optionsAndGlobalConfig, ...additionalConfigs) => {
|
|
401
494
|
const resolvedOptions = {
|
|
402
495
|
baseline: isModuleEnabledByDefault(MODULES.baseline),
|
|
403
496
|
defensive: isModuleEnabledByDefault(MODULES.defensive),
|
|
404
497
|
html: isModuleEnabledByDefault(MODULES.html),
|
|
405
|
-
|
|
498
|
+
less: isModuleEnabledByDefault(MODULES.less),
|
|
406
499
|
modules: isModuleEnabledByDefault(MODULES.modules),
|
|
407
500
|
nesting: isModuleEnabledByDefault(MODULES.nesting),
|
|
408
501
|
order: isModuleEnabledByDefault(MODULES.order),
|
|
@@ -414,7 +507,7 @@ const getConfig = (optionsAndGlobalConfig, ...additionalConfigs) => {
|
|
|
414
507
|
setModuleEnabled(MODULES.baseline, resolvedOptions.baseline);
|
|
415
508
|
setModuleEnabled(MODULES.defensive, resolvedOptions.defensive);
|
|
416
509
|
setModuleEnabled(MODULES.html, resolvedOptions.html);
|
|
417
|
-
setModuleEnabled(MODULES.
|
|
510
|
+
setModuleEnabled(MODULES.less, resolvedOptions.less);
|
|
418
511
|
setModuleEnabled(MODULES.modules, resolvedOptions.modules);
|
|
419
512
|
setModuleEnabled(MODULES.nesting, resolvedOptions.nesting);
|
|
420
513
|
setModuleEnabled(MODULES.order, resolvedOptions.order);
|
|
@@ -426,9 +519,9 @@ const getConfig = (optionsAndGlobalConfig, ...additionalConfigs) => {
|
|
|
426
519
|
includeConfigs(config, configs.css());
|
|
427
520
|
if (isModuleEnabled(MODULES.baseline)) includeConfigs(config, configs.baseline());
|
|
428
521
|
if (isModuleEnabled(MODULES.defensive)) includeConfigs(config, configs.defensive());
|
|
429
|
-
if (isModuleEnabled(MODULES.logical)) includeConfigs(config, configs.logical());
|
|
430
522
|
if (isModuleEnabled(MODULES.nesting)) includeConfigs(config, configs.nesting());
|
|
431
523
|
if (isModuleEnabled(MODULES.order)) includeConfigs(config, configs.order());
|
|
524
|
+
if (isModuleEnabled(MODULES.less)) includeConfigs(config, configs.less());
|
|
432
525
|
if (isModuleEnabled(MODULES.scss)) includeConfigs(config, configs.scss());
|
|
433
526
|
if (isModuleEnabled(MODULES.html)) includeConfigs(config, configs.html());
|
|
434
527
|
if (isModuleEnabled(MODULES.modules)) includeConfigs(config, configs.modules());
|
|
@@ -437,6 +530,11 @@ const getConfig = (optionsAndGlobalConfig, ...additionalConfigs) => {
|
|
|
437
530
|
includeConfigs(config, getUserConfigs(resolvedOptions, additionalConfigs));
|
|
438
531
|
return config;
|
|
439
532
|
};
|
|
533
|
+
/**
|
|
534
|
+
* Default-exported pre-built config for direct re-export from a Stylelint config file.
|
|
535
|
+
*
|
|
536
|
+
* @api
|
|
537
|
+
*/
|
|
440
538
|
var stylelint_default = getConfig();
|
|
441
539
|
//#endregion
|
|
442
540
|
export { stylelint_default as default, getConfig };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ViteUserConfig } from "vitest/config";
|
|
2
|
+
//#region ../src/js/vitest/types/config.d.ts
|
|
3
|
+
type Config = ViteUserConfig;
|
|
4
|
+
//#endregion
|
|
5
|
+
//#region ../src/js/vitest/types/options.d.ts
|
|
6
|
+
interface ConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Enables `happy-dom` or `jsdom`.
|
|
9
|
+
*
|
|
10
|
+
* @default `Enabled when "happy-dom" or "jsdom" is installed.`
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/capricorn86/happy-dom
|
|
13
|
+
* @see https://github.com/jsdom/jsdom
|
|
14
|
+
*/
|
|
15
|
+
environment: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Collects the spelling test this package ships, so a project writes none of its own for it.
|
|
18
|
+
*
|
|
19
|
+
* @default `true`
|
|
20
|
+
*
|
|
21
|
+
* @see https://github.com/brnshkr/config/blob/master/docs/spelling.md
|
|
22
|
+
*/
|
|
23
|
+
spelling: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Enables `@vitest/ui`.
|
|
26
|
+
*
|
|
27
|
+
* @default `Enabled when "@vitest/ui" is installed.`
|
|
28
|
+
*
|
|
29
|
+
* @see https://github.com/vitest-dev/vitest/tree/main/packages/ui
|
|
30
|
+
*/
|
|
31
|
+
ui: boolean;
|
|
32
|
+
}
|
|
33
|
+
type UserOptions = Partial<ConfigOptions> & Config;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region ../src/js/vitest/index.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* Build the `@brnshkr` Vitest config object.
|
|
38
|
+
*
|
|
39
|
+
* Collects the project's own tests and the spelling test this package ships, so a repository
|
|
40
|
+
* needs no test file of its own for it, and activates each module lazily, only when its
|
|
41
|
+
* optional peer dependency is installed.
|
|
42
|
+
*
|
|
43
|
+
* @api
|
|
44
|
+
*
|
|
45
|
+
* @param optionsAndGlobalConfig per-module toggles and global Vitest fields merged with the defaults
|
|
46
|
+
* @param additionalConfigs extra config entries merged after the built-in ones
|
|
47
|
+
*
|
|
48
|
+
* @returns final config ready to be consumed by Vitest
|
|
49
|
+
*
|
|
50
|
+
* @see https://github.com/brnshkr/config/blob/master/docs/js/vitest.md
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```js
|
|
54
|
+
* import { getConfig } from '@brnshkr/config/vitest';
|
|
55
|
+
*
|
|
56
|
+
* getConfig(undefined);
|
|
57
|
+
* getConfig({});
|
|
58
|
+
*
|
|
59
|
+
* getConfig({
|
|
60
|
+
* spelling: false,
|
|
61
|
+
* test: { testTimeout: 120_000 },
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare const getConfig: (optionsAndGlobalConfig?: UserOptions, ...additionalConfigs: Config[]) => Config;
|
|
66
|
+
/**
|
|
67
|
+
* Default-exported pre-built config for direct re-export from a Vitest config file.
|
|
68
|
+
*
|
|
69
|
+
* @api
|
|
70
|
+
*/
|
|
71
|
+
declare const _default: import("vite").UserConfig;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { _default as default };
|