@brnshkr/config 0.0.1-beta.3 → 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 +174 -226
- 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 +3890 -1387
- package/dist/eslint/index.mjs +2662 -471
- package/dist/markdownlint/index.d.mts +2304 -0
- package/dist/markdownlint/index.mjs +440 -0
- package/dist/shared.mjs +406 -64
- 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 -31
- /package/conf/{eslint.config.mjs.example → eslint.dist.mjs} +0 -0
- /package/conf/{stylelint.config.mjs.example → stylelint.dist.mjs} +0 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
{
|
|
2
|
+
////////////////////////
|
|
3
|
+
/// Project specific ///
|
|
4
|
+
////////////////////////
|
|
5
|
+
|
|
6
|
+
// CSS
|
|
7
|
+
"stylelint.configFile": "./conf/stylelint.dist.mjs",
|
|
8
|
+
"stylelint.configBasedir": "./",
|
|
9
|
+
|
|
10
|
+
// JS/TS
|
|
11
|
+
"js/ts.tsdk.path": "./node_modules/typescript/lib",
|
|
12
|
+
"eslint.options": {
|
|
13
|
+
"overrideConfigFile": "./conf/eslint.dist.mjs"
|
|
14
|
+
},
|
|
15
|
+
"eslint.workingDirectories": ["."],
|
|
16
|
+
|
|
17
|
+
// Markdown
|
|
18
|
+
"markdownlint.configFile": "./conf/markdownlint.dist.mjs",
|
|
19
|
+
"markdownlint.configPointer": "/config",
|
|
20
|
+
|
|
21
|
+
// PHP
|
|
22
|
+
"php-cs-fixer.config": "./conf/php-cs-fixer.php;./conf/php-cs-fixer.dist.php",
|
|
23
|
+
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer",
|
|
24
|
+
"php-cs-fixer.executablePathWindows": "${workspaceFolder}\\vendor\\bin\\php-cs-fixer.bat",
|
|
25
|
+
"phpstan.binPath": "./vendor/bin/phpstan",
|
|
26
|
+
"phpstan.configFile": "./conf/phpstan.php,./conf/phpstan.dist.php",
|
|
27
|
+
|
|
28
|
+
///////////////
|
|
29
|
+
/// General ///
|
|
30
|
+
///////////////
|
|
31
|
+
|
|
32
|
+
// Functional
|
|
33
|
+
"files.trimFinalNewlines": true,
|
|
34
|
+
"files.associations": {
|
|
35
|
+
".env{,.*}": "properties",
|
|
36
|
+
"*.neon": "yaml",
|
|
37
|
+
"LICENSE": "plaintext"
|
|
38
|
+
},
|
|
39
|
+
"emmet.includeLanguages": {
|
|
40
|
+
"twig": "html"
|
|
41
|
+
},
|
|
42
|
+
"workbench.editorAssociations": {
|
|
43
|
+
"*.svg": "default"
|
|
44
|
+
},
|
|
45
|
+
"todo-tree.general.tags": [
|
|
46
|
+
"BUG",
|
|
47
|
+
"HACK",
|
|
48
|
+
"FIXME",
|
|
49
|
+
"NOTICE",
|
|
50
|
+
"TODO"
|
|
51
|
+
],
|
|
52
|
+
|
|
53
|
+
// Visual
|
|
54
|
+
"diffEditor.ignoreTrimWhitespace": false,
|
|
55
|
+
"todo-tree.highlights.defaultHighlight": {
|
|
56
|
+
"background": "#0000"
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
// Formatters
|
|
60
|
+
"[css]": {
|
|
61
|
+
"editor.defaultFormatter": "aeschli.vscode-css-formatter"
|
|
62
|
+
},
|
|
63
|
+
"[html]": {
|
|
64
|
+
"editor.defaultFormatter": "vscode.html-language-features"
|
|
65
|
+
},
|
|
66
|
+
"[javascript]": {
|
|
67
|
+
"editor.defaultFormatter": "vscode.typescript-language-features"
|
|
68
|
+
},
|
|
69
|
+
"[json]": {
|
|
70
|
+
"editor.defaultFormatter": "vscode.json-language-features"
|
|
71
|
+
},
|
|
72
|
+
"[jsonc]": {
|
|
73
|
+
"editor.defaultFormatter": "vscode.json-language-features"
|
|
74
|
+
},
|
|
75
|
+
"[markdown]": {
|
|
76
|
+
"editor.defaultFormatter": "yzhang.markdown-all-in-one"
|
|
77
|
+
},
|
|
78
|
+
"[php]": {
|
|
79
|
+
"editor.defaultFormatter": "junstyle.php-cs-fixer"
|
|
80
|
+
},
|
|
81
|
+
"[twig]": {
|
|
82
|
+
"editor.defaultFormatter": "mblode.twig-language-2"
|
|
83
|
+
},
|
|
84
|
+
"[typescript]": {
|
|
85
|
+
"editor.defaultFormatter": "vscode.typescript-language-features"
|
|
86
|
+
},
|
|
87
|
+
"[xml]": {
|
|
88
|
+
"editor.defaultFormatter": "redhat.vscode-xml"
|
|
89
|
+
},
|
|
90
|
+
"[yaml]": {
|
|
91
|
+
"editor.defaultFormatter": "redhat.vscode-yaml"
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
// Telemetry
|
|
95
|
+
"gitlens.telemetry.enabled": false,
|
|
96
|
+
"partialDiff.enableTelemetry": false,
|
|
97
|
+
"redhat.telemetry.enabled": false,
|
|
98
|
+
"telemetry.telemetryLevel": "off", // NOTICE: Can only be turned off in the default settings
|
|
99
|
+
"intelephense.telemetry.enabled": false,
|
|
100
|
+
|
|
101
|
+
// Copilot
|
|
102
|
+
"github.copilot.enable": {
|
|
103
|
+
"*": true,
|
|
104
|
+
"plaintext": false,
|
|
105
|
+
"properties": false,
|
|
106
|
+
"markdown": false,
|
|
107
|
+
"scminput": false
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// Excludes
|
|
111
|
+
"explorer.autoRevealExclude": {
|
|
112
|
+
"**/.cache/**": true,
|
|
113
|
+
"**/.changeset/**": true,
|
|
114
|
+
"**/.git/**": true,
|
|
115
|
+
"**/.hg/store/**": true,
|
|
116
|
+
"**/.history/**": true,
|
|
117
|
+
"**/.idea/**": true,
|
|
118
|
+
"**/.next/**": true,
|
|
119
|
+
"**/.nuxt/**": true,
|
|
120
|
+
"**/.output/**": true,
|
|
121
|
+
"**/.svelte-kit/**": true,
|
|
122
|
+
"**/.temp/**": true,
|
|
123
|
+
"**/.tmp/**": true,
|
|
124
|
+
"**/.vercel/**": true,
|
|
125
|
+
"**/.vite-inspect/**": true,
|
|
126
|
+
"**/.vitepress/cache/**": true,
|
|
127
|
+
"**/.vscode/**": true,
|
|
128
|
+
"**/.yarn/**": true,
|
|
129
|
+
"**/__snapshots__/**": true,
|
|
130
|
+
"**/*.code-search": true,
|
|
131
|
+
"**/*.min.*": true,
|
|
132
|
+
"**/bower_components/**": true,
|
|
133
|
+
"**/bun.lock": true,
|
|
134
|
+
"**/composer.lock": true,
|
|
135
|
+
"**/coverage/**": true,
|
|
136
|
+
"**/dist/**": true,
|
|
137
|
+
"**/node_modules/**": true,
|
|
138
|
+
"**/output/**": true,
|
|
139
|
+
"**/package-lock.json": true,
|
|
140
|
+
"**/pnpm-lock.yaml": true,
|
|
141
|
+
"**/temp/**": true,
|
|
142
|
+
"**/tests/**/fixtures/**": true,
|
|
143
|
+
"**/tmp/**": true,
|
|
144
|
+
"**/vendor/**": true,
|
|
145
|
+
"**/vite.config.*.timestamp-*": true,
|
|
146
|
+
"**/yarn.lock": true
|
|
147
|
+
},
|
|
148
|
+
"search.exclude": {
|
|
149
|
+
"**/.cache/**": true,
|
|
150
|
+
"**/.changeset/**": true,
|
|
151
|
+
"**/.git/**": true,
|
|
152
|
+
"**/.hg/store/**": true,
|
|
153
|
+
"**/.history/**": true,
|
|
154
|
+
"**/.idea/**": true,
|
|
155
|
+
"**/.next/**": true,
|
|
156
|
+
"**/.nuxt/**": true,
|
|
157
|
+
"**/.output/**": true,
|
|
158
|
+
"**/.svelte-kit/**": true,
|
|
159
|
+
"**/.temp/**": true,
|
|
160
|
+
"**/.tmp/**": true,
|
|
161
|
+
"**/.vercel/**": true,
|
|
162
|
+
"**/.vite-inspect/**": true,
|
|
163
|
+
"**/.vitepress/cache/**": true,
|
|
164
|
+
"**/.vscode/**": true,
|
|
165
|
+
"**/.yarn/**": true,
|
|
166
|
+
"**/__snapshots__/**": true,
|
|
167
|
+
"**/*.code-search": true,
|
|
168
|
+
"**/*.min.*": true,
|
|
169
|
+
"**/bower_components/**": true,
|
|
170
|
+
"**/bun.lock": true,
|
|
171
|
+
"**/composer.lock": true,
|
|
172
|
+
"**/coverage/**": true,
|
|
173
|
+
"**/dist/**": true,
|
|
174
|
+
"**/node_modules/**": true,
|
|
175
|
+
"**/output/**": true,
|
|
176
|
+
"**/package-lock.json": true,
|
|
177
|
+
"**/pnpm-lock.yaml": true,
|
|
178
|
+
"**/temp/**": true,
|
|
179
|
+
"**/tests/**/fixtures/**": true,
|
|
180
|
+
"**/tmp/**": true,
|
|
181
|
+
"**/vendor/**": true,
|
|
182
|
+
"**/vite.config.*.timestamp-*": true,
|
|
183
|
+
"**/yarn.lock": true
|
|
184
|
+
},
|
|
185
|
+
"files.watcherExclude": {
|
|
186
|
+
"**/.cache/**": true,
|
|
187
|
+
"**/.changeset/**": true,
|
|
188
|
+
"**/.git/**": true,
|
|
189
|
+
"**/.hg/store/**": true,
|
|
190
|
+
"**/.history/**": true,
|
|
191
|
+
"**/.idea/**": true,
|
|
192
|
+
"**/.next/**": true,
|
|
193
|
+
"**/.nuxt/**": true,
|
|
194
|
+
"**/.output/**": true,
|
|
195
|
+
"**/.svelte-kit/**": true,
|
|
196
|
+
"**/.temp/**": true,
|
|
197
|
+
"**/.tmp/**": true,
|
|
198
|
+
"**/.vercel/**": true,
|
|
199
|
+
"**/.vite-inspect/**": true,
|
|
200
|
+
"**/.vitepress/cache/**": true,
|
|
201
|
+
"**/.vscode/**": true,
|
|
202
|
+
"**/.yarn/**": true,
|
|
203
|
+
"**/__snapshots__/**": true,
|
|
204
|
+
"**/*.code-search": true,
|
|
205
|
+
"**/*.example": true,
|
|
206
|
+
"**/*.min.*": true,
|
|
207
|
+
"**/bower_components/**": true,
|
|
208
|
+
"**/bun.lock": true,
|
|
209
|
+
"**/composer.lock": true,
|
|
210
|
+
"**/coverage/**": true,
|
|
211
|
+
"**/dist/**": true,
|
|
212
|
+
"**/node_modules/**": true,
|
|
213
|
+
"**/output/**": true,
|
|
214
|
+
"**/package-lock.json": true,
|
|
215
|
+
"**/pnpm-lock.yaml": true,
|
|
216
|
+
"**/temp/**": true,
|
|
217
|
+
"**/tests/**/fixtures/**": true,
|
|
218
|
+
"**/tmp/**": true,
|
|
219
|
+
"**/vendor/**": true,
|
|
220
|
+
"**/vite.config.*.timestamp-*": true,
|
|
221
|
+
"**/yarn.lock": true
|
|
222
|
+
},
|
|
223
|
+
"todo-tree.filtering.excludeGlobs": [
|
|
224
|
+
"**/__snapshots__/**",
|
|
225
|
+
"**/.cache/**",
|
|
226
|
+
"**/.changeset/**",
|
|
227
|
+
"**/.git/**",
|
|
228
|
+
"**/.hg/store/**",
|
|
229
|
+
"**/.history/**",
|
|
230
|
+
"**/.idea/**",
|
|
231
|
+
"**/.next/**",
|
|
232
|
+
"**/.nuxt/**",
|
|
233
|
+
"**/.output/**",
|
|
234
|
+
"**/.svelte-kit/**",
|
|
235
|
+
"**/.temp/**",
|
|
236
|
+
"**/.tmp/**",
|
|
237
|
+
"**/.vercel/**",
|
|
238
|
+
"**/.vite-inspect/**",
|
|
239
|
+
"**/.vitepress/cache/**",
|
|
240
|
+
"**/.vscode/**",
|
|
241
|
+
"**/.yarn/**",
|
|
242
|
+
"**/*.code-search",
|
|
243
|
+
"**/*.example",
|
|
244
|
+
"**/*.min.*",
|
|
245
|
+
"**/bower_components/**",
|
|
246
|
+
"**/bun.lock",
|
|
247
|
+
"**/composer.lock",
|
|
248
|
+
"**/coverage/**",
|
|
249
|
+
"**/dist/**",
|
|
250
|
+
"**/node_modules/**",
|
|
251
|
+
"**/output/**",
|
|
252
|
+
"**/package-lock.json",
|
|
253
|
+
"**/pnpm-lock.yaml",
|
|
254
|
+
"**/temp/**",
|
|
255
|
+
"**/tests/**/fixtures/**",
|
|
256
|
+
"**/tmp/**",
|
|
257
|
+
"**/vendor/**",
|
|
258
|
+
"**/vite.config.*.timestamp-*",
|
|
259
|
+
"**/yarn.lock"
|
|
260
|
+
],
|
|
261
|
+
|
|
262
|
+
/////////////////////////
|
|
263
|
+
/// Language specific ///
|
|
264
|
+
/////////////////////////
|
|
265
|
+
|
|
266
|
+
// CSS
|
|
267
|
+
"css.customData": [
|
|
268
|
+
"./.vscode/css-custom-data.json"
|
|
269
|
+
],
|
|
270
|
+
"tailwindCSS.emmetCompletions": true,
|
|
271
|
+
"css.lint.unknownAtRules": "ignore",
|
|
272
|
+
"css.validate": false,
|
|
273
|
+
"scss.lint.unknownAtRules": "ignore",
|
|
274
|
+
"scss.validate": false,
|
|
275
|
+
"stylelint.validate": [
|
|
276
|
+
"css",
|
|
277
|
+
"html",
|
|
278
|
+
"less",
|
|
279
|
+
"scss",
|
|
280
|
+
"svelte",
|
|
281
|
+
"vue-html",
|
|
282
|
+
"vue",
|
|
283
|
+
"xml"
|
|
284
|
+
],
|
|
285
|
+
|
|
286
|
+
// JS/TS
|
|
287
|
+
"js/ts.updateImportsOnFileMove.enabled": "always",
|
|
288
|
+
"js/ts.preferences.importModuleSpecifier": "non-relative",
|
|
289
|
+
"js/ts.preferences.quoteStyle": "single",
|
|
290
|
+
"svelte.enable-ts-plugin": true,
|
|
291
|
+
"eslint.validate": [
|
|
292
|
+
"css",
|
|
293
|
+
"html",
|
|
294
|
+
"javascript",
|
|
295
|
+
"javascriptreact",
|
|
296
|
+
"json",
|
|
297
|
+
"json5",
|
|
298
|
+
"jsonc",
|
|
299
|
+
"markdown",
|
|
300
|
+
"svelte",
|
|
301
|
+
"toml",
|
|
302
|
+
"typescript",
|
|
303
|
+
"typescriptreact",
|
|
304
|
+
"vue",
|
|
305
|
+
"xml",
|
|
306
|
+
"yaml"
|
|
307
|
+
],
|
|
308
|
+
|
|
309
|
+
// PHP
|
|
310
|
+
"phpstan.enableStatusBar": false,
|
|
311
|
+
"phpstan.showTypeOnHover": true,
|
|
312
|
+
// "phpstan.singleFileMode": true, // Turn single file mode on if you are encountering performance issues
|
|
313
|
+
|
|
314
|
+
// JSON
|
|
315
|
+
"json.schemas": [
|
|
316
|
+
{
|
|
317
|
+
"url": "https://getcomposer.org/schema.json",
|
|
318
|
+
"fileMatch": [
|
|
319
|
+
"composer.json",
|
|
320
|
+
"*.composer.json"
|
|
321
|
+
]
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"url": "https://json.schemastore.org/package",
|
|
325
|
+
"fileMatch": [
|
|
326
|
+
"package.json",
|
|
327
|
+
"*.package.json"
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"url": "https://json.schemastore.org/tsconfig",
|
|
332
|
+
"fileMatch": [
|
|
333
|
+
"tsconfig.json",
|
|
334
|
+
"*.tsconfig.json"
|
|
335
|
+
]
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { UserConfig } from "@commitlint/types";
|
|
2
|
+
import { TenseOptions } from "commitlint-plugin-tense/dist/library/ensure-tense";
|
|
3
|
+
//#region ../src/js/commitlint/types/config.d.ts
|
|
4
|
+
type Config = { [Key in keyof UserConfig as string extends Key ? never : Key]: UserConfig[Key]; };
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region ../src/js/commitlint/types/options.d.ts
|
|
7
|
+
interface ConfigOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Enables `@commitlint/config-conventional`.
|
|
10
|
+
*
|
|
11
|
+
* @default `Enabled when "@commitlint/config-conventional" is installed.`
|
|
12
|
+
*
|
|
13
|
+
* @see https://github.com/conventional-changelog/commitlint
|
|
14
|
+
*/
|
|
15
|
+
conventional: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Enables `commitlint-plugin-function-rules`.
|
|
18
|
+
*
|
|
19
|
+
* @default `Enabled when "commitlint-plugin-function-rules" is installed.`
|
|
20
|
+
*
|
|
21
|
+
* @see https://github.com/gabrielcolson/commitlint-plugin-function-rules
|
|
22
|
+
*/
|
|
23
|
+
functions: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Enables `commitlint-plugin-tense`.
|
|
26
|
+
*
|
|
27
|
+
* @default `Enabled when "commitlint-plugin-tense" is installed.`
|
|
28
|
+
*
|
|
29
|
+
* @see https://github.com/actuallyleon/commitlint-plugin-tense
|
|
30
|
+
*/
|
|
31
|
+
tense: boolean | Partial<TenseOptions>;
|
|
32
|
+
}
|
|
33
|
+
type UserOptions = Partial<ConfigOptions> & Config;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region ../src/js/commitlint/index.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* Build the `@brnshkr` commitlint config object.
|
|
38
|
+
*
|
|
39
|
+
* Every preset is optional and enabled only when it is installed, so a project gets the organization's rules
|
|
40
|
+
* whether or not it has the conventional preset.
|
|
41
|
+
*
|
|
42
|
+
* @api
|
|
43
|
+
*
|
|
44
|
+
* @param optionsAndGlobalConfig per-module toggles and global commitlint fields merged with the defaults
|
|
45
|
+
* @param additionalConfigs extra config entries merged after the built-in ones
|
|
46
|
+
*
|
|
47
|
+
* @returns final commitlint config ready to be consumed by commitlint
|
|
48
|
+
*
|
|
49
|
+
* @see https://github.com/brnshkr/config/blob/master/docs/js/commitlint.md
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```js
|
|
53
|
+
* import { getConfig } from '@brnshkr/config/commitlint';
|
|
54
|
+
*
|
|
55
|
+
* getConfig(undefined);
|
|
56
|
+
* getConfig({});
|
|
57
|
+
*
|
|
58
|
+
* getConfig({
|
|
59
|
+
* conventional: false,
|
|
60
|
+
* rules: { 'scope-min-length': [2, 'always', 3] },
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const getConfig: (optionsAndGlobalConfig?: UserOptions, ...additionalConfigs: Config[]) => Config;
|
|
65
|
+
/**
|
|
66
|
+
* Default-exported pre-built config for direct re-export from a commitlint config file.
|
|
67
|
+
*
|
|
68
|
+
* @api
|
|
69
|
+
*/
|
|
70
|
+
declare const _default: Config;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { _default as default };
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { E as objectKeys, _ as COMMITLINT_PACKAGES, f as createModuleState, g as resolvePackagesSharedSynchronously, m as isModuleEnabledByDefault, w as objectEntries } from "../shared.mjs";
|
|
2
|
+
//#region ../src/js/commitlint/configs/commit.ts
|
|
3
|
+
/**
|
|
4
|
+
* @internal @brnshkr/config/commitlint
|
|
5
|
+
*/
|
|
6
|
+
const SCOPE_MIN_LENGTH = 2;
|
|
7
|
+
const SUBJECT_MIN_LENGTH = 5;
|
|
8
|
+
const commit = () => [{
|
|
9
|
+
helpUrl: "https://github.com/brnshkr/config/blob/master/README.md#-commit-style",
|
|
10
|
+
rules: {
|
|
11
|
+
"body-case": [
|
|
12
|
+
2,
|
|
13
|
+
"always",
|
|
14
|
+
"sentence-case"
|
|
15
|
+
],
|
|
16
|
+
"body-leading-blank": [2, "always"],
|
|
17
|
+
"breaking-change-exclamation-mark": [2, "always"],
|
|
18
|
+
"footer-leading-blank": [2, "always"],
|
|
19
|
+
"header-case": [
|
|
20
|
+
2,
|
|
21
|
+
"always",
|
|
22
|
+
"lower-case"
|
|
23
|
+
],
|
|
24
|
+
"scope-case": [
|
|
25
|
+
2,
|
|
26
|
+
"always",
|
|
27
|
+
"lower-case"
|
|
28
|
+
],
|
|
29
|
+
"scope-delimiter-style": [
|
|
30
|
+
2,
|
|
31
|
+
"always",
|
|
32
|
+
["/"]
|
|
33
|
+
],
|
|
34
|
+
"scope-empty": [2, "never"],
|
|
35
|
+
"scope-min-length": [
|
|
36
|
+
2,
|
|
37
|
+
"always",
|
|
38
|
+
SCOPE_MIN_LENGTH
|
|
39
|
+
],
|
|
40
|
+
"subject-min-length": [
|
|
41
|
+
2,
|
|
42
|
+
"always",
|
|
43
|
+
SUBJECT_MIN_LENGTH
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}];
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../src/js/commitlint/utils/module.ts
|
|
49
|
+
/**
|
|
50
|
+
* @internal @brnshkr/config/commitlint
|
|
51
|
+
*/
|
|
52
|
+
const MODULES = {
|
|
53
|
+
conventional: {
|
|
54
|
+
name: "conventional",
|
|
55
|
+
packages: { requiredAll: [COMMITLINT_PACKAGES.COMMITLINT_CONFIG_CONVENTIONAL] }
|
|
56
|
+
},
|
|
57
|
+
functions: {
|
|
58
|
+
name: "functions",
|
|
59
|
+
packages: { requiredAll: [COMMITLINT_PACKAGES.COMMITLINT_PLUGIN_FUNCTION_RULES] }
|
|
60
|
+
},
|
|
61
|
+
tense: {
|
|
62
|
+
name: "tense",
|
|
63
|
+
packages: { requiredAll: [COMMITLINT_PACKAGES.COMMITLINT_PLUGIN_TENSE] }
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const resolvePackages = resolvePackagesSharedSynchronously;
|
|
67
|
+
const { isModuleEnabled, setModuleEnabled } = createModuleState();
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region ../src/js/commitlint/configs/conventional.ts
|
|
70
|
+
/**
|
|
71
|
+
* @internal @brnshkr/config/commitlint
|
|
72
|
+
*/
|
|
73
|
+
const conventional = () => {
|
|
74
|
+
const { requiredAll: [isCommitlintConfigConventionalInstalled] } = resolvePackages(MODULES.conventional);
|
|
75
|
+
if (!isCommitlintConfigConventionalInstalled) return [];
|
|
76
|
+
return [{ extends: COMMITLINT_PACKAGES.COMMITLINT_CONFIG_CONVENTIONAL }];
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region ../src/js/commitlint/configs/functions.ts
|
|
80
|
+
/**
|
|
81
|
+
* @internal @brnshkr/config/commitlint
|
|
82
|
+
*/
|
|
83
|
+
const functions = () => {
|
|
84
|
+
const { requiredAll: [isCommitlintPluginFunctionRulesInstalled] } = resolvePackages(MODULES.functions);
|
|
85
|
+
if (!isCommitlintPluginFunctionRulesInstalled) return [];
|
|
86
|
+
return [{ plugins: [COMMITLINT_PACKAGES.COMMITLINT_PLUGIN_FUNCTION_RULES] }];
|
|
87
|
+
};
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region ../src/js/commitlint/configs/tense.ts
|
|
90
|
+
/**
|
|
91
|
+
* @internal @brnshkr/config/commitlint
|
|
92
|
+
*/
|
|
93
|
+
const ALLOWLIST = [
|
|
94
|
+
"announce",
|
|
95
|
+
"called",
|
|
96
|
+
"console",
|
|
97
|
+
"cover",
|
|
98
|
+
"covers",
|
|
99
|
+
"decide",
|
|
100
|
+
"dismantle",
|
|
101
|
+
"excludes",
|
|
102
|
+
"harden",
|
|
103
|
+
"hoist",
|
|
104
|
+
"measure",
|
|
105
|
+
"missing",
|
|
106
|
+
"non-empty-string",
|
|
107
|
+
"pad",
|
|
108
|
+
"promote",
|
|
109
|
+
"spell",
|
|
110
|
+
"throw",
|
|
111
|
+
"widen"
|
|
112
|
+
];
|
|
113
|
+
const tense = (options) => {
|
|
114
|
+
const { requiredAll: [isCommitlintPluginTenseInstalled] } = resolvePackages(MODULES.tense);
|
|
115
|
+
if (!isCommitlintPluginTenseInstalled) return [];
|
|
116
|
+
const { allowlist = [], ...tenseOptions } = options ?? {};
|
|
117
|
+
return [{
|
|
118
|
+
plugins: [COMMITLINT_PACKAGES.COMMITLINT_PLUGIN_TENSE],
|
|
119
|
+
rules: { "tense/subject-tense": [
|
|
120
|
+
2,
|
|
121
|
+
"always",
|
|
122
|
+
{
|
|
123
|
+
allowedTenses: ["present-imperative"],
|
|
124
|
+
firstOnly: true,
|
|
125
|
+
...tenseOptions,
|
|
126
|
+
allowlist: [...ALLOWLIST, ...allowlist]
|
|
127
|
+
}
|
|
128
|
+
] }
|
|
129
|
+
}];
|
|
130
|
+
};
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region ../src/js/commitlint/configs/index.ts
|
|
133
|
+
/**
|
|
134
|
+
* @internal @brnshkr/config/commitlint
|
|
135
|
+
*/
|
|
136
|
+
const configs = {
|
|
137
|
+
commit,
|
|
138
|
+
conventional,
|
|
139
|
+
functions,
|
|
140
|
+
tense
|
|
141
|
+
};
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region ../src/js/commitlint/utils/config.ts
|
|
144
|
+
/**
|
|
145
|
+
* @internal @brnshkr/config/commitlint
|
|
146
|
+
*/
|
|
147
|
+
const isValidGlobalAdditionalConfigKey = (key) => [
|
|
148
|
+
"extends",
|
|
149
|
+
"formatter",
|
|
150
|
+
"rules",
|
|
151
|
+
"parserPreset",
|
|
152
|
+
"ignores",
|
|
153
|
+
"defaultIgnores",
|
|
154
|
+
"plugins",
|
|
155
|
+
"helpUrl",
|
|
156
|
+
"prompt"
|
|
157
|
+
].includes(key);
|
|
158
|
+
const getGlobalAdditionalConfig = (options) => {
|
|
159
|
+
const config = {};
|
|
160
|
+
for (const [key, value] of objectEntries(options)) if (isValidGlobalAdditionalConfigKey(key)) config[key] = value;
|
|
161
|
+
if (objectKeys(config).length === 0) return;
|
|
162
|
+
return config;
|
|
163
|
+
};
|
|
164
|
+
const getUserConfigs = (resolvedOptions, additionalConfigs) => [getGlobalAdditionalConfig(resolvedOptions), ...additionalConfigs].filter(Boolean);
|
|
165
|
+
const includeConfigs = (config, configsToInclude) => {
|
|
166
|
+
for (const configToInclude of configsToInclude) {
|
|
167
|
+
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)])];
|
|
168
|
+
if (configToInclude.formatter !== void 0) config.formatter = configToInclude.formatter;
|
|
169
|
+
if (configToInclude.rules !== void 0) config.rules = {
|
|
170
|
+
...config.rules,
|
|
171
|
+
...configToInclude.rules
|
|
172
|
+
};
|
|
173
|
+
if (configToInclude.parserPreset !== void 0) config.parserPreset = configToInclude.parserPreset;
|
|
174
|
+
if (configToInclude.ignores !== void 0) config.ignores = [.../* @__PURE__ */ new Set([...config.ignores ?? [], ...configToInclude.ignores])];
|
|
175
|
+
if (configToInclude.defaultIgnores !== void 0) config.defaultIgnores = configToInclude.defaultIgnores;
|
|
176
|
+
if (configToInclude.plugins !== void 0) config.plugins = [.../* @__PURE__ */ new Set([...config.plugins ?? [], ...configToInclude.plugins])];
|
|
177
|
+
if (configToInclude.helpUrl !== void 0) config.helpUrl = configToInclude.helpUrl;
|
|
178
|
+
if (configToInclude.prompt !== void 0) config.prompt = {
|
|
179
|
+
...config.prompt,
|
|
180
|
+
...configToInclude.prompt
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region ../src/js/commitlint/index.ts
|
|
186
|
+
/**
|
|
187
|
+
* Build the `@brnshkr` commitlint config object.
|
|
188
|
+
*
|
|
189
|
+
* Every preset is optional and enabled only when it is installed, so a project gets the organization's rules
|
|
190
|
+
* whether or not it has the conventional preset.
|
|
191
|
+
*
|
|
192
|
+
* @api
|
|
193
|
+
*
|
|
194
|
+
* @param optionsAndGlobalConfig per-module toggles and global commitlint fields merged with the defaults
|
|
195
|
+
* @param additionalConfigs extra config entries merged after the built-in ones
|
|
196
|
+
*
|
|
197
|
+
* @returns final commitlint config ready to be consumed by commitlint
|
|
198
|
+
*
|
|
199
|
+
* @see https://github.com/brnshkr/config/blob/master/docs/js/commitlint.md
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```js
|
|
203
|
+
* import { getConfig } from '@brnshkr/config/commitlint';
|
|
204
|
+
*
|
|
205
|
+
* getConfig(undefined);
|
|
206
|
+
* getConfig({});
|
|
207
|
+
*
|
|
208
|
+
* getConfig({
|
|
209
|
+
* conventional: false,
|
|
210
|
+
* rules: { 'scope-min-length': [2, 'always', 3] },
|
|
211
|
+
* });
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
const getConfig = (optionsAndGlobalConfig, ...additionalConfigs) => {
|
|
215
|
+
const resolvedOptions = {
|
|
216
|
+
conventional: isModuleEnabledByDefault(MODULES.conventional),
|
|
217
|
+
functions: isModuleEnabledByDefault(MODULES.functions),
|
|
218
|
+
tense: isModuleEnabledByDefault(MODULES.tense),
|
|
219
|
+
...optionsAndGlobalConfig
|
|
220
|
+
};
|
|
221
|
+
setModuleEnabled(MODULES.conventional, resolvedOptions.conventional);
|
|
222
|
+
setModuleEnabled(MODULES.functions, resolvedOptions.functions);
|
|
223
|
+
setModuleEnabled(MODULES.tense, resolvedOptions.tense !== false);
|
|
224
|
+
const config = {};
|
|
225
|
+
includeConfigs(config, configs.commit());
|
|
226
|
+
if (isModuleEnabled(MODULES.conventional)) includeConfigs(config, configs.conventional());
|
|
227
|
+
if (isModuleEnabled(MODULES.functions)) includeConfigs(config, configs.functions());
|
|
228
|
+
if (isModuleEnabled(MODULES.tense)) includeConfigs(config, configs.tense(typeof resolvedOptions.tense === "object" ? resolvedOptions.tense : void 0));
|
|
229
|
+
includeConfigs(config, getUserConfigs(resolvedOptions, additionalConfigs));
|
|
230
|
+
return config;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Default-exported pre-built config for direct re-export from a commitlint config file.
|
|
234
|
+
*
|
|
235
|
+
* @api
|
|
236
|
+
*/
|
|
237
|
+
var commitlint_default = getConfig();
|
|
238
|
+
//#endregion
|
|
239
|
+
export { commitlint_default as default, getConfig };
|