You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-46Lines changed: 44 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,32 +30,14 @@ It is also possible to establish dependence in the global area of visibility:
30
30
composer global require dragon-code/codestyler
31
31
```
32
32
33
-
If you need to apply code-style to JS, TS, CSS, JSON, and other files, you also need to install an additional dependency
34
-
in your project:
35
-
36
-
```bash
37
-
npm i -D @biomejs/biome
38
-
```
39
-
40
-
Next, write the commands in the `package.json` file:
41
-
42
-
```json
43
-
{
44
-
"scripts": {
45
-
"lint": "npx @biomejs/biome lint --write",
46
-
"format": "npx @biomejs/biome format --write",
47
-
"style": "npm run lint && npm run format"
48
-
}
49
-
}
50
-
```
51
-
52
33
After installing the dependency, add a file copy command to the `scripts.post-update-cmd` section.
53
34
This will automatically copy the `pint.json` file to the project root.
54
35
55
36
When adding the command, replace `8.4` with the minimum PHP version your application works with.
56
37
Available presets: `8.2`, `8.3` and `8.4`.
57
38
58
-
You can also add copying the `.editorconfig` file to help the IDE and calling normalize the `composer.json` file:
39
+
You can also add copying the `.editorconfig` file to help the IDE and calling normalize the `composer.json` file
40
+
and `biome.json` file for [Biome Linter](https://biomejs.dev):
59
41
60
42
```json
61
43
{
@@ -70,7 +52,7 @@ You can also add copying the `.editorconfig` file to help the IDE and calling no
70
52
}
71
53
```
72
54
73
-
When using a globally established dependence, the call call must be replaced with the following:
55
+
When using a globally established dependence, the call must be replaced with the following:
74
56
75
57
```json
76
58
{
@@ -85,21 +67,55 @@ When using a globally established dependence, the call call must be replaced wit
85
67
}
86
68
```
87
69
70
+
### For JS, CSS, JSON
71
+
72
+
If it is necessary to correct the code style for JS, CSS and JSON, you need to separately set the dependence through
73
+
the NPM package manager (or any other):
74
+
75
+
```bash
76
+
npm i -D @biomejs/biome
77
+
```
78
+
79
+
After that, write the commands in the `package.json` file:
80
+
81
+
```json
82
+
{
83
+
"scripts": {
84
+
"lint": "npx @biomejs/biome lint --write",
85
+
"format": "npx @biomejs/biome format --write",
86
+
"style": "npm run lint && npm run format"
87
+
}
88
+
}
89
+
```
90
+
88
91
## Usage
89
92
90
-
### Linter
93
+
### PHP Linter
91
94
92
-
[`Laravel Pint`](https://laravel.com/docs/pint) is used as the linter for PHP and [Biome](https://biomejs.dev) for others. Documentation for working with it can be
93
-
found [here](https://laravel.com/docs/pint).
95
+
[`Laravel Pint`](https://laravel.com/docs/pint) is used as the linter for PHP.
94
96
95
-
The linter is invoked by a console command:
97
+
The linter is invoked by a console commands:
96
98
97
99
```bash
98
-
# For PHP
99
100
composer style
101
+
```
102
+
103
+
### Node Linter
100
104
101
-
# For JS, TS, CSS, JSON, etc.
102
-
npm run style
105
+
[Biome](https://biomejs.dev) is used as the linter for JS, CSS and JSON.
106
+
107
+
Make sure the `biome.json` file is in the root of the project.
108
+
You can also automate this process by adding a call to the file copy function in the `scripts.post-update-cmd`
109
+
section of the `composer.json` file:
110
+
111
+
```JSON
112
+
{
113
+
"scripts": {
114
+
"post-update-cmd": [
115
+
"vendor/bin/codestyle npm"
116
+
]
117
+
}
118
+
}
103
119
```
104
120
105
121
### EditorConfig
@@ -150,24 +166,6 @@ Now you can just a run console command:
150
166
composer update
151
167
```
152
168
153
-
### Npm Linter
154
-
155
-
[Biome](https://biomejs.dev) - format, lint, and more in a fraction of a second.
156
-
157
-
To do this, make sure the `biome.json` file is in the root of the project.
158
-
You can also automate this process by adding a call to the file copy function in the `scripts.post-update-cmd`
159
-
section of the `composer.json` file.
160
-
161
-
```JSON
162
-
{
163
-
"scripts": {
164
-
"post-update-cmd": [
165
-
"vendor/bin/codestyle npm"
166
-
]
167
-
}
168
-
}
169
-
```
170
-
171
169
### Finalized `composer.json`
172
170
173
171
After completing all the steps, the `composer.json` file will have the following changes:
0 commit comments