@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.
Files changed (37) hide show
  1. package/README.md +174 -226
  2. package/conf/.gitignore.dist +15 -0
  3. package/conf/Makefile +3778 -0
  4. package/conf/Makefile.dist +13 -0
  5. package/conf/bunfig.dist.toml +5 -0
  6. package/conf/commitlint.dist.mjs +1 -0
  7. package/conf/editorconfig.dist +19 -0
  8. package/conf/launch.dist.json +31 -0
  9. package/conf/markdownlint.dist.mjs +1 -0
  10. package/conf/spelling/defaults.json +185 -0
  11. package/conf/tsconfig.dist.json +3 -0
  12. package/conf/tsconfig.json +31 -27
  13. package/conf/vitest.dist.mjs +1 -0
  14. package/conf/vscode-css-custom-data.dist.json +95 -0
  15. package/conf/vscode-extensions.dist.json +21 -0
  16. package/conf/vscode-settings.dist.jsonc +338 -0
  17. package/dist/commitlint/index.d.mts +72 -0
  18. package/dist/commitlint/index.mjs +239 -0
  19. package/dist/eslint/index.d.mts +3890 -1387
  20. package/dist/eslint/index.mjs +2662 -471
  21. package/dist/markdownlint/index.d.mts +2304 -0
  22. package/dist/markdownlint/index.mjs +440 -0
  23. package/dist/shared.mjs +406 -64
  24. package/dist/spelling/index.d.mts +30 -0
  25. package/dist/spelling/index.mjs +2 -0
  26. package/dist/spelling/spelling.test.d.mts +1 -0
  27. package/dist/spelling/spelling.test.mjs +12 -0
  28. package/dist/stylelint/index.d.mts +47 -9
  29. package/dist/stylelint/index.mjs +145 -47
  30. package/dist/vitest/index.d.mts +73 -0
  31. package/dist/vitest/index.mjs +181 -0
  32. package/package.json +192 -105
  33. package/conf/tsconfig.json.example +0 -3
  34. package/dist/scripts/eslint.mjs +0 -16
  35. package/dist/scripts/stylelint.mjs +0 -31
  36. /package/conf/{eslint.config.mjs.example → eslint.dist.mjs} +0 -0
  37. /package/conf/{stylelint.config.mjs.example → stylelint.dist.mjs} +0 -0
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  <h1 id="top">
2
2
  <a href="#top">
3
- <img src="https://raw.githubusercontent.com/brnshkr/brand/refs/heads/master/images/projects/config.png" alt="@brnshkr/config project logo" title="@brnshkr/config">
3
+ <img
4
+ src="https://raw.githubusercontent.com/brnshkr/brand/refs/heads/master/images/projects/config.png"
5
+ alt="@brnshkr/config project logo"
6
+ title="@brnshkr/config"
7
+ >
4
8
  </a>
5
9
 
6
10
  [![Semantic Versioning 2.0.0][semver-2.0.0-shield-url]][semver-2.0.0-url]
@@ -18,23 +22,25 @@ _[☄️ Bug Reports / Feature Requests »][issues-url]_
18
22
  <!-- omit in toc -->
19
23
  ## Table of Contents
20
24
 
21
- <!-- NOTICE: GitHub strips emojis in anchors, but multi-codepoint characters may leave invisible remnants, causing anchors to differ and require URL encoding. -->
25
+ <!--
26
+ NOTICE:
27
+ GitHub strips emojis in anchors, but multi-codepoint characters may leave invisible remnants,
28
+ causing anchors to differ and require URL encoding.
29
+ -->
22
30
  - [👋 About the Project](#-about-the-project)
31
+ - [📚 Documentation](#-documentation)
23
32
  - [☕ JS](#-js)
24
33
  - [🧰 Prerequisites](#-prerequisites)
25
34
  - [🚀 Installation](#-installation)
26
- - [✋ Manual](#-manual)
27
35
  - [🎨 Custom](#-custom)
28
36
  - [👀 Usage](#-usage)
29
- - [💻 Development](#-development)
37
+ - [🧩 Custom ESLint Rules](#-custom-eslint-rules)
30
38
  - [🐘 PHP](#-php)
31
39
  - [🧰 Prerequisites](#-prerequisites-1)
32
40
  - [🚀 Installation](#-installation-1)
33
- - [🤖 Automatic](#-automatic)
34
- - [✋ Manual](#-manual-1)
35
41
  - [🎨 Custom](#-custom-1)
36
42
  - [👀 Usage](#-usage-1)
37
- - [💻 Development](#-development-1)
43
+ - [🧩 Custom PHPStan Rules](#-custom-phpstan-rules)
38
44
  - [🔨 TODOs / Roadmap](#-todos--roadmap)
39
45
  - [❤️ Contributing](#️-contributing)
40
46
  - [💄 Commit Style](#-commit-style)
@@ -47,10 +53,22 @@ _[☄️ Bug Reports / Feature Requests »][issues-url]_
47
53
 
48
54
  ## 👋 About the Project
49
55
 
50
- **@brnshkr/config** is a centralized, opinionated collection of shared configuration files, tooling, and workflows for JavaScript and PHP projects. It helps standardizing linting, formatting, static analysis, and development workflows across repositories — reducing setup time, preventing config drift, and improving code quality and consistency.
56
+ **@brnshkr/config** is a centralized, opinionated collection of shared configuration files,
57
+ tooling, and workflows for JavaScript and PHP projects.
58
+ It helps standardizing linting, formatting, static analysis, and development workflows across repositories
59
+ — reducing setup time, preventing config drift, and improving code quality and consistency.
51
60
 
52
61
  > ❗ **Note** ❗
53
- > While you're more than welcome to use this in your own projects, the configurations are tailored specifically for the [@brnshkr][@brnshkr-organization-url] ecosystem and may not be a perfect fit elsewhere.
62
+ > While you're more than welcome to use this in your own projects, the configurations are tailored specifically
63
+ > for the [@brnshkr][@brnshkr-organization-url] ecosystem and may not be a perfect fit elsewhere.
64
+
65
+ <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
66
+
67
+ ## 📚 Documentation
68
+
69
+ This README covers installation and usage. The full reference — custom rules, config builders, the Composer plugin,
70
+ the shared [`Makefile`](https://github.com/brnshkr/config/blob/master/docs/Makefile.md), and the development setup
71
+ — lives in [`./docs`](https://github.com/brnshkr/config/blob/master/docs), organized by stack and tool.
54
72
 
55
73
  <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
56
74
 
@@ -58,7 +76,7 @@ _[☄️ Bug Reports / Feature Requests »][issues-url]_
58
76
 
59
77
  ### 🧰 Prerequisites
60
78
 
61
- - Node.js >= v24 or Bun >= v1.3 (Older versions may work, but are untested)
79
+ - Node.js >= v24.15 or Bun >= v1.4 (Older versions may work, but are untested)
62
80
  - Any JavaScript package manager (Bun, Yarn, PNPM, NPM)
63
81
 
64
82
  <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
@@ -93,71 +111,75 @@ pnpm add -D -E @brnshkr/config
93
111
  npm i -D -E @brnshkr/config
94
112
  ```
95
113
 
96
- This repository currently only provides one way to integrate configuration files (An automatic setup is planned, See [🔨 TODOs / Roadmap](#-todos--roadmap)):
114
+ Take a look at the `peerDependencies` in the [package.json](./package.json) file
115
+ and install the ones you need for the modules you want to use.
116
+ Copy the starter `Makefile` once, and let it write the rest:
97
117
 
98
- - [**Manual setup**](#-manual) by copying the example configuration files yourself
118
+ ```sh
119
+ cp -v ./node_modules/@brnshkr/config/conf/Makefile.dist ./Makefile \
120
+ && make startup
121
+ ```
122
+
123
+ `make startup` installs each stack, writes every config and `.gitignore` the project is missing, and never
124
+ touches a file that is already there.
99
125
 
100
126
  <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
101
127
 
102
- #### Manual
128
+ #### 🎨 Custom
103
129
 
104
- Take a look at the `peerDependencies` in the [package.json](./package.json) file and install the ones you need for the modules you want to use.
105
- You can then copy the specific configs to your project:
130
+ Take a look at the function signatures for exact details.
106
131
 
107
132
  <!-- omit in toc -->
108
- ##### TypeScript
133
+ ##### ESLint
109
134
 
110
- ```sh
111
- cp -v ./node_modules/@brnshkr/config/conf/tsconfig.json.example ./tsconfig.json
112
- ```
135
+ ```js
136
+ // ./conf/eslint.mjs
113
137
 
114
- <!-- omit in toc -->
115
- ##### ESLint
138
+ import { getConfig } from '@brnshkr/config/eslint';
116
139
 
117
- ```sh
118
- cp -v ./node_modules/@brnshkr/config/conf/eslint.config.mjs.example ./conf/eslint.config.mjs
140
+ export default getConfig(/* customize */);
119
141
  ```
120
142
 
121
143
  <!-- omit in toc -->
122
144
  ##### Stylelint
123
145
 
124
- ```sh
125
- cp -v ./node_modules/@brnshkr/config/conf/stylelint.config.mjs.example ./conf/stylelint.config.mjs
126
- ```
146
+ ```js
147
+ // ./conf/stylelint.mjs
127
148
 
128
- <!-- omit in toc -->
129
- ##### All
149
+ import { getConfig } from '@brnshkr/config/stylelint';
130
150
 
131
- ```sh
132
- cp -v ./node_modules/@brnshkr/config/conf/tsconfig.json.example ./tsconfig.json \
133
- && cp -v ./node_modules/@brnshkr/config/conf/eslint.config.mjs.example ./conf/eslint.config.mjs \
134
- && cp -v ./node_modules/@brnshkr/config/conf/stylelint.config.mjs.example ./conf/stylelint.config.mjs
151
+ export default getConfig(/* customize */);
135
152
  ```
136
153
 
137
- <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
154
+ <!-- omit in toc -->
155
+ ##### markdownlint
138
156
 
139
- #### 🎨 Custom
157
+ ```js
158
+ // ./conf/markdownlint.mjs
140
159
 
141
- Take a look at the function signatures for exact details.
160
+ import { getConfig } from '@brnshkr/config/markdownlint';
161
+
162
+ export default getConfig(/* customize */);
163
+ ```
142
164
 
143
165
  <!-- omit in toc -->
144
- ##### ESLint
166
+ ##### commitlint
145
167
 
146
168
  ```js
147
- // ./eslint.config.mjs
169
+ // ./conf/commitlint.mjs
148
170
 
149
- import { getConfig } from '@brnshkr/config/eslint';
171
+ import { getConfig } from '@brnshkr/config/commitlint';
150
172
 
151
173
  export default getConfig(/* customize */);
152
174
  ```
153
175
 
154
176
  <!-- omit in toc -->
155
- ##### Stylelint
177
+ ##### Vitest
156
178
 
157
179
  ```js
158
- // ./stylelint.config.mjs
180
+ // ./conf/vitest.mjs
159
181
 
160
- import { getConfig } from '@brnshkr/config/stylelint';
182
+ import { getConfig } from '@brnshkr/config/vitest';
161
183
 
162
184
  export default getConfig(/* customize */);
163
185
  ```
@@ -181,7 +203,7 @@ A few possible ways are listed below:
181
203
  Example call, adjust as needed
182
204
 
183
205
  ```sh
184
- bun eslint --config ./conf/eslint.config.mjs --cache --cache-location ./.cache/eslint.cache.json
206
+ bun eslint --config ./conf/eslint.mjs --cache --cache-location ./.cache/eslint.cache.json --max-warnings 0
185
207
  ```
186
208
 
187
209
  <!-- omit in toc -->
@@ -190,70 +212,95 @@ bun eslint --config ./conf/eslint.config.mjs --cache --cache-location ./.cache/e
190
212
  Example call, adjust as needed
191
213
 
192
214
  ```sh
193
- bun stylelint --config ./conf/stylelint.config.mjs --config-basedir ./ --cache --cache-location ./.cache/stylelint.cache.json **/*.{css,ejs,html,less,postcss,scss,svelte,svg,vue}
215
+ bun stylelint --config ./conf/stylelint.mjs --config-basedir ./ --cache --cache-location ./.cache/stylelint.cache.json --max-warnings 0 "**/*.{css,ejs,html,less,postcss,scss,svelte,svg,vue}"
194
216
  ```
195
217
 
196
218
  <!-- omit in toc -->
197
- ##### Option 2 — Run Helper Scripts (Bun Only, @brnshkr Convention)
219
+ ###### markdownlint
198
220
 
199
- For these scripts to work you need to follow the convention of putting your configuration files into the [`./conf`](./conf) directory (Exactly how it is done in this project as well).
221
+ Example call, adjust as needed
222
+
223
+ ```sh
224
+ bun markdownlint-cli2 --config ./conf/markdownlint.mjs "**/*.md"
225
+ ```
200
226
 
201
227
  <!-- omit in toc -->
202
- ###### ESLint (TypeScript Only)
228
+ ###### commitlint
203
229
 
204
- Expected configuration file: `./conf/eslint.config.ts`
230
+ Example call, adjust as needed
205
231
 
206
232
  ```sh
207
- bun ./node_modules/@brnshkr/config/dist/scripts/eslint.mjs
233
+ bun commitlint --config ./conf/commitlint.mjs --edit
208
234
  ```
209
235
 
210
236
  <!-- omit in toc -->
211
- ###### Stylelint
237
+ ##### Option 2 — Run Make Targets (@brnshkr Convention)
238
+
239
+ For these targets to work you need to follow the convention of putting your configuration files into the `./conf` directory
240
+ (Exactly how it is done in this project as well; see [`./conf`](https://github.com/brnshkr/config/blob/master/conf)).
212
241
 
213
- Expected configuration file: `./conf/stylelint.config.mjs`
242
+ Your own Makefile includes this one. Copy the starter rather than writing the include by hand: it guards the
243
+ include, so a fresh clone can `make bootstrap` before anything is installed.
214
244
 
215
245
  ```sh
216
- bun ./node_modules/@brnshkr/config/dist/scripts/stylelint.mjs
246
+ cp -v ./node_modules/@brnshkr/config/conf/Makefile.dist ./Makefile
217
247
  ```
218
248
 
249
+ A target appears once the tool it runs is installed, so `make help` lists what your repository actually has,
250
+ `make ci` runs all of it, and `make startup` writes any config you are still missing.
251
+ The full reference is [`docs/Makefile.md`](https://github.com/brnshkr/config/blob/master/docs/Makefile.md).
252
+
219
253
  <!-- omit in toc -->
220
- #### IDE Setup
254
+ ###### ESLint (TypeScript Only)
221
255
 
222
- When using the recommended way of putting config files into the `./conf` directory it might be neccesary to instruct your IDE to read these files correctly.
223
- If you need a VSCode setup and have the specific [`extensions`](https://github.com/brnshkr/config/blob/master/.vscode/extensions.json) installed you can take a look at the `Project specific` section in [`./.vscode/settings.json`](https://github.com/brnshkr/config/blob/master/.vscode/settings.json).
256
+ Expected configuration file: `./conf/eslint.mjs`
224
257
 
225
- <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
258
+ ```sh
259
+ make eslint
260
+ ```
226
261
 
227
- ### 💻 Development
262
+ <!-- omit in toc -->
263
+ ###### Stylelint
264
+
265
+ Expected configuration file: `./conf/stylelint.mjs`
266
+
267
+ ```sh
268
+ make stylelint
269
+ ```
228
270
 
229
271
  <!-- omit in toc -->
230
- #### Setup
272
+ ###### markdownlint
231
273
 
232
- Install dependencies and setup git hooks:
274
+ Expected configuration file: `./conf/markdownlint.mjs`
233
275
 
234
276
  ```sh
235
- bun install \
236
- && bun install-hooks
277
+ make markdownlint
237
278
  ```
238
279
 
239
280
  <!-- omit in toc -->
240
- #### Scripts
281
+ ###### commitlint
241
282
 
242
- We recommend using the scripts provided in the [package.json](./package.json) file as the primary way of running common tasks.
243
- Have a look yourself for a full list of available targets.
283
+ Expected configuration file: `./conf/commitlint.mjs`
284
+
285
+ ```sh
286
+ make commitlint
287
+ ```
244
288
 
245
289
  <!-- omit in toc -->
246
- ##### Common targets
290
+ #### IDE Setup
291
+
292
+ When using the recommended way of putting config files into the `./conf` directory
293
+ it might be necessary to instruct your IDE to read these files correctly.
294
+ If you need a VS Code setup and have the specific [`extensions`](https://github.com/brnshkr/config/blob/master/.vscode/extensions.json)
295
+ installed you can take a look at the `Project specific` section in [`./.vscode/settings.json`](https://github.com/brnshkr/config/blob/master/.vscode/settings.json).
296
+
297
+ <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
247
298
 
248
- Here are some frequently used examples:
299
+ ### 🧩 Custom ESLint Rules
249
300
 
250
- - `bun lint` Run ESLint, Stylelint and Commitlint
251
- - `bun inspect:eslint` Inspect ESLint configuration
252
- - `bun check` Run TypeScript checks, linters and Vitest
253
- - `bun run test` — Run Vitest test suite
254
- - `bun test-update` — Run Vitest test suite and update snapshots
255
- - `bun run build` — Build the project and generate types
256
- - `bun watch` — Build the project in watch mode
301
+ The default ESLint configuration ships a small `brnshkr` plugin that contributes a handful
302
+ of project-specific rules, all enabled out of the box. Each rule is documented with examples
303
+ in the [Custom ESLint Rules docs](https://github.com/brnshkr/config/blob/master/docs/js/eslint/rules/index.md).
257
304
 
258
305
  <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
259
306
 
@@ -278,105 +325,22 @@ Here are some frequently used examples:
278
325
  composer r --dev brnshkr/config
279
326
  ```
280
327
 
281
- This repository provides two ways to integrate configuration files and setup tools into your project:
282
-
283
- - [**Automatic setup**](#-automatic) via the Composer plugin
284
- - [**Manual setup**](#-manual-1) by copying the example configuration files yourself
285
-
286
- #### 🤖 Automatic
287
-
288
- If you allow this package to run as a Composer plugin (Composer will prompt you on first install), several helper commands become available.
289
- The most commonly used is the automatic setup command which installs packages for selected modules, copies example config files into your repository, and can optionally create a `Makefile` and/or a `.gitignore` file.
290
-
291
- Run the automatic setup with defaults:
292
-
293
- ```sh
294
- composer brnshkr:config:setup
295
- ```
296
-
297
- Run the automatic setup with all flags enabled:
298
-
299
- ```sh
300
- composer brnshkr:config:setup -gofacme
301
- ```
302
-
303
- Take a look at the [plugin commands](#plugin-commands) section to see a full list of available commands.
304
-
305
- <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
306
-
307
- #### ✋ Manual
308
-
309
- Take a look at the `suggest`ed packages in the [composer.json](./composer.json) file and install the ones you need for the modules you want to use.
310
- You can then copy the specific configs to your project:
311
-
312
- <!-- omit in toc -->
313
- ##### PHP CS Fixer
314
-
315
- ```sh
316
- cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php \
317
- && cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php.example \
318
- && cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.dist.php.example ./conf/php-cs-fixer.dist.php
319
- ```
320
-
321
- <!-- omit in toc -->
322
- ##### Rector
328
+ Take a look at the `suggest`ed packages in the [composer.json](./composer.json) file and install the ones
329
+ you need for the modules you want to use.
330
+ Copy the starter `Makefile` once, and let it write the rest:
323
331
 
324
332
  ```sh
325
- cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php \
326
- && cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php.example \
327
- && cp -v ./vendor/brnshkr/config/conf/rector.dist.php.example ./conf/rector.dist.php
333
+ cp -v ./vendor/brnshkr/config/conf/Makefile.dist ./Makefile \
334
+ && make startup
328
335
  ```
329
336
 
330
- <!-- omit in toc -->
331
- ##### PHPStan
337
+ `make startup` installs each stack, writes every config and `.gitignore` the project is missing, and never
338
+ touches a file that is already there.
332
339
 
333
- ```sh
334
- cp -v ./vendor/brnshkr/config/conf/phpstan.php.example ./conf/phpstan.php \
335
- && cp -v ./vendor/brnshkr/config/conf/phpstan.php.example ./conf/phpstan.php.example \
336
- && cp -v ./vendor/brnshkr/config/conf/phpstan.dist.php.example ./conf/phpstan.dist.php
337
- ```
338
-
339
- <!-- omit in toc -->
340
- ##### Twig CS Fixer
340
+ To have the packages installed for you, pick the modules interactively:
341
341
 
342
342
  ```sh
343
- cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php \
344
- && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php.example \
345
- && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.dist.php.example ./conf/twig-cs-fixer.dist.php
346
- ```
347
-
348
- <!-- omit in toc -->
349
- ##### Makefile
350
-
351
- ```sh
352
- cp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefile
353
- ```
354
-
355
- <!-- omit in toc -->
356
- ##### Gitignore
357
-
358
- ```sh
359
- cp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignore
360
- ```
361
-
362
- <!-- omit in toc -->
363
- ##### All
364
-
365
- ```sh
366
- cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php \
367
- && cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php.example \
368
- && cp -v ./vendor/brnshkr/config/conf/php-cs-fixer.dist.php.example ./conf/php-cs-fixer.dist.php \
369
- && cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php \
370
- && cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php.example \
371
- && cp -v ./vendor/brnshkr/config/conf/rector.dist.php.example ./conf/rector.dist.php \
372
- && cp -v ./vendor/brnshkr/config/conf/phpstan.php.example ./conf/phpstan.php \
373
- && cp -v ./vendor/brnshkr/config/conf/phpstan.php.example ./conf/phpstan.php.example \
374
- && cp -v ./vendor/brnshkr/config/conf/phpstan.dist.php.example ./conf/phpstan.dist.php \
375
- && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php \
376
- && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php.example \
377
- && cp -v ./vendor/brnshkr/config/conf/twig-cs-fixer.dist.php.example ./conf/twig-cs-fixer.dist.php \
378
- && cp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefile \
379
- && cp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignore
343
+ composer brnshkr:config:setup
380
344
  ```
381
345
 
382
346
  <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
@@ -389,9 +353,8 @@ Take a look at the function signatures for exact details.
389
353
  ##### PHP CS Fixer
390
354
 
391
355
  ```php
392
- // ./php-cs-fixer.dist.php
393
-
394
356
  <?php
357
+ // ./conf/php-cs-fixer.dist.php
395
358
 
396
359
  declare(strict_types=1);
397
360
 
@@ -404,9 +367,8 @@ return PhpCsFixer::getConfig(/* customize */);
404
367
  ##### Rector
405
368
 
406
369
  ```php
407
- // ./rector.dist.php
408
-
409
370
  <?php
371
+ // ./conf/rector.dist.php
410
372
 
411
373
  declare(strict_types=1);
412
374
 
@@ -419,9 +381,8 @@ return Rector::getConfig(/* customize */);
419
381
  ##### PHPStan
420
382
 
421
383
  ```php
422
- // ./phpstan.dist.php
423
-
424
384
  <?php
385
+ // ./conf/phpstan.dist.php
425
386
 
426
387
  declare(strict_types=1);
427
388
 
@@ -434,9 +395,8 @@ return PhpStan::getConfig(/* customize */);
434
395
  ##### Twig CS Fixer
435
396
 
436
397
  ```php
437
- // ./twig-cs-fixer.dist.php
438
-
439
398
  <?php
399
+ // ./conf/twig-cs-fixer.dist.php
440
400
 
441
401
  declare(strict_types=1);
442
402
 
@@ -495,16 +455,22 @@ php ./vendor/bin/twig-cs-fixer fix --config ./conf/twig-cs-fixer.php -v
495
455
  ```
496
456
 
497
457
  <!-- omit in toc -->
498
- ##### Option 2 — Run Helper Scripts (Make Only, @brnshkr Convention)
458
+ ##### Option 2 — Run Make Targets (@brnshkr Convention)
499
459
 
500
- For these scripts to work you need to follow the convention of putting your configuration files into the [`./conf`](./conf) directory (Exactly how it is done in this project as well).
460
+ For these targets to work you need to follow the convention of putting your configuration files into the `./conf` directory
461
+ (Exactly how it is done in this project as well; see [`./conf`](https://github.com/brnshkr/config/blob/master/conf)).
501
462
 
502
- Do not forget to setup your Makefile with this projects Makefile as a base:
463
+ Your own Makefile includes this one. Copy the shipped starter rather than writing the include by hand:
464
+ it guards the include, so a fresh clone can `make bootstrap` before anything is installed.
503
465
 
504
- ```Makefile
505
- include ./vendor/brnshkr/config/conf/Makefile
466
+ ```sh
467
+ cp -v ./vendor/brnshkr/config/conf/Makefile.dist ./Makefile
506
468
  ```
507
469
 
470
+ A target appears once the tool it runs is installed, so `make help` lists what your repository actually has,
471
+ `make ci` runs all of it, and `make startup` writes any config you are still missing.
472
+ The full reference is [`docs/Makefile.md`](https://github.com/brnshkr/config/blob/master/docs/Makefile.md).
473
+
508
474
  <!-- omit in toc -->
509
475
  ###### PHP CS Fixer
510
476
 
@@ -544,8 +510,10 @@ make twig-cs-fixer
544
510
  <!-- omit in toc -->
545
511
  #### IDE Setup
546
512
 
547
- When using the recommended way of putting config files into the `./conf` directory it might be neccesary to instruct your IDE to read these files correctly.
548
- If you need a VSCode setup and have the specific [`extensions`](https://github.com/brnshkr/config/blob/master/.vscode/extensions.json) installed you can take a look at the `Project specific` section in [`./.vscode/settings.json`](https://github.com/brnshkr/config/blob/master/.vscode/settings.json).
513
+ When using the recommended way of putting config files into the `./conf` directory
514
+ it might be necessary to instruct your IDE to read these files correctly.
515
+ If you need a VS Code setup and have the specific [`extensions`](https://github.com/brnshkr/config/blob/master/.vscode/extensions.json)
516
+ installed you can take a look at the `Project specific` section in [`./.vscode/settings.json`](https://github.com/brnshkr/config/blob/master/.vscode/settings.json).
549
517
 
550
518
  <!-- omit in toc -->
551
519
  #### Plugin Commands
@@ -556,54 +524,24 @@ For full usage run `composer help <command>`, `composer <command> --help` or `co
556
524
  | Command | Alias | Description |
557
525
  | --- | --- | --- |
558
526
  | `brnshkr:config` | `b:c` | Displays the plugin overview and a list of available commands. Useful to quickly discover what the plugin exposes. |
559
- | `brnshkr:config:setup [<modules>...]` | `b:c:s` | Interactive setup helper: installs suggested packages for modules, copies example config files, and can create a `Makefile` and/or a `.gitignore` file. |
560
527
  | `brnshkr:config:update-php-extensions` | `b:c:upe` | Scans installed packages and updates `composer.json` with required `ext-*` platform packages. |
561
528
  | `brnshkr:config:extract-phar <package>` | `b:c:ep` | Extracts a `.phar` file from a given vendor package. |
562
529
 
563
530
  <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
564
531
 
565
- ### 💻 Development
566
-
567
- <!-- omit in toc -->
568
- #### Setup
569
-
570
- Install dependencies and setup project tooling with the following commands and adjust as needed:
571
-
572
- ```sh
573
- composer install \
574
- && cp -v ./conf/php-cs-fixer.php.example ./conf/php-cs-fixer.php \
575
- && cp -v ./conf/rector.php.example ./conf/rector.php \
576
- && cp -v ./conf/phpstan.php.example ./conf/phpstan.php \
577
- && cp -v ./conf/twig-cs-fixer.php.example ./conf/twig-cs-fixer.php
578
- ```
579
-
580
- <!-- omit in toc -->
581
- #### Make
582
-
583
- We recommend using [GNU Make][make-url] as the primary task runner.
584
- See [the Makefile](./conf/Makefile) for a full list of available targets.
585
- You can also run `make help` or simply `make` to view all targets with brief descriptions.
586
-
587
- If you need local overrides, create a `./.local/Makefile` — the main Makefile automatically includes it if present.
588
-
589
- <!-- omit in toc -->
590
- ##### Common targets
532
+ ### 🧩 Custom PHPStan Rules
591
533
 
592
- Here are some frequently used examples (see `make help` for the complete list):
534
+ Beyond the upstream rule set, the default configuration ships a number of custom PHPStan rules in two flavors.
535
+ **Standalone rules** are general-purpose checks enabled out of the box,
536
+ while **architecture presets** are opinionated bundles of class-placement and isolation rules tailored to a
537
+ specific framework or architecture style — opt-in and configured through `setArchitecture()`.
538
+ Both are documented with examples in the [Custom PHPStan Rules docs](https://github.com/brnshkr/config/blob/master/docs/php/phpstan/rules/index.md).
593
539
 
594
- - `make help` Show available targets and usage
595
- - `make rector` — Run Rector to apply automated PHP refactorings
596
- - `make php-cs-fixer` — Run PHP-CS-Fixer to format and fix coding-style issues
597
- - `make phpstan` — Run PHPStan static analysis
598
- - `make test` — Run PHPUnit test suite
599
- - `make test-update` — Run PHPUnit test suite and update snapshots
600
- - `make check` — Run Rector, PHP-CS-Fixer, Twig-CS-Fixer, PHPStan and PHPUnit
540
+ <p align="right"><a href="#top" title="Back to top">&nbsp;&nbsp;&nbsp;⬆&nbsp;&nbsp;&nbsp;</a></p>
601
541
 
602
542
  ## 🔨 TODOs / Roadmap
603
543
 
604
- - Add setup command for JS package (like `composer brnshkr:config:setup`)
605
- - Expand [`⚙️ Worflows`](#️-workflows) section in readme
606
- - Write sections about custom PHPStan and ESLint rules
544
+ - Expand [`⚙️ Workflows`](#️-workflows) section in readme
607
545
  - Add Vue support
608
546
  - Add React support
609
547
  - Add Tailwind support via <https://github.com/schoero/eslint-plugin-better-tailwindcss>
@@ -615,9 +553,11 @@ Any help is always greatly appreciated 🙂
615
553
 
616
554
  ## ❤️ Contributing
617
555
 
618
- Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
556
+ Contributions are what make the open source community such an amazing place to learn, inspire, and create.
557
+ Any contributions you make are **greatly appreciated**.
619
558
 
620
- If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
559
+ If you have a suggestion that would make this better, please fork the repo and create a pull request.
560
+ You can also simply open an issue with the tag "enhancement".
621
561
  Don't forget to give the project a star! Thanks again!
622
562
 
623
563
  1. Fork the project
@@ -626,13 +566,17 @@ Don't forget to give the project a star! Thanks again!
626
566
  4. Push to the branch => `git push origin feature/my-new-feature`
627
567
  5. Open a pull request
628
568
 
569
+ New to the codebase?
570
+ The [Development docs](https://github.com/brnshkr/config/blob/master/docs/development.md)
571
+ cover environment setup and the day-to-day commands for both stacks.
572
+
629
573
  ### 💄 Commit Style
630
574
 
631
575
  This project mostly follows the [Conventional Commits](https://www.conventionalcommits.org) specification.
632
576
  There are only a few differences. The main one is that the scope is required:
633
577
  So **instead of** this commit message signature: `<type>[optional scope]: <description>`
634
578
  You **should use** this one: `<type><scope>: <description>`
635
- Further details can be found in the [Commitlint configuration](https://github.com/brnshkr/config/blob/master/conf/commitlint.config.mjs).
579
+ Further details can be found in the [commitlint configuration](https://github.com/brnshkr/config/blob/master/conf/commitlint.mjs).
636
580
 
637
581
  ### ⚙️ Workflows
638
582
 
@@ -643,10 +587,15 @@ See [./.github/workflows](https://github.com/brnshkr/config/blob/master/.github/
643
587
  ## 🔖 Versioning
644
588
 
645
589
  This project follows [Semantic Versioning 2.0.0][semver-2.0.0-url].
646
- The NPM and Composer packages are versioned in sync, so a version change does not necessarily indicate a change in a specific package.
590
+ The NPM and Composer packages are versioned in sync,
591
+ so a version change does not necessarily indicate a change in a specific package.
647
592
 
648
593
  > ❗ **Note** ❗
649
- > Since changes to rules and dependencies are not considered breaking, even a patch release may introduce new errors in code that hasn't changed and break your CI without notice. We therefore strongly recommend pinning to an exact version (`-E` for the JS package managers, `composer r --dev brnshkr/config:X.Y.Z` for Composer) so updates stay opt-in and can be applied on your own schedule.
594
+ > Since changes to rules and dependencies are not considered breaking,
595
+ > even a patch release may introduce new errors in code that hasn't changed and break your CI without notice.
596
+ > We therefore strongly recommend pinning to an exact version
597
+ > (`-E` for the JS package managers, `composer r --dev brnshkr/config:X.Y.Z` for Composer)
598
+ > so updates stay opt-in and can be applied on your own schedule.
650
599
 
651
600
  <!-- omit in toc -->
652
601
  ### Changes Considered as Breaking Changes
@@ -673,8 +622,9 @@ Distributed under the MIT License. See [LICENSE](./LICENSE) for more information
673
622
 
674
623
  - [TypeScript](https://www.typescriptlang.org)
675
624
  - [ESLint](https://github.com/eslint/eslint)
625
+ - [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2)
676
626
  - [Stylelint](https://github.com/stylelint/stylelint)
677
- - [Commitlint](https://github.com/conventional-changelog/commitlint)
627
+ - [commitlint](https://github.com/conventional-changelog/commitlint)
678
628
  - [@antfu/eslint-config](https://github.com/antfu/eslint-config)
679
629
  - [PHP](https://www.php.net)
680
630
  - [PHPStan](https://github.com/phpstan/phpstan)
@@ -682,7 +632,7 @@ Distributed under the MIT License. See [LICENSE](./LICENSE) for more information
682
632
  - [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer)
683
633
  - [Twig-CS-Fixer](https://github.com/VincentLanglet/Twig-CS-Fixer)
684
634
  - [GNU Make](https://www.gnu.org/software/make)
685
- - [Best-README-Template](https://github.com/othneildrew/Best-README-Template) by [othneildrew](https://github.com/othneildrew)
635
+ - [Best-README-Template](https://github.com/othneildrew/Best-README-Template)
686
636
  - [Choose an Open Source License](https://choosealicense.com)
687
637
  - [Shields.io](https://shields.io)
688
638
  - <a href="https://github.com/brnshkr">
@@ -699,8 +649,6 @@ Distributed under the MIT License. See [LICENSE](./LICENSE) for more information
699
649
 
700
650
  [@brnshkr-organization-url]: https://github.com/brnshkr
701
651
 
702
- [make-url]: https://www.gnu.org/software/make
703
-
704
652
  [semver-2.0.0-url]: https://semver.org/#semantic-versioning-200
705
653
  [semver-2.0.0-shield-url]: https://img.shields.io/badge/semver-2.0.0-blue?label=🔖%20semver&style=flat-square&labelColor=%237f399d&color=%23a5097e
706
654