@dimensional-innovations/tool-config 3.0.0 → 3.0.1
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 +37 -177
- package/bin/lib/handlers/stylelint.js +2 -2
- package/package.json +5 -4
- package/src/tools/stylelint/README.md +9 -9
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/@dimensional-innovations/tool-config)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
|
-
[](./tests/)
|
|
9
9
|
|
|
10
10
|
**One package. Five tools. Zero configuration.**
|
|
11
11
|
|
|
@@ -35,13 +35,13 @@ npm install --save-dev @dimensional-innovations/tool-config
|
|
|
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
|
|
|
@@ -120,8 +120,8 @@ 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
127
|
"check-all": "npm run prettier && npm run style && npm run lint && npm run typecheck"
|
|
@@ -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
|
|
@@ -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,77 +640,20 @@ 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: `npm install --save-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
|
-
npm install --save-dev prettier-plugin-svelte #
|
|
773
|
-
npm install --save-dev prettier-plugin-astro #
|
|
650
|
+
npm install --save-dev prettier-plugin-svelte # Svelte
|
|
651
|
+
npm install --save-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
|
|
|
@@ -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
|
|
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.1",
|
|
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": {
|
|
@@ -60,10 +60,11 @@
|
|
|
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": "npm run prettier && npm run style && npm run lint && npm run typecheck"
|
|
67
68
|
},
|
|
68
69
|
"dependencies": {
|
|
69
70
|
"@eslint/compat": "^1.4.0",
|
|
@@ -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
|
```
|
|
@@ -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
|
```
|