@itstandu/code-style 0.1.5 → 0.1.6
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 +81 -0
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -142,6 +142,46 @@ Or add to `package.json`:
|
|
|
142
142
|
cp node_modules/@itstandu/code-style/.prettierignore .prettierignore
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
### Setup Scripts
|
|
146
|
+
|
|
147
|
+
Add these scripts to your `package.json` for convenient formatting and linting:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"scripts": {
|
|
152
|
+
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
|
|
153
|
+
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
|
|
154
|
+
"lint": "eslint .",
|
|
155
|
+
"lint:fix": "eslint . --fix"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Usage:**
|
|
161
|
+
|
|
162
|
+
- `npm run format` - Format all files with Prettier
|
|
163
|
+
- `npm run format:check` - Check formatting without modifying files (useful for CI)
|
|
164
|
+
- `npm run lint` - Check code for linting errors
|
|
165
|
+
- `npm run lint:fix` - Auto-fix linting issues (including import sorting)
|
|
166
|
+
|
|
167
|
+
**Recommended workflow:**
|
|
168
|
+
|
|
169
|
+
Run both format and lint:fix to ensure consistent code style:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npm run format && npm run lint:fix
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Or create a combined script:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"scripts": {
|
|
180
|
+
"style": "npm run format && npm run lint:fix"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
145
185
|
### Ensuring Consistent Formatting
|
|
146
186
|
|
|
147
187
|
This package ensures **100% Prettier coverage** for all formatting:
|
|
@@ -177,6 +217,47 @@ This package ensures **100% Prettier coverage** for all formatting:
|
|
|
177
217
|
- Uses Prettier as default formatter with `formatOnSave`
|
|
178
218
|
- Runs ESLint auto-fix on save (`source.fixAll.eslint`) for import sorting
|
|
179
219
|
|
|
220
|
+
### Editor Configuration
|
|
221
|
+
|
|
222
|
+
#### VS Code / Cursor
|
|
223
|
+
|
|
224
|
+
Add to your workspace `.vscode/settings.json` or user settings:
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
229
|
+
"editor.formatOnSave": true,
|
|
230
|
+
"editor.codeActionsOnSave": {
|
|
231
|
+
"source.fixAll.eslint": "explicit"
|
|
232
|
+
},
|
|
233
|
+
"[javascript]": {
|
|
234
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
235
|
+
},
|
|
236
|
+
"[javascriptreact]": {
|
|
237
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
238
|
+
},
|
|
239
|
+
"[typescript]": {
|
|
240
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
241
|
+
},
|
|
242
|
+
"[typescriptreact]": {
|
|
243
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**What this does:**
|
|
249
|
+
|
|
250
|
+
- ✅ **Prettier** formats code on save (whitespace, quotes, etc.)
|
|
251
|
+
- ✅ **ESLint auto-fix** runs on save, which will:
|
|
252
|
+
- Remove unused imports (`unused-imports/no-unused-imports`)
|
|
253
|
+
- Sort imports (`simple-import-sort/imports`)
|
|
254
|
+
- Fix other auto-fixable ESLint issues
|
|
255
|
+
|
|
256
|
+
**Required extensions:**
|
|
257
|
+
|
|
258
|
+
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
259
|
+
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
260
|
+
|
|
180
261
|
## Presets
|
|
181
262
|
|
|
182
263
|
### `base`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itstandu/code-style",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Production-ready shared ESLint + Prettier configuration for JavaScript and TypeScript projects",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "index.js",
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
"@angular-eslint/eslint-plugin": "^19.0.0",
|
|
46
46
|
"@angular-eslint/eslint-plugin-template": "^19.0.0",
|
|
47
47
|
"@angular-eslint/template-parser": "^19.0.0",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
49
|
-
"@typescript-eslint/parser": "^8.
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
49
|
+
"@typescript-eslint/parser": "^8.53.0",
|
|
50
50
|
"eslint": "^9.0.0",
|
|
51
|
-
"eslint-config-prettier": "^10.
|
|
52
|
-
"eslint-plugin-boundaries": "^5.
|
|
51
|
+
"eslint-config-prettier": "^10.1.8",
|
|
52
|
+
"eslint-plugin-boundaries": "^5.3.1",
|
|
53
53
|
"eslint-plugin-import": "^2.31.0",
|
|
54
54
|
"eslint-plugin-jsx-a11y": "^6.10.0",
|
|
55
55
|
"eslint-plugin-n": "^17.0.0",
|
|
56
|
-
"eslint-plugin-promise": "^7.
|
|
56
|
+
"eslint-plugin-promise": "^7.2.0",
|
|
57
57
|
"eslint-plugin-react": "^7.37.0",
|
|
58
58
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
59
59
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"eslint-plugin-unicorn": "^56.0.0",
|
|
62
62
|
"eslint-plugin-unused-imports": "^4.0.0",
|
|
63
63
|
"eslint-plugin-vue": "^9.32.0",
|
|
64
|
-
"@prettier/plugin-oxc": "^0.0
|
|
65
|
-
"prettier": "^3.
|
|
66
|
-
"prettier-plugin-tailwindcss": "^0.
|
|
64
|
+
"@prettier/plugin-oxc": "^0.1.0",
|
|
65
|
+
"prettier": "^3.8.0",
|
|
66
|
+
"prettier-plugin-tailwindcss": "^0.7.0",
|
|
67
67
|
"vue-eslint-parser": "^9.4.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -77,4 +77,4 @@
|
|
|
77
77
|
"scripts": {
|
|
78
78
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
79
79
|
}
|
|
80
|
-
}
|
|
80
|
+
}
|