@dimensional-innovations/tool-config 3.0.0 → 3.0.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/README.md +46 -186
- package/bin/lib/handlers/stylelint.js +2 -2
- package/bin/lib/package-manager.js +6 -6
- package/package.json +8 -7
- package/src/tools/prettier/README.md +7 -7
- package/src/tools/semantic-release/README.md +10 -10
- package/src/tools/semantic-release/templates/.gitlab-ci.yml +9 -9
- package/src/tools/semantic-release/templates/bitbucket-pipelines.yml +30 -30
- package/src/tools/semantic-release/templates/github-workflow.yml +14 -14
- package/src/tools/stylelint/README.md +15 -15
- package/src/tools/typescript/README.md +17 -17
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@dimensional-innovations/tool-config)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
[](https://nodejs.org/)
|
|
8
|
+
[](./tests/)
|
|
9
9
|
|
|
10
10
|
**One package. Five tools. Zero configuration.**
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ Stop juggling multiple config packages. This single package provides battle-test
|
|
|
16
16
|
**Before:**
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
|
|
19
|
+
yarn add --dev \
|
|
20
20
|
eslint @eslint/js eslint-config-airbnb eslint-plugin-react \
|
|
21
21
|
prettier prettier-config-standard \
|
|
22
22
|
stylelint stylelint-config-standard \
|
|
@@ -28,27 +28,27 @@ npm install --save-dev \
|
|
|
28
28
|
**After:**
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
|
|
31
|
+
yarn add --dev @dimensional-innovations/tool-config
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## Features
|
|
35
35
|
|
|
36
36
|
- 🎯 **Zero Configuration** - Auto-detects your framework, environment, and TypeScript
|
|
37
37
|
- 🧰 **Multi-Tool Support** - ESLint, Prettier, Stylelint, TypeScript, semantic-release in one package
|
|
38
|
-
- ⚛️ **
|
|
38
|
+
- ⚛️ **9 Frameworks** - React, Vue, Svelte, Solid, Astro, Angular, Vanilla JS, Node.js, Electron
|
|
39
39
|
- 📦 **All-In-One** - All plugins and parsers included as dependencies
|
|
40
40
|
- 🔧 **Customizable** - Override any setting while keeping smart defaults
|
|
41
41
|
- 🚀 **Modern** - ESLint 9+ flat config, TypeScript with tsgo support (10x faster)
|
|
42
42
|
- 🔄 **Uninstall Support** - Clean removal with safety checks for modified files
|
|
43
43
|
- 🎬 **Smart Scripts** - Auto-generated `check-all` script runs tools in optimal order
|
|
44
|
-
- ✅ **Battle-Tested** - 556 tests with
|
|
44
|
+
- ✅ **Battle-Tested** - 556 tests with 96% coverage
|
|
45
45
|
|
|
46
46
|
## Quick Start
|
|
47
47
|
|
|
48
48
|
### Installation
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
|
|
51
|
+
yarn add --dev @dimensional-innovations/tool-config
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Or use the interactive CLI:
|
|
@@ -111,7 +111,7 @@ export default createConfig('semantic-release')
|
|
|
111
111
|
|
|
112
112
|
That's it! The configs will automatically detect your framework and TypeScript setup.
|
|
113
113
|
|
|
114
|
-
### Add
|
|
114
|
+
### Add Scripts
|
|
115
115
|
|
|
116
116
|
```json
|
|
117
117
|
{
|
|
@@ -120,11 +120,11 @@ That's it! The configs will automatically detect your framework and TypeScript s
|
|
|
120
120
|
"lint:fix": "eslint --fix .",
|
|
121
121
|
"prettier": "prettier --check .",
|
|
122
122
|
"prettier:fix": "prettier --write .",
|
|
123
|
-
"style": "stylelint '**/*.css'",
|
|
124
|
-
"style:fix": "stylelint '**/*.css' --fix",
|
|
123
|
+
"style": "stylelint '**/*.css' --allow-empty-input",
|
|
124
|
+
"style:fix": "stylelint '**/*.css' --fix --allow-empty-input",
|
|
125
125
|
"typecheck": "tsc --noEmit",
|
|
126
126
|
"typecheck:watch": "tsc --noEmit --watch",
|
|
127
|
-
"check-all": "
|
|
127
|
+
"check-all": "yarn prettier && yarn style && yarn lint && yarn typecheck"
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
```
|
|
@@ -143,6 +143,7 @@ That's it! The configs will automatically detect your framework and TypeScript s
|
|
|
143
143
|
| Angular | ✅ | ✅ | ✅ | ✅ decorators | ✅ |
|
|
144
144
|
| Vanilla | ✅ | ✅ | ✅ | ✅ browser | ✅ |
|
|
145
145
|
| Node.js | ✅ | ✅ | N/A | ✅ NodeNext | ✅ |
|
|
146
|
+
| Electron | ✅ | ✅ | N/A | ✅ multi-config | ✅ |
|
|
146
147
|
|
|
147
148
|
**Meta-frameworks**: Next.js (→ React), Nuxt (→ Vue), SvelteKit (→ Svelte)
|
|
148
149
|
|
|
@@ -179,23 +180,11 @@ await createConfig('eslint', {
|
|
|
179
180
|
})
|
|
180
181
|
```
|
|
181
182
|
|
|
182
|
-
**
|
|
183
|
+
**Custom rules:**
|
|
183
184
|
|
|
184
185
|
```javascript
|
|
185
186
|
export default await createConfig('eslint', {
|
|
186
|
-
rules: {
|
|
187
|
-
'no-console': 'off',
|
|
188
|
-
'react/prop-types': 'warn'
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
**Example - Explicit Framework:**
|
|
194
|
-
|
|
195
|
-
```javascript
|
|
196
|
-
export default await createConfig('eslint', {
|
|
197
|
-
framework: 'vue',
|
|
198
|
-
typescript: true
|
|
187
|
+
rules: { 'no-console': 'off' }
|
|
199
188
|
})
|
|
200
189
|
```
|
|
201
190
|
|
|
@@ -204,20 +193,9 @@ export default await createConfig('eslint', {
|
|
|
204
193
|
```javascript
|
|
205
194
|
createConfig('prettier', {
|
|
206
195
|
framework: 'auto',
|
|
207
|
-
// Override any Prettier option
|
|
196
|
+
printWidth: 100, // Override any Prettier option
|
|
208
197
|
semi: false,
|
|
209
|
-
singleQuote: true
|
|
210
|
-
printWidth: 100
|
|
211
|
-
})
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
**Example - Custom Settings:**
|
|
215
|
-
|
|
216
|
-
```javascript
|
|
217
|
-
export default createConfig('prettier', {
|
|
218
|
-
printWidth: 120,
|
|
219
|
-
tabWidth: 4,
|
|
220
|
-
trailingComma: 'all'
|
|
198
|
+
singleQuote: true
|
|
221
199
|
})
|
|
222
200
|
```
|
|
223
201
|
|
|
@@ -226,57 +204,29 @@ export default createConfig('prettier', {
|
|
|
226
204
|
```javascript
|
|
227
205
|
createConfig('stylelint', {
|
|
228
206
|
framework: 'auto',
|
|
229
|
-
cssType: 'auto', // 'auto' | 'scss' | 'css'
|
|
207
|
+
cssType: 'auto', // 'auto' | 'scss' | 'css'
|
|
208
|
+
cssType: { preprocessor: 'scss', tailwind: true }, // Or object
|
|
230
209
|
rules: {} // Custom rule overrides
|
|
231
210
|
})
|
|
232
211
|
```
|
|
233
212
|
|
|
234
|
-
**Example - SCSS + Tailwind:**
|
|
235
|
-
|
|
236
|
-
```javascript
|
|
237
|
-
export default createConfig('stylelint', {
|
|
238
|
-
cssType: {
|
|
239
|
-
preprocessor: 'scss',
|
|
240
|
-
tailwind: true
|
|
241
|
-
}
|
|
242
|
-
})
|
|
243
|
-
```
|
|
244
|
-
|
|
245
213
|
### TypeScript Options
|
|
246
214
|
|
|
247
215
|
```javascript
|
|
248
216
|
await createConfig('typescript', {
|
|
249
217
|
framework: 'auto', // Auto-detect or specify framework
|
|
250
218
|
environment: 'auto', // 'auto' | 'browser' | 'node' | 'universal'
|
|
251
|
-
checker: 'auto', // 'auto' | 'modern' (tsgo) | 'legacy' (tsc
|
|
219
|
+
checker: 'auto', // 'auto' | 'modern' (tsgo) | 'legacy' (tsc)
|
|
252
220
|
strict: true, // Enable strict type checking
|
|
253
|
-
compilerOptions: {} // Custom TypeScript compiler options
|
|
254
|
-
})
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
**Example - React with Custom Options:**
|
|
258
|
-
|
|
259
|
-
```javascript
|
|
260
|
-
export default await createConfig('typescript', {
|
|
261
|
-
framework: 'react',
|
|
262
221
|
compilerOptions: {
|
|
222
|
+
// Custom compiler options
|
|
263
223
|
baseUrl: '.',
|
|
264
|
-
paths: {
|
|
265
|
-
'@/*': ['src/*']
|
|
266
|
-
}
|
|
224
|
+
paths: { '@/*': ['src/*'] }
|
|
267
225
|
}
|
|
268
226
|
})
|
|
269
227
|
```
|
|
270
228
|
|
|
271
|
-
**
|
|
272
|
-
|
|
273
|
-
```javascript
|
|
274
|
-
export default await createConfig('typescript', {
|
|
275
|
-
checker: 'modern' // Forces tsgo when installed
|
|
276
|
-
})
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
**tsgo Support:** Install `@typescript/native-preview` for 10x faster type checking. The package automatically detects and uses tsgo when available.
|
|
229
|
+
**tsgo Support:** Install `@typescript/native-preview` for 10x faster type checking. Auto-detected or set `checker: 'modern'` to force it.
|
|
280
230
|
|
|
281
231
|
### semantic-release Options
|
|
282
232
|
|
|
@@ -287,15 +237,6 @@ createConfig('semantic-release', {
|
|
|
287
237
|
})
|
|
288
238
|
```
|
|
289
239
|
|
|
290
|
-
**Example - Library Release:**
|
|
291
|
-
|
|
292
|
-
```javascript
|
|
293
|
-
export default createConfig('semantic-release', {
|
|
294
|
-
preset: 'library',
|
|
295
|
-
gitProvider: 'github'
|
|
296
|
-
})
|
|
297
|
-
```
|
|
298
|
-
|
|
299
240
|
## Framework-Specific Guides
|
|
300
241
|
|
|
301
242
|
### React
|
|
@@ -424,7 +365,7 @@ npx @dimensional-innovations/tool-config
|
|
|
424
365
|
- Choose which tools to configure
|
|
425
366
|
- Auto-detects framework and TypeScript
|
|
426
367
|
- Creates config files automatically
|
|
427
|
-
- Adds
|
|
368
|
+
- Adds scripts to package.json (including `check-all` for multiple tools)
|
|
428
369
|
- Automated CI/CD pipeline setup
|
|
429
370
|
- **Uninstall support** - Clean removal of configs and scripts
|
|
430
371
|
- Supports dry-run mode
|
|
@@ -586,64 +527,43 @@ See the [`examples/`](./examples/) directory for complete working examples:
|
|
|
586
527
|
- [Node Backend](./examples/node-backend/) - Express, TypeScript
|
|
587
528
|
- [Vanilla JS](./examples/vanilla-js/) - Pure JavaScript, no framework
|
|
588
529
|
|
|
589
|
-
Each example includes all
|
|
530
|
+
Each example includes all 5 tool configurations and npm scripts.
|
|
590
531
|
|
|
591
532
|
## Advanced Usage
|
|
592
533
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
Use different configs per workspace:
|
|
534
|
+
**Monorepo Support:**
|
|
596
535
|
|
|
597
536
|
```javascript
|
|
598
537
|
// apps/frontend/eslint.config.js
|
|
599
|
-
export default await createConfig('eslint', {
|
|
600
|
-
framework: 'react',
|
|
601
|
-
typescript: true
|
|
602
|
-
})
|
|
538
|
+
export default await createConfig('eslint', { framework: 'react' })
|
|
603
539
|
|
|
604
540
|
// apps/backend/eslint.config.js
|
|
605
|
-
export default await createConfig('eslint', {
|
|
606
|
-
framework: 'node',
|
|
607
|
-
environment: 'node'
|
|
608
|
-
})
|
|
541
|
+
export default await createConfig('eslint', { framework: 'node' })
|
|
609
542
|
```
|
|
610
543
|
|
|
611
|
-
|
|
544
|
+
**Custom Ignore Patterns:**
|
|
612
545
|
|
|
613
546
|
```javascript
|
|
614
547
|
export default await createConfig('eslint', {
|
|
615
|
-
ignore: ['dist/**', '
|
|
548
|
+
ignore: ['dist/**', '**/*.generated.ts']
|
|
616
549
|
})
|
|
617
550
|
```
|
|
618
551
|
|
|
619
|
-
|
|
552
|
+
**Environment-Specific Rules:**
|
|
620
553
|
|
|
621
554
|
```javascript
|
|
622
|
-
const isDev = process.env.NODE_ENV === 'development'
|
|
623
|
-
|
|
624
555
|
export default await createConfig('eslint', {
|
|
625
556
|
rules: {
|
|
626
|
-
'no-console':
|
|
627
|
-
'no-debugger': isDev ? 'warn' : 'error'
|
|
557
|
+
'no-console': process.env.NODE_ENV === 'development' ? 'off' : 'error'
|
|
628
558
|
}
|
|
629
559
|
})
|
|
630
560
|
```
|
|
631
561
|
|
|
632
|
-
|
|
562
|
+
**Combining with Other Configs:**
|
|
633
563
|
|
|
634
564
|
```javascript
|
|
635
|
-
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
636
|
-
import customRules from './custom-rules.js'
|
|
637
|
-
|
|
638
565
|
const baseConfig = await createConfig('eslint')
|
|
639
|
-
|
|
640
|
-
export default [
|
|
641
|
-
...baseConfig,
|
|
642
|
-
{
|
|
643
|
-
files: ['**/*.js'],
|
|
644
|
-
rules: customRules
|
|
645
|
-
}
|
|
646
|
-
]
|
|
566
|
+
export default [...baseConfig, { files: ['**/*.js'], rules: customRules }]
|
|
647
567
|
```
|
|
648
568
|
|
|
649
569
|
## Ignoring Files
|
|
@@ -698,8 +618,7 @@ export default createConfig('stylelint', {
|
|
|
698
618
|
|
|
699
619
|
**Prettier** - Edit `.prettierignore` file:
|
|
700
620
|
|
|
701
|
-
```
|
|
702
|
-
# Custom ignores
|
|
621
|
+
```text
|
|
703
622
|
generated/
|
|
704
623
|
legacy/
|
|
705
624
|
```
|
|
@@ -721,82 +640,25 @@ npx prettier --check . --debug-check
|
|
|
721
640
|
|
|
722
641
|
## Troubleshooting
|
|
723
642
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
If you see errors about linting/formatting files in `dist/`, `coverage/`, or `out/`:
|
|
727
|
-
|
|
728
|
-
1. **ESLint**: Ignore patterns are applied automatically ✅
|
|
729
|
-
2. **Stylelint**: Ignore patterns are applied automatically ✅
|
|
730
|
-
3. **Prettier**: Check that `.prettierignore` was created. If not, re-run config creation or manually create the file.
|
|
731
|
-
|
|
732
|
-
**Solution**: If `.prettierignore` is missing, it will be auto-created next time you use the config. Or create it manually:
|
|
733
|
-
|
|
734
|
-
```bash
|
|
735
|
-
# Let Prettier generate it
|
|
736
|
-
node -e "import('@dimensional-innovations/tool-config').then(m => m.createConfig('prettier'))"
|
|
737
|
-
```
|
|
738
|
-
|
|
739
|
-
### ESLint Not Detecting Framework
|
|
740
|
-
|
|
741
|
-
Ensure your `package.json` includes the framework dependency:
|
|
742
|
-
|
|
743
|
-
```json
|
|
744
|
-
{
|
|
745
|
-
"dependencies": {
|
|
746
|
-
"react": "^18.0.0"
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
```
|
|
750
|
-
|
|
751
|
-
Or explicitly specify:
|
|
752
|
-
|
|
753
|
-
```javascript
|
|
754
|
-
export default await createConfig('eslint', {
|
|
755
|
-
framework: 'react'
|
|
756
|
-
})
|
|
757
|
-
```
|
|
758
|
-
|
|
759
|
-
### TypeScript Parsing Errors
|
|
643
|
+
**ESLint not detecting framework:** Ensure framework is in `package.json` dependencies, or explicitly set `framework: 'react'`.
|
|
760
644
|
|
|
761
|
-
|
|
645
|
+
**TypeScript parsing errors:** Install TypeScript: `yarn add --dev typescript`
|
|
762
646
|
|
|
763
|
-
|
|
764
|
-
npm install --save-dev typescript
|
|
765
|
-
```
|
|
766
|
-
|
|
767
|
-
### Prettier Plugin Not Found
|
|
768
|
-
|
|
769
|
-
Install the required peer dependency:
|
|
647
|
+
**Prettier plugin not found:** Install required peer dependency:
|
|
770
648
|
|
|
771
649
|
```bash
|
|
772
|
-
|
|
773
|
-
|
|
650
|
+
yarn add --dev prettier-plugin-svelte # Svelte
|
|
651
|
+
yarn add --dev prettier-plugin-astro # Astro
|
|
774
652
|
```
|
|
775
653
|
|
|
776
|
-
|
|
654
|
+
**Stylelint not linting .vue files:** Update script: `"style": "stylelint '**/*.css' '**/*.vue' --allow-empty-input"`
|
|
777
655
|
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
```json
|
|
781
|
-
{
|
|
782
|
-
"scripts": {
|
|
783
|
-
"style": "stylelint '**/*.css' '**/*.vue'"
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
```
|
|
787
|
-
|
|
788
|
-
### Config Not Updating After Framework Change
|
|
789
|
-
|
|
790
|
-
Delete `node_modules/.cache` and restart your editor:
|
|
791
|
-
|
|
792
|
-
```bash
|
|
793
|
-
rm -rf node_modules/.cache
|
|
794
|
-
```
|
|
656
|
+
**Config not updating:** Delete `node_modules/.cache` and restart editor.
|
|
795
657
|
|
|
796
658
|
## Requirements
|
|
797
659
|
|
|
798
|
-
- **Node.js**: >= 22.
|
|
799
|
-
- **
|
|
660
|
+
- **Node.js**: >= 22.20.0 (Node.js 22 LTS "Jod")
|
|
661
|
+
- **Yarn**: >= 4.0.0 (or npm >= 10.0.0)
|
|
800
662
|
- **ECMAScript**: ES2025 (ESM modules required)
|
|
801
663
|
|
|
802
664
|
## Philosophy
|
|
@@ -808,20 +670,18 @@ This package follows these principles:
|
|
|
808
670
|
- **Fail Loudly** - Errors for critical issues, warnings for quality improvements
|
|
809
671
|
- **Framework Agnostic** - No opinions about which framework you use
|
|
810
672
|
- **Modern Standards** - Uses latest tooling and ESLint flat config
|
|
811
|
-
- **Comprehensive Coverage** -
|
|
673
|
+
- **Comprehensive Coverage** - 96% test coverage, battle-tested in production
|
|
812
674
|
|
|
813
675
|
## Contributing
|
|
814
676
|
|
|
815
|
-
Contributions welcome!
|
|
816
|
-
|
|
817
|
-
**To add a new framework:**
|
|
677
|
+
Contributions welcome! To add a new framework:
|
|
818
678
|
|
|
819
679
|
1. Add detection logic in `src/detectors.js`
|
|
820
680
|
2. Create presets in `src/tools/{tool}/presets/frameworks/`
|
|
821
681
|
3. Add tests with 100% coverage
|
|
822
682
|
4. Update documentation
|
|
823
683
|
|
|
824
|
-
See [
|
|
684
|
+
See [CLAUDE.md](./CLAUDE.md) for architecture details.
|
|
825
685
|
|
|
826
686
|
## License
|
|
827
687
|
|
|
@@ -51,8 +51,8 @@ export function getScripts(detected) {
|
|
|
51
51
|
extensions.length === 1 ? `**/*.${extensions[0]}` : `**/*.{${extensions.join(',')}}`
|
|
52
52
|
|
|
53
53
|
return {
|
|
54
|
-
style: `stylelint "${pattern}"`,
|
|
55
|
-
'style:fix': `stylelint "${pattern}" --fix`
|
|
54
|
+
style: `stylelint "${pattern}" --allow-empty-input`,
|
|
55
|
+
'style:fix': `stylelint "${pattern}" --fix --allow-empty-input`
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -23,7 +23,7 @@ const CHECK_ORDER = ['prettier', 'stylelint', 'eslint', 'typescript']
|
|
|
23
23
|
*/
|
|
24
24
|
function generateCheckAllScript(installedTools) {
|
|
25
25
|
const commands = CHECK_ORDER.filter(tool => installedTools.includes(tool))
|
|
26
|
-
.map(tool => `
|
|
26
|
+
.map(tool => `yarn ${CHECK_SCRIPT_MAP[tool]}`)
|
|
27
27
|
.join(' && ')
|
|
28
28
|
|
|
29
29
|
return commands || null
|
|
@@ -75,11 +75,11 @@ export function updatePackageJsonScripts(tools, getScriptsFn, context) {
|
|
|
75
75
|
const existingCheckAll = packageJson.scripts['check-all']
|
|
76
76
|
|
|
77
77
|
// Only add if doesn't exist, or update if it's our auto-generated pattern
|
|
78
|
-
// Auto-generated scripts follow pattern: "
|
|
78
|
+
// Auto-generated scripts follow pattern: "yarn X && yarn Y && ..."
|
|
79
79
|
const isAutoGenerated =
|
|
80
80
|
existingCheckAll &&
|
|
81
|
-
existingCheckAll.startsWith('
|
|
82
|
-
existingCheckAll.includes(' &&
|
|
81
|
+
existingCheckAll.startsWith('yarn ') &&
|
|
82
|
+
existingCheckAll.includes(' && yarn ')
|
|
83
83
|
|
|
84
84
|
if (!existingCheckAll || isAutoGenerated) {
|
|
85
85
|
scriptsToAdd['check-all'] = checkAllCmd
|
|
@@ -157,9 +157,9 @@ export function removePackageJsonScripts(tools, getScriptsFn, context) {
|
|
|
157
157
|
// Handle check-all script separately
|
|
158
158
|
const checkAllScript = packageJson.scripts['check-all']
|
|
159
159
|
if (checkAllScript) {
|
|
160
|
-
// Only remove if it's auto-generated (follows
|
|
160
|
+
// Only remove if it's auto-generated (follows yarn X && yarn Y pattern)
|
|
161
161
|
const isAutoGenerated =
|
|
162
|
-
checkAllScript.startsWith('
|
|
162
|
+
checkAllScript.startsWith('yarn ') && checkAllScript.includes(' && yarn ')
|
|
163
163
|
|
|
164
164
|
if (isAutoGenerated) {
|
|
165
165
|
scriptsToRemove.push('check-all')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dimensional-innovations/tool-config",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Universal configuration package for ESLint, Prettier, Stylelint, TypeScript, and semantic-release with auto-detection for React, Vue, Svelte, Solid, Astro, Angular, and more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -47,23 +47,24 @@
|
|
|
47
47
|
"LICENSE"
|
|
48
48
|
],
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=22.
|
|
50
|
+
"node": ">=22.20.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"lint": "eslint .",
|
|
54
54
|
"lint:fix": "eslint --fix .",
|
|
55
|
-
"prettier": "
|
|
56
|
-
"prettier:fix": "
|
|
55
|
+
"prettier": "prettier --check .",
|
|
56
|
+
"prettier:fix": "prettier --write .",
|
|
57
57
|
"test": "vitest run",
|
|
58
58
|
"test:watch": "vitest",
|
|
59
59
|
"test:ui": "vitest --ui",
|
|
60
60
|
"test:coverage": "vitest run --coverage",
|
|
61
61
|
"release": "semantic-release",
|
|
62
62
|
"prepare": "husky",
|
|
63
|
-
"style": "stylelint \"**/*.css\"",
|
|
64
|
-
"style:fix": "stylelint \"**/*.css\" --fix",
|
|
63
|
+
"style": "stylelint \"**/*.css\" --allow-empty-input",
|
|
64
|
+
"style:fix": "stylelint \"**/*.css\" --fix --allow-empty-input",
|
|
65
65
|
"typecheck": "tsc --noEmit",
|
|
66
|
-
"typecheck:watch": "tsc --noEmit --watch"
|
|
66
|
+
"typecheck:watch": "tsc --noEmit --watch",
|
|
67
|
+
"check-all": "yarn prettier && yarn style && yarn lint && yarn typecheck"
|
|
67
68
|
},
|
|
68
69
|
"dependencies": {
|
|
69
70
|
"@eslint/compat": "^1.4.0",
|
|
@@ -43,7 +43,7 @@ The base preset applies to all frameworks:
|
|
|
43
43
|
**Installation**:
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
|
|
46
|
+
yarn add --save-dev prettier-plugin-vue
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
**Example**:
|
|
@@ -82,7 +82,7 @@ export default createConfig('prettier')
|
|
|
82
82
|
**Installation**:
|
|
83
83
|
|
|
84
84
|
```bash
|
|
85
|
-
|
|
85
|
+
yarn add --save-dev prettier-plugin-svelte
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
**Svelte 5 Support**: Fully compatible with Svelte 5 runes (`$state`, `$derived`, etc.)
|
|
@@ -94,7 +94,7 @@ npm install --save-dev prettier-plugin-svelte
|
|
|
94
94
|
**Installation**:
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
|
-
|
|
97
|
+
yarn add --save-dev prettier-plugin-astro
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
**Automatic Formatting**: The Astro plugin handles all `.astro` file formatting automatically
|
|
@@ -195,8 +195,8 @@ Add these scripts to your `package.json`:
|
|
|
195
195
|
Then run:
|
|
196
196
|
|
|
197
197
|
```bash
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
yarn prettier:fix # Format all files
|
|
199
|
+
yarn prettier # Check formatting without writing
|
|
200
200
|
```
|
|
201
201
|
|
|
202
202
|
## VSCode Integration
|
|
@@ -258,7 +258,7 @@ This package deliberately **does not** integrate Prettier with ESLint. They rema
|
|
|
258
258
|
Run them separately:
|
|
259
259
|
|
|
260
260
|
```bash
|
|
261
|
-
|
|
261
|
+
yarn lint && yarn prettier:fix
|
|
262
262
|
```
|
|
263
263
|
|
|
264
264
|
## Troubleshooting
|
|
@@ -270,7 +270,7 @@ If you see errors like `Cannot find module 'prettier-plugin-svelte'`:
|
|
|
270
270
|
1. Install the required plugin:
|
|
271
271
|
|
|
272
272
|
```bash
|
|
273
|
-
|
|
273
|
+
yarn add --save-dev prettier-plugin-svelte
|
|
274
274
|
```
|
|
275
275
|
|
|
276
276
|
2. Or specify a framework that doesn't need plugins:
|
|
@@ -49,7 +49,7 @@ export default createConfig('semantic-release', {
|
|
|
49
49
|
## Installation
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
|
-
|
|
52
|
+
yarn add --save-dev @dimensional-innovations/tool-config semantic-release
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
### Optional Peer Dependencies
|
|
@@ -58,13 +58,13 @@ Install the semantic-release plugins you need based on your Git provider:
|
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
# For GitLab projects
|
|
61
|
-
|
|
61
|
+
yarn add --save-dev @semantic-release/changelog @semantic-release/git @semantic-release/gitlab
|
|
62
62
|
|
|
63
63
|
# For GitHub projects
|
|
64
|
-
|
|
64
|
+
yarn add --save-dev @semantic-release/changelog @semantic-release/git @semantic-release/github
|
|
65
65
|
|
|
66
66
|
# For Bitbucket or other providers (no provider-specific plugin)
|
|
67
|
-
|
|
67
|
+
yarn add --save-dev @semantic-release/changelog @semantic-release/git
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
## Usage
|
|
@@ -255,8 +255,8 @@ release:
|
|
|
255
255
|
only:
|
|
256
256
|
- main
|
|
257
257
|
script:
|
|
258
|
-
-
|
|
259
|
-
-
|
|
258
|
+
- yarn add
|
|
259
|
+
- yarn semantic-release
|
|
260
260
|
variables:
|
|
261
261
|
GL_TOKEN: $GL_TOKEN
|
|
262
262
|
NPM_TOKEN: $NPM_TOKEN
|
|
@@ -281,8 +281,8 @@ jobs:
|
|
|
281
281
|
- uses: actions/setup-node@v3
|
|
282
282
|
with:
|
|
283
283
|
node-version: '20'
|
|
284
|
-
- run:
|
|
285
|
-
- run:
|
|
284
|
+
- run: yarn add
|
|
285
|
+
- run: yarn semantic-release
|
|
286
286
|
env:
|
|
287
287
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
288
288
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -293,7 +293,7 @@ jobs:
|
|
|
293
293
|
Test your configuration without publishing:
|
|
294
294
|
|
|
295
295
|
```bash
|
|
296
|
-
|
|
296
|
+
yarn semantic-release --dry-run
|
|
297
297
|
```
|
|
298
298
|
|
|
299
299
|
## Workflow
|
|
@@ -370,7 +370,7 @@ semantic-release analyzes commits and:
|
|
|
370
370
|
|
|
371
371
|
1. Only release from CI/CD, never manually
|
|
372
372
|
2. Protect main branch to prevent direct pushes
|
|
373
|
-
3. Use `
|
|
373
|
+
3. Use `yarn release --dry-run` to test locally
|
|
374
374
|
|
|
375
375
|
### Monorepo Issues
|
|
376
376
|
|
|
@@ -16,24 +16,24 @@ stages:
|
|
|
16
16
|
cache:
|
|
17
17
|
key:
|
|
18
18
|
files:
|
|
19
|
-
-
|
|
19
|
+
- yarn.lock
|
|
20
20
|
paths:
|
|
21
21
|
- node_modules/
|
|
22
|
-
- .
|
|
22
|
+
- .yarn/cache/
|
|
23
23
|
|
|
24
24
|
# Default settings for all jobs
|
|
25
25
|
default:
|
|
26
26
|
image: node:22-alpine
|
|
27
27
|
before_script:
|
|
28
|
-
-
|
|
28
|
+
- yarn install --frozen-lockfile
|
|
29
29
|
|
|
30
30
|
# Lint job - runs ESLint, Prettier, Stylelint
|
|
31
31
|
lint:
|
|
32
32
|
stage: lint
|
|
33
33
|
script:
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
34
|
+
- yarn lint
|
|
35
|
+
- yarn prettier
|
|
36
|
+
- yarn style || true # Allow failure if no CSS files
|
|
37
37
|
only:
|
|
38
38
|
- branches
|
|
39
39
|
- merge_requests
|
|
@@ -42,7 +42,7 @@ lint:
|
|
|
42
42
|
test:
|
|
43
43
|
stage: test
|
|
44
44
|
script:
|
|
45
|
-
-
|
|
45
|
+
- yarn test:coverage
|
|
46
46
|
coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/'
|
|
47
47
|
artifacts:
|
|
48
48
|
reports:
|
|
@@ -62,9 +62,9 @@ release:
|
|
|
62
62
|
before_script:
|
|
63
63
|
# Install git (required by semantic-release)
|
|
64
64
|
- apk add --no-cache git
|
|
65
|
-
-
|
|
65
|
+
- yarn install --frozen-lockfile
|
|
66
66
|
script:
|
|
67
|
-
-
|
|
67
|
+
- yarn release
|
|
68
68
|
only:
|
|
69
69
|
- main
|
|
70
70
|
except:
|
|
@@ -10,27 +10,27 @@ image: node:22
|
|
|
10
10
|
|
|
11
11
|
definitions:
|
|
12
12
|
caches:
|
|
13
|
-
|
|
13
|
+
yarn: ~/.yarn/cache
|
|
14
14
|
|
|
15
15
|
pipelines:
|
|
16
16
|
default:
|
|
17
17
|
- step:
|
|
18
18
|
name: Lint
|
|
19
19
|
caches:
|
|
20
|
-
-
|
|
20
|
+
- yarn
|
|
21
21
|
script:
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
22
|
+
- yarn install --frozen-lockfile
|
|
23
|
+
- yarn lint
|
|
24
|
+
- yarn prettier
|
|
25
|
+
- yarn style || true # Allow failure if no CSS files
|
|
26
26
|
|
|
27
27
|
- step:
|
|
28
28
|
name: Test
|
|
29
29
|
caches:
|
|
30
|
-
-
|
|
30
|
+
- yarn
|
|
31
31
|
script:
|
|
32
|
-
-
|
|
33
|
-
-
|
|
32
|
+
- yarn install --frozen-lockfile
|
|
33
|
+
- yarn test:coverage
|
|
34
34
|
artifacts:
|
|
35
35
|
- coverage/**
|
|
36
36
|
|
|
@@ -39,30 +39,30 @@ pipelines:
|
|
|
39
39
|
- step:
|
|
40
40
|
name: Lint
|
|
41
41
|
caches:
|
|
42
|
-
-
|
|
42
|
+
- yarn
|
|
43
43
|
script:
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
44
|
+
- yarn install --frozen-lockfile
|
|
45
|
+
- yarn lint
|
|
46
|
+
- yarn prettier
|
|
47
|
+
- yarn style || true
|
|
48
48
|
|
|
49
49
|
- step:
|
|
50
50
|
name: Test
|
|
51
51
|
caches:
|
|
52
|
-
-
|
|
52
|
+
- yarn
|
|
53
53
|
script:
|
|
54
|
-
-
|
|
55
|
-
-
|
|
54
|
+
- yarn install --frozen-lockfile
|
|
55
|
+
- yarn test:coverage
|
|
56
56
|
artifacts:
|
|
57
57
|
- coverage/**
|
|
58
58
|
|
|
59
59
|
- step:
|
|
60
60
|
name: Release
|
|
61
61
|
caches:
|
|
62
|
-
-
|
|
62
|
+
- yarn
|
|
63
63
|
script:
|
|
64
|
-
-
|
|
65
|
-
-
|
|
64
|
+
- yarn install --frozen-lockfile
|
|
65
|
+
- yarn release
|
|
66
66
|
trigger: manual # Remove this line to make releases automatic
|
|
67
67
|
|
|
68
68
|
pull-requests:
|
|
@@ -70,13 +70,13 @@ pipelines:
|
|
|
70
70
|
- step:
|
|
71
71
|
name: Lint & Test
|
|
72
72
|
caches:
|
|
73
|
-
-
|
|
73
|
+
- yarn
|
|
74
74
|
script:
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
75
|
+
- yarn install --frozen-lockfile
|
|
76
|
+
- yarn lint
|
|
77
|
+
- yarn prettier
|
|
78
|
+
- yarn style || true
|
|
79
|
+
- yarn test
|
|
80
80
|
# Optional: Test on multiple Node versions
|
|
81
81
|
# definitions:
|
|
82
82
|
# services:
|
|
@@ -90,11 +90,11 @@ pipelines:
|
|
|
90
90
|
# name: Test (Node 20)
|
|
91
91
|
# image: node:20
|
|
92
92
|
# script:
|
|
93
|
-
# -
|
|
94
|
-
# -
|
|
93
|
+
# - yarn install --frozen-lockfile
|
|
94
|
+
# - yarn test
|
|
95
95
|
# - step:
|
|
96
96
|
# name: Test (Node 22)
|
|
97
97
|
# image: node:22
|
|
98
98
|
# script:
|
|
99
|
-
# -
|
|
100
|
-
# -
|
|
99
|
+
# - yarn install --frozen-lockfile
|
|
100
|
+
# - yarn test
|
|
@@ -27,19 +27,19 @@ jobs:
|
|
|
27
27
|
uses: actions/setup-node@v4
|
|
28
28
|
with:
|
|
29
29
|
node-version: '22'
|
|
30
|
-
cache: '
|
|
30
|
+
cache: 'yarn'
|
|
31
31
|
|
|
32
32
|
- name: Install dependencies
|
|
33
|
-
run:
|
|
33
|
+
run: yarn install --frozen-lockfile
|
|
34
34
|
|
|
35
35
|
- name: Run ESLint
|
|
36
|
-
run:
|
|
36
|
+
run: yarn lint
|
|
37
37
|
|
|
38
38
|
- name: Run Prettier
|
|
39
|
-
run:
|
|
39
|
+
run: yarn prettier
|
|
40
40
|
|
|
41
41
|
- name: Run Stylelint
|
|
42
|
-
run:
|
|
42
|
+
run: yarn style || true # Allow failure if no CSS files
|
|
43
43
|
|
|
44
44
|
test:
|
|
45
45
|
name: Test
|
|
@@ -51,13 +51,13 @@ jobs:
|
|
|
51
51
|
uses: actions/setup-node@v4
|
|
52
52
|
with:
|
|
53
53
|
node-version: '22'
|
|
54
|
-
cache: '
|
|
54
|
+
cache: 'yarn'
|
|
55
55
|
|
|
56
56
|
- name: Install dependencies
|
|
57
|
-
run:
|
|
57
|
+
run: yarn install --frozen-lockfile
|
|
58
58
|
|
|
59
59
|
- name: Run tests with coverage
|
|
60
|
-
run:
|
|
60
|
+
run: yarn test:coverage
|
|
61
61
|
|
|
62
62
|
- name: Upload coverage to Codecov
|
|
63
63
|
uses: codecov/codecov-action@v4
|
|
@@ -79,16 +79,16 @@ jobs:
|
|
|
79
79
|
uses: actions/setup-node@v4
|
|
80
80
|
with:
|
|
81
81
|
node-version: '22'
|
|
82
|
-
cache: '
|
|
82
|
+
cache: 'yarn'
|
|
83
83
|
|
|
84
84
|
- name: Install dependencies
|
|
85
|
-
run:
|
|
85
|
+
run: yarn install --frozen-lockfile
|
|
86
86
|
|
|
87
87
|
- name: Release
|
|
88
88
|
env:
|
|
89
89
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
90
90
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
91
|
-
run:
|
|
91
|
+
run: yarn release
|
|
92
92
|
# Optional: Test on multiple Node versions
|
|
93
93
|
# test-matrix:
|
|
94
94
|
# name: Test (Node ${{ matrix.node-version }})
|
|
@@ -102,6 +102,6 @@ jobs:
|
|
|
102
102
|
# uses: actions/setup-node@v4
|
|
103
103
|
# with:
|
|
104
104
|
# node-version: ${{ matrix.node-version }}
|
|
105
|
-
# cache: '
|
|
106
|
-
# - run:
|
|
107
|
-
# - run:
|
|
105
|
+
# cache: 'yarn'
|
|
106
|
+
# - run: yarn install --frozen-lockfile
|
|
107
|
+
# - run: yarn test
|
|
@@ -19,10 +19,10 @@ The Stylelint tool and core config are included as dependencies. For Vue project
|
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
21
|
# Vue projects only
|
|
22
|
-
|
|
22
|
+
yarn add --save-dev stylelint-config-standard-vue postcss-html
|
|
23
23
|
|
|
24
24
|
# Svelte projects need postcss-html for component parsing
|
|
25
|
-
|
|
25
|
+
yarn add --save-dev postcss-html
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
@@ -194,8 +194,8 @@ Add these scripts to your `package.json`:
|
|
|
194
194
|
```json
|
|
195
195
|
{
|
|
196
196
|
"scripts": {
|
|
197
|
-
"style": "stylelint '**/*.css'",
|
|
198
|
-
"style:fix": "stylelint '**/*.css' --fix"
|
|
197
|
+
"style": "stylelint '**/*.css' --allow-empty-input",
|
|
198
|
+
"style:fix": "stylelint '**/*.css' --fix --allow-empty-input"
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
```
|
|
@@ -207,8 +207,8 @@ Add these scripts to your `package.json`:
|
|
|
207
207
|
```json
|
|
208
208
|
{
|
|
209
209
|
"scripts": {
|
|
210
|
-
"style": "stylelint '**/*.css' '**/*.vue'",
|
|
211
|
-
"style:fix": "stylelint '**/*.css' '**/*.vue' --fix"
|
|
210
|
+
"style": "stylelint '**/*.css' '**/*.vue' --allow-empty-input",
|
|
211
|
+
"style:fix": "stylelint '**/*.css' '**/*.vue' --fix --allow-empty-input"
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
```
|
|
@@ -218,8 +218,8 @@ Add these scripts to your `package.json`:
|
|
|
218
218
|
```json
|
|
219
219
|
{
|
|
220
220
|
"scripts": {
|
|
221
|
-
"style": "stylelint '**/*.css' '**/*.svelte'",
|
|
222
|
-
"style:fix": "stylelint '**/*.css' '**/*.svelte' --fix"
|
|
221
|
+
"style": "stylelint '**/*.css' '**/*.svelte' --allow-empty-input",
|
|
222
|
+
"style:fix": "stylelint '**/*.css' '**/*.svelte' --fix --allow-empty-input"
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
```
|
|
@@ -229,8 +229,8 @@ Add these scripts to your `package.json`:
|
|
|
229
229
|
```json
|
|
230
230
|
{
|
|
231
231
|
"scripts": {
|
|
232
|
-
"style": "stylelint '**/*.css'",
|
|
233
|
-
"style:fix": "stylelint '**/*.css' --fix'
|
|
232
|
+
"style": "stylelint '**/*.css' --allow-empty-input",
|
|
233
|
+
"style:fix": "stylelint '**/*.css' --fix --allow-empty-input'
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
```
|
|
@@ -247,7 +247,7 @@ No conflicts! They work together perfectly:
|
|
|
247
247
|
Run them sequentially:
|
|
248
248
|
|
|
249
249
|
```bash
|
|
250
|
-
|
|
250
|
+
yarn style && yarn prettier:fix
|
|
251
251
|
```
|
|
252
252
|
|
|
253
253
|
### Stylelint + ESLint
|
|
@@ -320,7 +320,7 @@ export default createConfig('stylelint', {
|
|
|
320
320
|
**Vue projects only**: Install the optional peer dependency:
|
|
321
321
|
|
|
322
322
|
```bash
|
|
323
|
-
|
|
323
|
+
yarn add --save-dev stylelint-config-standard-vue postcss-html
|
|
324
324
|
```
|
|
325
325
|
|
|
326
326
|
### "Cannot find module 'postcss-html'"
|
|
@@ -328,7 +328,7 @@ npm install --save-dev stylelint-config-standard-vue postcss-html
|
|
|
328
328
|
**Vue/Svelte projects**: Install the parser:
|
|
329
329
|
|
|
330
330
|
```bash
|
|
331
|
-
|
|
331
|
+
yarn add --save-dev postcss-html
|
|
332
332
|
```
|
|
333
333
|
|
|
334
334
|
### Stylelint Not Linting .vue Files
|
|
@@ -338,7 +338,7 @@ Make sure your script includes `.vue` files:
|
|
|
338
338
|
```json
|
|
339
339
|
{
|
|
340
340
|
"scripts": {
|
|
341
|
-
"style": "stylelint '**/*.css' '**/*.vue'"
|
|
341
|
+
"style": "stylelint '**/*.css' '**/*.vue' --allow-empty-input"
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
```
|
|
@@ -363,7 +363,7 @@ This shouldn't happen! Our Stylelint config focuses on quality, not formatting.
|
|
|
363
363
|
Make sure you're using Stylelint 16+:
|
|
364
364
|
|
|
365
365
|
```bash
|
|
366
|
-
|
|
366
|
+
yarn add --save-dev stylelint@^16.0.0
|
|
367
367
|
```
|
|
368
368
|
|
|
369
369
|
## Rule Philosophy
|
|
@@ -14,19 +14,19 @@ Zero-config TypeScript type checking for modern JavaScript/TypeScript projects.
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
|
|
17
|
+
yarn add --save-dev @dimensional-innovations/tool-config typescript
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
For modern performance with tsgo:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
23
|
+
yarn add --save-dev @typescript/native-preview
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
For Vue projects, also install:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
|
|
29
|
+
yarn add --save-dev vue-tsc
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## Quick Start
|
|
@@ -116,8 +116,8 @@ export default await createConfig('typescript', { framework: 'react' })
|
|
|
116
116
|
**Type checking:**
|
|
117
117
|
|
|
118
118
|
```bash
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
yarn add --save-dev @types/react @types/react-dom
|
|
120
|
+
yarn typecheck
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
### Vue
|
|
@@ -141,8 +141,8 @@ export default await createConfig('typescript', { framework: 'vue' })
|
|
|
141
141
|
**Type checking:**
|
|
142
142
|
|
|
143
143
|
```bash
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
yarn add --save-dev vue-tsc
|
|
145
|
+
yarn typecheck
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
**Note:** Vue projects should use `vue-tsc` instead of `tsc` for proper .vue file support.
|
|
@@ -165,8 +165,8 @@ export default await createConfig('typescript', { framework: 'svelte' })
|
|
|
165
165
|
**Type checking:**
|
|
166
166
|
|
|
167
167
|
```bash
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
yarn add --save-dev @sveltejs/vite-plugin-svelte
|
|
169
|
+
yarn typecheck
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
### Solid
|
|
@@ -237,8 +237,8 @@ export default await createConfig('typescript', { framework: 'node' })
|
|
|
237
237
|
**Type checking:**
|
|
238
238
|
|
|
239
239
|
```bash
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
yarn add --save-dev @types/node
|
|
241
|
+
yarn typecheck
|
|
242
242
|
```
|
|
243
243
|
|
|
244
244
|
### Vanilla JavaScript
|
|
@@ -271,13 +271,13 @@ tsgo is a Go port of the TypeScript compiler that is 10x faster than tsc.
|
|
|
271
271
|
**Installation:**
|
|
272
272
|
|
|
273
273
|
```bash
|
|
274
|
-
|
|
274
|
+
yarn add --save-dev @typescript/native-preview
|
|
275
275
|
```
|
|
276
276
|
|
|
277
277
|
**Usage:**
|
|
278
278
|
|
|
279
279
|
```bash
|
|
280
|
-
|
|
280
|
+
yarn tsgo --noEmit
|
|
281
281
|
```
|
|
282
282
|
|
|
283
283
|
The package will automatically detect tsgo and use it when available.
|
|
@@ -471,7 +471,7 @@ console.log(cmd) // 'tsgo --noEmit || vue-tsc --noEmit'
|
|
|
471
471
|
**Solution:** Install the @types package:
|
|
472
472
|
|
|
473
473
|
```bash
|
|
474
|
-
|
|
474
|
+
yarn add --save-dev @types/node @types/react @types/react-dom
|
|
475
475
|
```
|
|
476
476
|
|
|
477
477
|
### Vue .vue files not type checking
|
|
@@ -481,8 +481,8 @@ npm install --save-dev @types/node @types/react @types/react-dom
|
|
|
481
481
|
**Solution:** Install and use vue-tsc:
|
|
482
482
|
|
|
483
483
|
```bash
|
|
484
|
-
|
|
485
|
-
|
|
484
|
+
yarn add --save-dev vue-tsc
|
|
485
|
+
yarn vue-tsc --noEmit
|
|
486
486
|
```
|
|
487
487
|
|
|
488
488
|
### tsgo not found
|
|
@@ -492,7 +492,7 @@ npx vue-tsc --noEmit
|
|
|
492
492
|
**Solution:** Install @typescript/native-preview:
|
|
493
493
|
|
|
494
494
|
```bash
|
|
495
|
-
|
|
495
|
+
yarn add --save-dev @typescript/native-preview
|
|
496
496
|
```
|
|
497
497
|
|
|
498
498
|
### Slow type checking
|