@solvro/config 1.8.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -133
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +259 -222
- package/dist/cli/index.js.map +1 -0
- package/dist/commitlint/index.d.ts +5 -0
- package/dist/commitlint/index.js +35 -0
- package/dist/commitlint/index.js.map +1 -0
- package/dist/eslint/index.js +9 -1
- package/dist/eslint/index.js.map +1 -1
- package/dist/prettier/index.d.ts +18 -0
- package/dist/prettier/index.js +1 -0
- package/dist/prettier/index.js.map +1 -0
- package/package.json +9 -4
- package/dist/eslint/index.cjs +0 -977
- package/dist/eslint/index.cjs.map +0 -1
- package/dist/eslint/index.d.cts +0 -6
package/README.md
CHANGED
@@ -1,48 +1,17 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
<a aria-label="NPM version" href="https://www.npmjs.com/package/@solvro/config">
|
4
|
-
<img alt="" src="https://img.shields.io/npm/v/@solvro/config.svg?style=flat-square&labelColor=000000">
|
5
|
-
</a>
|
6
|
-
<a aria-label="License" href="https://github.com/Solvro/lib-web-solvro-config/blob/main/LICENSE.md">
|
7
|
-
<img alt="" src="https://img.shields.io/npm/l/@solvro/config.svg?style=flat-square&labelColor=000000">
|
8
|
-
</a>
|
9
|
-
<a aria-label="CI status" href="https://github.com/Solvro/lib-web-solvro-config/actions/workflows/ci.yml?query=event%3Apush+branch%3Amain">
|
10
|
-
<img alt="" src="https://img.shields.io/github/actions/workflow/status/Solvro/lib-web-solvro-config/ci.yml?event=push&branch=main&style=flat-square&labelColor=000000">
|
11
|
-
</a>
|
12
|
-
|
13
|
-
## Wprowadzenie
|
14
|
-
|
15
|
-
To repozytorium zawiera przewodnik stylu Solvro, w tym konfiguracje dla popularnych narzędzi do lintowania i stylizacji.
|
16
|
-
|
17
|
-
Dostępne są następujące konfiguracje, zaprojektowane do wspólnego użycia:
|
18
|
-
|
19
|
-
- [Prettier](#prettier)
|
20
|
-
- [ESLint](#eslint)
|
21
|
-
- [TypeScript](#typescript)
|
22
|
-
|
23
|
-
## Wkład
|
24
|
-
|
25
|
-
Prosimy o zapoznanie się z naszym [przewodnikiem dotyczącym kontrybucji](https://github.com/Solvro/lib-web-solvro-config/blob/main/CONTRIBUTING.md) przed utworzeniem pull requesta.
|
1
|
+
# @solvro/config
|
26
2
|
|
27
3
|
## Instalacja
|
28
4
|
|
29
|
-
Wszystkie konfiguracje są zawarte w
|
5
|
+
Wszystkie konfiguracje są zawarte w jednej paczce `@solvro/config`. Aby zainstalować:
|
30
6
|
|
31
7
|
```sh
|
32
|
-
|
33
|
-
npm i --save-dev @solvro/config
|
34
|
-
|
35
|
-
# Jeśli używasz pnpm
|
36
|
-
pnpm i --save-dev @solvro/config
|
8
|
+
npx @solvro/config
|
37
9
|
```
|
38
10
|
|
39
|
-
|
11
|
+
I przeklikaj się przez kreatora, polecam klikać cały czas enter, to dostaniesz zalecane konfiguracje. Można uruchamiać pare razy :3
|
40
12
|
|
41
13
|
## Prettier
|
42
14
|
|
43
|
-
> Uwaga: Musisz mieć zainstalowanego prettiera.
|
44
|
-
> Szczegóły: <https://prettier.io/docs/en/install.html>
|
45
|
-
|
46
15
|
Aby użyć configu dodaj to pole w `package.json`:
|
47
16
|
|
48
17
|
```json
|
@@ -51,110 +20,23 @@ Aby użyć configu dodaj to pole w `package.json`:
|
|
51
20
|
}
|
52
21
|
```
|
53
22
|
|
54
|
-
##
|
55
|
-
|
56
|
-
> Uwaga: ESLint musi być już zainstalowany
|
57
|
-
> Szczegóły: <https://eslint.org/docs/user-guide/getting-started#installation-and-usage>
|
58
|
-
|
59
|
-
### Konfiguracja ESLint dla TypeScripta
|
60
|
-
|
61
|
-
Niektóre reguły wymagają dodatkowych informacji o typach. Podaj ścieżkę do `tsconfig.json`.
|
62
|
-
|
63
|
-
Szczegóły: <https://typescript-eslint.io/docs/linting/type-linting>
|
64
|
-
|
65
|
-
```js
|
66
|
-
const { resolve } = require("node:path");
|
67
|
-
|
68
|
-
const project = resolve(__dirname, "tsconfig.json");
|
69
|
-
|
70
|
-
module.exports = {
|
71
|
-
root: true,
|
72
|
-
extends: [
|
73
|
-
require.resolve("@solvro/config/eslint/node"),
|
74
|
-
require.resolve("@solvro/config/eslint/typescript"),
|
75
|
-
],
|
76
|
-
parserOptions: {
|
77
|
-
project,
|
78
|
-
},
|
79
|
-
settings: {
|
80
|
-
"import/resolver": {
|
81
|
-
typescript: {
|
82
|
-
project,
|
83
|
-
},
|
84
|
-
},
|
85
|
-
},
|
86
|
-
};
|
87
|
-
```
|
88
|
-
|
89
|
-
### Konfiguracja własnych komponentów dla `jsx-a11y`
|
23
|
+
## Eslint
|
90
24
|
|
91
|
-
|
25
|
+
Wymagany jest `eslint` w wersji `9` lub nowszej oraz package.json powinien mieć pole
|
92
26
|
|
93
|
-
```
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
settings: {
|
98
|
-
"jsx-a11y": {
|
99
|
-
components: {
|
100
|
-
Article: "article",
|
101
|
-
Button: "button",
|
102
|
-
Image: "img",
|
103
|
-
Input: "input",
|
104
|
-
Link: "a",
|
105
|
-
Video: "video",
|
106
|
-
},
|
107
|
-
},
|
108
|
-
},
|
109
|
-
};
|
27
|
+
```json
|
28
|
+
{
|
29
|
+
"type": "module"
|
30
|
+
}
|
110
31
|
```
|
111
32
|
|
112
|
-
|
113
|
-
|
114
|
-
Konfiguracje ESLint można ograniczać do konkretnych ścieżek, aby reguły nie wpływały na inne części projektu.
|
115
|
-
|
116
|
-
Przykład dla plików testowych:
|
33
|
+
Konfiguracja eslinta:
|
117
34
|
|
118
35
|
```js
|
119
|
-
|
120
|
-
|
121
|
-
overrides: [
|
122
|
-
{
|
123
|
-
files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
|
124
|
-
extends: [require.resolve("@solvro/config/eslint/jest")],
|
125
|
-
},
|
126
|
-
],
|
127
|
-
};
|
128
|
-
```
|
129
|
-
|
130
|
-
### Uwaga na rozszerzenia plików
|
36
|
+
// eslint.config.js
|
37
|
+
import { solvro } from "@solro/config/eslint";
|
131
38
|
|
132
|
-
|
133
|
-
|
134
|
-
```js
|
135
|
-
module.exports = {
|
136
|
-
overrides: [
|
137
|
-
{ files: [`directory/**/*.[jt]s?(x)`], rules: { "my-rule": "off" } },
|
138
|
-
],
|
139
|
-
};
|
140
|
-
```
|
141
|
-
|
142
|
-
## TypeScript
|
143
|
-
|
144
|
-
Ten przewodnik dostarcza wiele konfiguracji TypeScript zgodnie z wersjami Node.js:
|
145
|
-
|
146
|
-
| Wersja Node.js | Konfiguracja TypeScript |
|
147
|
-
| -------------- | ---------------------------------- |
|
148
|
-
| v16 | `@solvro/config/typescript/node16` |
|
149
|
-
| v18 | `@solvro/config/typescript/node18` |
|
150
|
-
| v20 | `@solvro/config/typescript/node20` |
|
151
|
-
|
152
|
-
Aby użyć, w `tsconfig.json`:
|
153
|
-
|
154
|
-
```json
|
155
|
-
{
|
156
|
-
"extends": "@solvro/config/typescript/node16"
|
157
|
-
}
|
39
|
+
export default solvro();
|
158
40
|
```
|
159
41
|
|
160
|
-
|
42
|
+
Config sam wykryje czy używasz NextJSa czy Adonisa.
|