@brnshkr/config 0.0.1-alpha.2
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/LICENSE +21 -0
- package/README.md +659 -0
- package/conf/eslint.config.mjs.example +1 -0
- package/conf/stylelint.config.mjs.example +1 -0
- package/conf/tsconfig.json +74 -0
- package/conf/tsconfig.json.example +3 -0
- package/dist/eslint/index.d.mts +15518 -0
- package/dist/eslint/index.mjs +2574 -0
- package/dist/scripts/eslint.mjs +18 -0
- package/dist/scripts/stylelint.mjs +31 -0
- package/dist/shared.mjs +394 -0
- package/dist/stylelint/index.d.mts +97 -0
- package/dist/stylelint/index.mjs +402 -0
- package/package.json +289 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Patrick Rupp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,659 @@
|
|
|
1
|
+
<h1 id="top">
|
|
2
|
+
<a href="#top">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/brnshkr/config/refs/heads/master/.github/images/project-logo.png" alt="@brnshkr/config project logo" title="@brnshkr/config">
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
[![Semantic Versioning 2.0.0][semver-2.0.0-shield-url]][semver-2.0.0-url]
|
|
7
|
+
[![MIT License][license-shield-url]][license-url]
|
|
8
|
+
[![Stars][stars-shield-url]][stars-url]
|
|
9
|
+
[![Forks][forks-shield-url]][forks-url]
|
|
10
|
+
[![Issues][issues-shield-url]][issues-url]
|
|
11
|
+
</h1>
|
|
12
|
+
|
|
13
|
+
Centralized collection of configuration and tooling used across all [@brnshkr][@brnshkr-organization-url] projects.
|
|
14
|
+
|
|
15
|
+
_[☄️ Bug Reports / Feature Requests »][issues-url]_
|
|
16
|
+
|
|
17
|
+
<!-- omit in toc -->
|
|
18
|
+
## Table of Contents
|
|
19
|
+
|
|
20
|
+
<!-- NOTICE: All anchors must not include the emoji to work on github, the ❤️ and ⚙️ for some reason must be url encoded though -->
|
|
21
|
+
- [👋 About the Project](#-about-the-project)
|
|
22
|
+
- [☕ JS](#-js)
|
|
23
|
+
- [🧰 Prerequisites](#-prerequisites)
|
|
24
|
+
- [🚀 Installation](#-installation)
|
|
25
|
+
- [✋ Manual](#-manual)
|
|
26
|
+
- [🎨 Custom](#-custom)
|
|
27
|
+
- [👀 Usage](#-usage)
|
|
28
|
+
- [💻 Development](#-development)
|
|
29
|
+
- [🐘 PHP](#-php)
|
|
30
|
+
- [🧰 Prerequisites](#-prerequisites-1)
|
|
31
|
+
- [🚀 Installation](#-installation-1)
|
|
32
|
+
- [🤖 Automatic](#-automatic)
|
|
33
|
+
- [✋ Manual](#-manual-1)
|
|
34
|
+
- [🎨 Custom](#-custom-1)
|
|
35
|
+
- [👀 Usage](#-usage-1)
|
|
36
|
+
- [💻 Development](#-development-1)
|
|
37
|
+
- [🔨 TODOs / Roadmap](#-todos--roadmap)
|
|
38
|
+
- [❤️ Contributing](#️-contributing)
|
|
39
|
+
- [💄 Commit Style](#-commit-style)
|
|
40
|
+
- [⚙️ Workflows](#️-workflows)
|
|
41
|
+
- [🔖 Versioning](#-versioning)
|
|
42
|
+
- [📃 License](#-license)
|
|
43
|
+
- [🌐 Acknowledgments](#-acknowledgments)
|
|
44
|
+
|
|
45
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
46
|
+
|
|
47
|
+
## 👋 About the Project
|
|
48
|
+
|
|
49
|
+
**@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.
|
|
50
|
+
|
|
51
|
+
> ❗ **Note** ❗
|
|
52
|
+
> 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.
|
|
53
|
+
|
|
54
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
55
|
+
|
|
56
|
+
## ☕ JS
|
|
57
|
+
|
|
58
|
+
### 🧰 Prerequisites
|
|
59
|
+
|
|
60
|
+
- Node.js >= v24 or Bun >= 1.3 (Older versions may work, but are untested)
|
|
61
|
+
- Any JavaScript package manager (Bun, Yarn, PNPM, NPM)
|
|
62
|
+
|
|
63
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
64
|
+
|
|
65
|
+
### 🚀 Installation
|
|
66
|
+
|
|
67
|
+
<!-- omit in toc -->
|
|
68
|
+
#### Bun
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
bun a -D @brnshkr/config
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
<!-- omit in toc -->
|
|
75
|
+
#### Yarn
|
|
76
|
+
|
|
77
|
+
```sh
|
|
78
|
+
yarn add -D @brnshkr/config
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
<!-- omit in toc -->
|
|
82
|
+
#### PNPM
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
pnpm add -D @brnshkr/config
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
<!-- omit in toc -->
|
|
89
|
+
#### NPM
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
npm i -D @brnshkr/config
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This repository currently only provides one way to integrate configuration files (An automatic setup is planned, See [🔨 TODOs / Roadmap](#-todos--roadmap)):
|
|
96
|
+
|
|
97
|
+
- [**Manual setup**](#-manual) by copying the example configuration files yourself
|
|
98
|
+
|
|
99
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
100
|
+
|
|
101
|
+
#### ✋ Manual
|
|
102
|
+
|
|
103
|
+
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.
|
|
104
|
+
You can then copy the specific configs to your project:
|
|
105
|
+
|
|
106
|
+
<!-- omit in toc -->
|
|
107
|
+
##### TypeScript
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
cp -v ./node_modules/@brnshkr/config/conf/tsconfig.json.example ./tsconfig.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
<!-- omit in toc -->
|
|
114
|
+
##### ESLint
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
cp -v ./node_modules/@brnshkr/config/conf/eslint.config.mjs.example ./conf/eslint.config.mjs
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
<!-- omit in toc -->
|
|
121
|
+
##### Stylelint
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
cp -v ./node_modules/@brnshkr/config/conf/stylelint.config.mjs.example ./conf/stylelint.config.mjs
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
<!-- omit in toc -->
|
|
128
|
+
##### All
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
cp -v ./node_modules/@brnshkr/config/conf/tsconfig.json.example ./tsconfig.json \
|
|
132
|
+
&& cp -v ./node_modules/@brnshkr/config/conf/eslint.config.mjs.example ./conf/eslint.config.mjs \
|
|
133
|
+
&& cp -v ./node_modules/@brnshkr/config/conf/stylelint.config.mjs.example ./conf/stylelint.config.mjs
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
137
|
+
|
|
138
|
+
#### 🎨 Custom
|
|
139
|
+
|
|
140
|
+
Take a look at the function signatures for exact details.
|
|
141
|
+
|
|
142
|
+
<!-- omit in toc -->
|
|
143
|
+
##### ESLint
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
// ./eslint.config.mjs
|
|
147
|
+
|
|
148
|
+
import { getConfig } from '@brnshkr/config/eslint';
|
|
149
|
+
|
|
150
|
+
export default getConfig(/* customize */);
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
<!-- omit in toc -->
|
|
154
|
+
##### Stylelint
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
// ./stylelint.config.mjs
|
|
158
|
+
|
|
159
|
+
import { getConfig } from '@brnshkr/config/stylelint';
|
|
160
|
+
|
|
161
|
+
export default getConfig(/* customize */);
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
165
|
+
|
|
166
|
+
### 👀 Usage
|
|
167
|
+
|
|
168
|
+
<!-- omit in toc -->
|
|
169
|
+
#### Run Tooling
|
|
170
|
+
|
|
171
|
+
This package provides **configurations**, not a hard requirement on _how_ you run tools.
|
|
172
|
+
A few possible ways are listed below:
|
|
173
|
+
|
|
174
|
+
<!-- omit in toc -->
|
|
175
|
+
##### Option 1 — Run Tools Directly (Most Flexible)
|
|
176
|
+
|
|
177
|
+
<!-- omit in toc -->
|
|
178
|
+
###### ESLint
|
|
179
|
+
|
|
180
|
+
Example call, adjust as needed
|
|
181
|
+
|
|
182
|
+
```sh
|
|
183
|
+
bun eslint --config ./conf/eslint.config.ts --cache --cache-location ./.cache/eslint.cache.json
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
<!-- omit in toc -->
|
|
187
|
+
###### Stylelint
|
|
188
|
+
|
|
189
|
+
Example call, adjust as needed
|
|
190
|
+
|
|
191
|
+
```sh
|
|
192
|
+
bun stylelint --config ./conf/stylelint.config.mjs --cache --cache-location ./.cache/stylelint.cache.json **/*.{css,ejs,html,less,postcss,scss,svelte,svg,vue}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
<!-- omit in toc -->
|
|
196
|
+
##### Option 2 — Run Helper Scripts (Bun Only, @brnshkr Convention)
|
|
197
|
+
|
|
198
|
+
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).
|
|
199
|
+
|
|
200
|
+
<!-- omit in toc -->
|
|
201
|
+
###### ESLint (TypeScript Only)
|
|
202
|
+
|
|
203
|
+
Expected configuration file: `./conf/eslint.config.ts`
|
|
204
|
+
|
|
205
|
+
```sh
|
|
206
|
+
bun ./node_modules/@brnshkr/config/dist/scripts/eslint.mjs
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
<!-- omit in toc -->
|
|
210
|
+
###### Stylelint
|
|
211
|
+
|
|
212
|
+
Expected configuration file: `./conf/stylelint.config.mjs`
|
|
213
|
+
|
|
214
|
+
```sh
|
|
215
|
+
bun ./node_modules/@brnshkr/config/dist/scripts/stylelint.mjs
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
<!-- omit in toc -->
|
|
219
|
+
#### IDE Setup
|
|
220
|
+
|
|
221
|
+
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.
|
|
222
|
+
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).
|
|
223
|
+
|
|
224
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
225
|
+
|
|
226
|
+
### 💻 Development
|
|
227
|
+
|
|
228
|
+
<!-- omit in toc -->
|
|
229
|
+
#### Setup
|
|
230
|
+
|
|
231
|
+
Install dependencies and setup git hooks:
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
bun install \
|
|
235
|
+
&& bun install-hooks
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
<!-- omit in toc -->
|
|
239
|
+
#### Scripts
|
|
240
|
+
|
|
241
|
+
We recommend using the scripts provided in the [package.json](./package.json) file as the primary way of running common tasks.
|
|
242
|
+
Have a look yourself for a full list of available targets.
|
|
243
|
+
|
|
244
|
+
<!-- omit in toc -->
|
|
245
|
+
##### Common targets
|
|
246
|
+
|
|
247
|
+
Here are some frequently used examples:
|
|
248
|
+
|
|
249
|
+
- `bun lint` — Run ESLint, Stylelint and Commitlint
|
|
250
|
+
- `bun inspect:eslint` — Inspect ESLint configuration
|
|
251
|
+
- `bun check` — Run TypeScript checks, linters and Vitest
|
|
252
|
+
- `bun run test` — Run Vitest test suite
|
|
253
|
+
- `bun test-update` — Run Vitest test suite and update snapshots
|
|
254
|
+
- `bun run build` — Build the project and generate types
|
|
255
|
+
- `bun watch` — Build the project in watch mode
|
|
256
|
+
|
|
257
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
258
|
+
|
|
259
|
+
## 🐘 PHP
|
|
260
|
+
|
|
261
|
+
### 🧰 Prerequisites
|
|
262
|
+
|
|
263
|
+
- PHP >= 8.5 (Older versions may work, but are untested)
|
|
264
|
+
- Composer >= 2.9 (Older versions may work, but are untested)
|
|
265
|
+
- PHP Extensions:
|
|
266
|
+
- `json`
|
|
267
|
+
- `mbstring`
|
|
268
|
+
|
|
269
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
270
|
+
|
|
271
|
+
### 🚀 Installation
|
|
272
|
+
|
|
273
|
+
<!-- omit in toc -->
|
|
274
|
+
#### Composer
|
|
275
|
+
|
|
276
|
+
```sh
|
|
277
|
+
composer req --dev brnshkr/config
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
This repository provides two ways to integrate configuration files and setup tools into your project:
|
|
281
|
+
|
|
282
|
+
- [**Automatic setup**](#-automatic) via the Composer plugin
|
|
283
|
+
- [**Manual setup**](#-manual-1) by copying the example configuration files yourself
|
|
284
|
+
|
|
285
|
+
#### 🤖 Automatic
|
|
286
|
+
|
|
287
|
+
If you allow this package to run as a Composer plugin (Composer will prompt you on first install), several helper commands become available.
|
|
288
|
+
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.
|
|
289
|
+
|
|
290
|
+
Run the automatic setup with defaults:
|
|
291
|
+
|
|
292
|
+
```sh
|
|
293
|
+
composer brnshkr:config:setup
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Run the automatic setup with all flags enabled:
|
|
297
|
+
|
|
298
|
+
```sh
|
|
299
|
+
composer brnshkr:config:setup -gofacme
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Take a look at the [plugin commands](#plugin-commands) section to see a full list of available commands.
|
|
303
|
+
|
|
304
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
305
|
+
|
|
306
|
+
#### ✋ Manual
|
|
307
|
+
|
|
308
|
+
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.
|
|
309
|
+
You can then copy the specific configs to your project:
|
|
310
|
+
|
|
311
|
+
<!-- omit in toc -->
|
|
312
|
+
##### PHP CS Fixer
|
|
313
|
+
|
|
314
|
+
```sh
|
|
315
|
+
cp -v ./vendor/brnshkr/config/conf/.php-cs-fixer.php.example ./conf/.php-cs-fixer.php \
|
|
316
|
+
&& cp -v ./vendor/brnshkr/config/conf/.php-cs-fixer.dist.php.example ./conf/.php-cs-fixer.dist.php
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
<!-- omit in toc -->
|
|
320
|
+
##### Rector
|
|
321
|
+
|
|
322
|
+
```sh
|
|
323
|
+
cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php \
|
|
324
|
+
&& cp -v ./vendor/brnshkr/config/conf/rector.dist.php.example ./conf/rector.dist.php
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
<!-- omit in toc -->
|
|
328
|
+
##### PHPStan
|
|
329
|
+
|
|
330
|
+
```sh
|
|
331
|
+
cp -v ./vendor/brnshkr/config/conf/phpstan.neon.example ./conf/phpstan.neon \
|
|
332
|
+
&& cp -v ./vendor/brnshkr/config/conf/phpstan.dist.neon.example ./conf/phpstan.dist.neon
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
<!-- omit in toc -->
|
|
336
|
+
##### Makefile
|
|
337
|
+
|
|
338
|
+
```sh
|
|
339
|
+
cp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefile
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
<!-- omit in toc -->
|
|
343
|
+
##### Gitignore
|
|
344
|
+
|
|
345
|
+
```sh
|
|
346
|
+
cp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignore
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
<!-- omit in toc -->
|
|
350
|
+
##### All
|
|
351
|
+
|
|
352
|
+
```sh
|
|
353
|
+
cp -v ./vendor/brnshkr/config/conf/.php-cs-fixer.php.example ./conf/.php-cs-fixer.php \
|
|
354
|
+
&& cp -v ./vendor/brnshkr/config/conf/.php-cs-fixer.dist.php.example ./conf/.php-cs-fixer.dist.php \
|
|
355
|
+
&& cp -v ./vendor/brnshkr/config/conf/rector.php.example ./conf/rector.php \
|
|
356
|
+
&& cp -v ./vendor/brnshkr/config/conf/rector.dist.php.example ./conf/rector.dist.php \
|
|
357
|
+
&& cp -v ./vendor/brnshkr/config/conf/phpstan.neon.example ./conf/phpstan.neon \
|
|
358
|
+
&& cp -v ./vendor/brnshkr/config/conf/phpstan.dist.neon.example ./conf/phpstan.dist.neon \
|
|
359
|
+
&& cp -v ./vendor/brnshkr/config/conf/Makefile.example ./Makefile \
|
|
360
|
+
&& cp -v ./vendor/brnshkr/config/conf/.gitignore.example ./.gitignore
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
364
|
+
|
|
365
|
+
#### 🎨 Custom
|
|
366
|
+
|
|
367
|
+
Take a look at the function signatures for exact details.
|
|
368
|
+
|
|
369
|
+
<!-- omit in toc -->
|
|
370
|
+
##### PHP CS Fixer
|
|
371
|
+
|
|
372
|
+
```php
|
|
373
|
+
// ./.php-cs-fixer.dist.php
|
|
374
|
+
|
|
375
|
+
<?php
|
|
376
|
+
|
|
377
|
+
declare(strict_types=1);
|
|
378
|
+
|
|
379
|
+
use Brnshkr\Config\PhpCsFixerConfig;
|
|
380
|
+
|
|
381
|
+
return PhpCsFixerConfig::get(/* customize */);
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
<!-- omit in toc -->
|
|
385
|
+
##### Rector
|
|
386
|
+
|
|
387
|
+
```php
|
|
388
|
+
// ./rector.php
|
|
389
|
+
|
|
390
|
+
<?php
|
|
391
|
+
|
|
392
|
+
declare(strict_types=1);
|
|
393
|
+
|
|
394
|
+
use Brnshkr\Config\RectorConfig;
|
|
395
|
+
|
|
396
|
+
return RectorConfig::get(/* customize */);
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
<!-- omit in toc -->
|
|
400
|
+
##### PHPStan
|
|
401
|
+
|
|
402
|
+
```yaml
|
|
403
|
+
# phpstan.dist.neon
|
|
404
|
+
|
|
405
|
+
includes:
|
|
406
|
+
- '%currentWorkingDirectory%/vendor/brnshkr/config/conf/phpstan.dist.neon'
|
|
407
|
+
|
|
408
|
+
# customize
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
412
|
+
|
|
413
|
+
### 👀 Usage
|
|
414
|
+
|
|
415
|
+
<!-- omit in toc -->
|
|
416
|
+
#### Run Tooling
|
|
417
|
+
|
|
418
|
+
This package provides **configurations**, not a hard requirement on _how_ you run tools.
|
|
419
|
+
A few possible ways are listed below:
|
|
420
|
+
|
|
421
|
+
<!-- omit in toc -->
|
|
422
|
+
##### Option 1 — Run Tools Directly (Most Flexible)
|
|
423
|
+
|
|
424
|
+
<!-- omit in toc -->
|
|
425
|
+
###### PHP CS Fixer
|
|
426
|
+
|
|
427
|
+
Example call, adjust as needed
|
|
428
|
+
|
|
429
|
+
```sh
|
|
430
|
+
php ./vendor/bin/php-cs-fixer fix -v --show-progress=dots --config ./conf/.php-cs-fixer.php
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
<!-- omit in toc -->
|
|
434
|
+
###### Rector
|
|
435
|
+
|
|
436
|
+
Example call, adjust as needed
|
|
437
|
+
|
|
438
|
+
```sh
|
|
439
|
+
php ./vendor/bin/rector process --config ./conf/rector.php
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
<!-- omit in toc -->
|
|
443
|
+
###### PHPStan
|
|
444
|
+
|
|
445
|
+
Example call, adjust as needed
|
|
446
|
+
|
|
447
|
+
```sh
|
|
448
|
+
php ./vendor/bin/phpstan analyze --memory-limit=-1 --configuration ./conf/phpstan.neon
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
<!-- omit in toc -->
|
|
452
|
+
##### Option 2 — Run Helper Scripts (Make Only, @brnshkr Convention)
|
|
453
|
+
|
|
454
|
+
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).
|
|
455
|
+
|
|
456
|
+
Do not forget to setup your Makefile with this projects Makefile as a base:
|
|
457
|
+
|
|
458
|
+
```Makefile
|
|
459
|
+
include ./vendor/brnshkr/config/conf/Makefile
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
<!-- omit in toc -->
|
|
463
|
+
###### PHP CS Fixer
|
|
464
|
+
|
|
465
|
+
Expected configuration file: `./conf/.php-cs-fixer.php`
|
|
466
|
+
|
|
467
|
+
```sh
|
|
468
|
+
make php-cs-fixer
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
<!-- omit in toc -->
|
|
472
|
+
###### Rector
|
|
473
|
+
|
|
474
|
+
Expected configuration file: `./conf/rector.php`
|
|
475
|
+
|
|
476
|
+
```sh
|
|
477
|
+
make rector
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
<!-- omit in toc -->
|
|
481
|
+
###### PHPStan
|
|
482
|
+
|
|
483
|
+
Expected configuration file: `./conf/phpstan.neon`
|
|
484
|
+
|
|
485
|
+
```sh
|
|
486
|
+
make phpstan
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
<!-- omit in toc -->
|
|
490
|
+
#### IDE Setup
|
|
491
|
+
|
|
492
|
+
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.
|
|
493
|
+
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).
|
|
494
|
+
|
|
495
|
+
<!-- omit in toc -->
|
|
496
|
+
#### Plugin Commands
|
|
497
|
+
|
|
498
|
+
Overview of all commands provided by the composer plugin.
|
|
499
|
+
For full usage run `composer help <command>`, `composer <command> --help` or `composer <command> -h`.
|
|
500
|
+
|
|
501
|
+
| Command | Alias | Description |
|
|
502
|
+
| --- | --- | --- |
|
|
503
|
+
| `brnshkr:config` | `b:c` | Displays the plugin overview and a list of available commands. Useful to quickly discover what the plugin exposes. |
|
|
504
|
+
| `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. |
|
|
505
|
+
| `brnshkr:config:update-php-extensions` | `b:c:upe` | Scans installed packages and updates `composer.json` with required `ext-*` platform packages. |
|
|
506
|
+
| `brnshkr:config:extract-phar <package>` | `b:c:ep` | Extracts a `.phar` file from a given vendor package. |
|
|
507
|
+
|
|
508
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
509
|
+
|
|
510
|
+
### 💻 Development
|
|
511
|
+
|
|
512
|
+
<!-- omit in toc -->
|
|
513
|
+
#### Setup
|
|
514
|
+
|
|
515
|
+
Install dependencies and setup project tooling with the following commands and adjust as needed:
|
|
516
|
+
|
|
517
|
+
```sh
|
|
518
|
+
composer install \
|
|
519
|
+
&& cp -v ./conf/.php-cs-fixer.php.example ./conf/.php-cs-fixer.php \
|
|
520
|
+
&& cp -v ./conf/rector.php.example ./conf/rector.php \
|
|
521
|
+
&& cp -v ./conf/phpstan.neon.example ./conf/phpstan.neon
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
<!-- omit in toc -->
|
|
525
|
+
#### Make
|
|
526
|
+
|
|
527
|
+
We recommend using [GNU Make][make-url] as the primary task runner.
|
|
528
|
+
See [the Makefile](./conf/Makefile) for a full list of available targets.
|
|
529
|
+
You can also run `make help` or simply `make` to view all targets with brief descriptions.
|
|
530
|
+
|
|
531
|
+
If you need local overrides, create a `./.local/Makefile` — the main Makefile automatically includes it if present.
|
|
532
|
+
|
|
533
|
+
<!-- omit in toc -->
|
|
534
|
+
##### Common targets
|
|
535
|
+
|
|
536
|
+
Here are some frequently used examples (see `make help` for the complete list):
|
|
537
|
+
|
|
538
|
+
- `make help` — Show available targets and usage
|
|
539
|
+
- `make rector` — Run Rector to apply automated PHP refactorings
|
|
540
|
+
- `make php-cs-fixer` — Run PHP-CS-Fixer to format and fix coding-style issues
|
|
541
|
+
- `make phpstan` — Run PHPStan static analysis
|
|
542
|
+
- `make test` — Run PHPUnit test suite
|
|
543
|
+
- `make test-update` — Run PHPUnit test suite and update snapshots
|
|
544
|
+
- `make check` — Run Rector, PHP-CS-Fixer, PHPStan and PHPUnit
|
|
545
|
+
|
|
546
|
+
## 🔨 TODOs / Roadmap
|
|
547
|
+
|
|
548
|
+
- Add setup command for JS package (like `composer brnshkr:config:setup`)
|
|
549
|
+
- Expand [`⚙️ Worflows`](#️-workflows) section in readme
|
|
550
|
+
- Write sections about custom PHPStan and ESLint rules
|
|
551
|
+
- Add all around support for enforcing TypeScript aliases with ESLint
|
|
552
|
+
- Add Vue support
|
|
553
|
+
- Add React support
|
|
554
|
+
- Add Tailwind support via <https://github.com/schoero/eslint-plugin-better-tailwindcss>
|
|
555
|
+
- Improve test setup
|
|
556
|
+
|
|
557
|
+
Any help is always greatly appreciated 🙂
|
|
558
|
+
|
|
559
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
560
|
+
|
|
561
|
+
## ❤️ Contributing
|
|
562
|
+
|
|
563
|
+
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
|
564
|
+
|
|
565
|
+
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".
|
|
566
|
+
Don't forget to give the project a star! Thanks again!
|
|
567
|
+
|
|
568
|
+
1. Fork the project
|
|
569
|
+
2. Create your feature branch => `git checkout -b feature/my-new-feature`
|
|
570
|
+
3. Commit your changes => `git commit -m 'feat(my-new-feature): add some awesome new feature'`
|
|
571
|
+
4. Push to the branch => `git push origin feature/my-new-feature`
|
|
572
|
+
5. Open a pull request
|
|
573
|
+
|
|
574
|
+
### 💄 Commit Style
|
|
575
|
+
|
|
576
|
+
This project mostly follows the [Conventional Commits](https://www.conventionalcommits.org) specification.
|
|
577
|
+
There are only a few differences. The main one is that the scope is required:
|
|
578
|
+
So **instead of** this commit message signature: `<type>[optional scope]: <description>`
|
|
579
|
+
You **should use** this one: `<type><scope>: <description>`
|
|
580
|
+
Further details can be found in the [Commitlint configuration](https://github.com/brnshkr/config/blob/master/conf/commitlint.config.mjs).
|
|
581
|
+
|
|
582
|
+
### ⚙️ Workflows
|
|
583
|
+
|
|
584
|
+
See [./.github/workflows](https://github.com/brnshkr/config/blob/master/.github/workflows) for more information.
|
|
585
|
+
|
|
586
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
587
|
+
|
|
588
|
+
## 🔖 Versioning
|
|
589
|
+
|
|
590
|
+
This project follows [Semantic Versioning 2.0.0][semver-2.0.0-url].
|
|
591
|
+
The NPM and Composer packages are versioned in sync, so a version change does not necessarily indicate a change in a specific package.
|
|
592
|
+
Also please note the following additional information:
|
|
593
|
+
|
|
594
|
+
<!-- omit in toc -->
|
|
595
|
+
### Changes Considered as Breaking Changes
|
|
596
|
+
|
|
597
|
+
- Version requirement changes of Node.js, Bun, PHP or Composer
|
|
598
|
+
- Changes that might break existing userland configs
|
|
599
|
+
|
|
600
|
+
<!-- omit in toc -->
|
|
601
|
+
### Changes Considered as Non-Breaking Changes
|
|
602
|
+
|
|
603
|
+
- Changes regarding used rules and their options
|
|
604
|
+
- Version updates, introduction or removal of dependencies
|
|
605
|
+
- Updates of minimum required versions of optional dependencies
|
|
606
|
+
|
|
607
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
608
|
+
|
|
609
|
+
## 📃 License
|
|
610
|
+
|
|
611
|
+
Distributed under the MIT License. See [LICENSE](./LICENSE) for more information.
|
|
612
|
+
|
|
613
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
614
|
+
|
|
615
|
+
## 🌐 Acknowledgments
|
|
616
|
+
|
|
617
|
+
- [TypeScript](https://www.typescriptlang.org)
|
|
618
|
+
- [ESLint](https://github.com/eslint/eslint)
|
|
619
|
+
- [Stylelint](https://github.com/stylelint/stylelint)
|
|
620
|
+
- [Commitlint](https://github.com/conventional-changelog/commitlint)
|
|
621
|
+
- [@antfu/eslint-config](https://github.com/antfu/eslint-config)
|
|
622
|
+
- [PHP](https://www.php.net)
|
|
623
|
+
- [PHPStan](https://github.com/phpstan/phpstan)
|
|
624
|
+
- [Rector](https://github.com/rectorphp/rector)
|
|
625
|
+
- [GNU Make](https://www.gnu.org/software/make)
|
|
626
|
+
- [PHP Coding Standards Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer)
|
|
627
|
+
- [Best-README-Template](https://github.com/othneildrew/Best-README-Template) by [othneildrew](https://github.com/othneildrew)
|
|
628
|
+
- [Choose an Open Source License](https://choosealicense.com)
|
|
629
|
+
- [Shields.io](https://shields.io)
|
|
630
|
+
- <a href="https://github.com/brnshkr">
|
|
631
|
+
<img src="https://avatars.githubusercontent.com/u/180693849" width="24" align="center" alt="@brnshkr organization logo">
|
|
632
|
+
@brnshkr organization
|
|
633
|
+
</a>
|
|
634
|
+
|
|
635
|
+
<p align="right"><a href="#top" title="Back to top"> ⬆ </a></p>
|
|
636
|
+
|
|
637
|
+
<!-- END OF CONTENT -->
|
|
638
|
+
|
|
639
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
|
640
|
+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
|
641
|
+
|
|
642
|
+
[@brnshkr-organization-url]: https://github.com/brnshkr
|
|
643
|
+
|
|
644
|
+
[make-url]: https://www.gnu.org/software/make
|
|
645
|
+
|
|
646
|
+
[semver-2.0.0-url]: https://semver.org/#semantic-versioning-200
|
|
647
|
+
[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
|
|
648
|
+
|
|
649
|
+
[license-url]: #-license
|
|
650
|
+
[license-shield-url]: https://img.shields.io/github/license/brnshkr/config.svg?label=📃%20license&style=flat-square&labelColor=%237f399d&color=%23a5097e
|
|
651
|
+
|
|
652
|
+
[stars-url]: https://github.com/brnshkr/config/stargazers
|
|
653
|
+
[stars-shield-url]: https://img.shields.io/github/stars/brnshkr/config.svg?label=⭐%20stars&style=flat-square&labelColor=%237f399d&color=%23a5097e
|
|
654
|
+
|
|
655
|
+
[forks-url]: https://github.com/brnshkr/config/network/members
|
|
656
|
+
[forks-shield-url]: https://img.shields.io/github/forks/brnshkr/config.svg?label=🍴%20forks&style=flat-square&labelColor=%237f399d&color=%23a5097e
|
|
657
|
+
|
|
658
|
+
[issues-url]: https://github.com/brnshkr/config/issues
|
|
659
|
+
[issues-shield-url]: https://img.shields.io/github/issues/brnshkr/config.svg?label=🚨%20issues&style=flat-square&labelColor=%237f399d&color=%23a5097e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@brnshkr/config/eslint';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@brnshkr/config/stylelint';
|