@dimensional-innovations/tool-config 1.0.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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +646 -0
  3. package/bin/setup-tool-config.js +675 -0
  4. package/package.json +168 -0
  5. package/src/detectors.js +261 -0
  6. package/src/index.js +64 -0
  7. package/src/tools/eslint/index.js +287 -0
  8. package/src/tools/eslint/presets/base.js +82 -0
  9. package/src/tools/eslint/presets/environments/browser.js +16 -0
  10. package/src/tools/eslint/presets/environments/node.js +21 -0
  11. package/src/tools/eslint/presets/environments/universal.js +18 -0
  12. package/src/tools/eslint/presets/frameworks/angular.js +74 -0
  13. package/src/tools/eslint/presets/frameworks/astro.js +38 -0
  14. package/src/tools/eslint/presets/frameworks/node.js +57 -0
  15. package/src/tools/eslint/presets/frameworks/react.js +76 -0
  16. package/src/tools/eslint/presets/frameworks/solid.js +45 -0
  17. package/src/tools/eslint/presets/frameworks/svelte.js +78 -0
  18. package/src/tools/eslint/presets/frameworks/vanilla.js +16 -0
  19. package/src/tools/eslint/presets/frameworks/vue.js +125 -0
  20. package/src/tools/eslint/presets/imports.js +41 -0
  21. package/src/tools/eslint/presets/typescript.js +131 -0
  22. package/src/tools/prettier/README.md +398 -0
  23. package/src/tools/prettier/index.js +114 -0
  24. package/src/tools/prettier/presets/base.js +36 -0
  25. package/src/tools/prettier/presets/frameworks/astro.js +15 -0
  26. package/src/tools/prettier/presets/frameworks/react.js +15 -0
  27. package/src/tools/prettier/presets/frameworks/svelte.js +22 -0
  28. package/src/tools/prettier/presets/frameworks/vanilla.js +13 -0
  29. package/src/tools/prettier/presets/frameworks/vue.js +20 -0
  30. package/src/tools/prettier/presets/prettierignore.js +56 -0
  31. package/src/tools/semantic-release/CI_SETUP.md +66 -0
  32. package/src/tools/semantic-release/README.md +533 -0
  33. package/src/tools/semantic-release/index.js +130 -0
  34. package/src/tools/semantic-release/presets/default.js +37 -0
  35. package/src/tools/semantic-release/presets/library.js +58 -0
  36. package/src/tools/semantic-release/presets/monorepo.js +48 -0
  37. package/src/tools/semantic-release/templates/.gitlab-ci.yml +85 -0
  38. package/src/tools/semantic-release/templates/bitbucket-pipelines.yml +100 -0
  39. package/src/tools/semantic-release/templates/github-workflow.yml +107 -0
  40. package/src/tools/stylelint/README.md +425 -0
  41. package/src/tools/stylelint/index.js +191 -0
  42. package/src/tools/stylelint/presets/base.js +50 -0
  43. package/src/tools/stylelint/presets/css-modules.js +43 -0
  44. package/src/tools/stylelint/presets/frameworks/react.js +18 -0
  45. package/src/tools/stylelint/presets/frameworks/svelte.js +28 -0
  46. package/src/tools/stylelint/presets/frameworks/vanilla.js +14 -0
  47. package/src/tools/stylelint/presets/frameworks/vue.js +38 -0
  48. package/src/tools/stylelint/presets/scss.js +83 -0
  49. package/src/tools/stylelint/presets/tailwind.js +49 -0
  50. package/src/utils/package-reader.js +42 -0
@@ -0,0 +1,45 @@
1
+ import solid from 'eslint-plugin-solid/configs/typescript'
2
+
3
+ /**
4
+ * Solid.js framework configuration
5
+ * Conservative rules for Solid reactive primitives and JSX
6
+ *
7
+ * Rules organized by category:
8
+ * - Reactive primitives (signals, effects, memos)
9
+ * - JSX best practices
10
+ * - Component patterns
11
+ */
12
+ export default function createSolidPreset() {
13
+ return [
14
+ {
15
+ files: ['**/*.jsx', '**/*.tsx'],
16
+ ...solid,
17
+ rules: {
18
+ ...solid.rules,
19
+
20
+ // Reactive Primitives (7 rules)
21
+ 'solid/reactivity': 'error', // Enforce reactive dependencies
22
+ 'solid/no-destructure': 'error', // Don't destructure props (loses reactivity)
23
+ 'solid/prefer-for': 'error', // Use <For> over .map()
24
+ 'solid/no-innerhtml': ['error', { allowStatic: true }], // Prevent XSS
25
+ 'solid/event-handlers': [
26
+ 'error',
27
+ {
28
+ // Consistent event handler naming
29
+ ignoreCase: false,
30
+ warnOnSpread: false
31
+ }
32
+ ],
33
+ 'solid/jsx-no-undef': 'error', // Undefined components
34
+ 'solid/jsx-uses-vars': 'error', // Mark JSX vars as used
35
+
36
+ // Component Best Practices (5 rules)
37
+ 'solid/components-return-once': 'error', // Single return per component
38
+ 'solid/no-unknown-namespaces': 'error', // Validate JSX namespaces
39
+ 'solid/prefer-show': 'error', // Use <Show> over ternary
40
+ 'solid/self-closing-comp': 'error', // Self-close components without children
41
+ 'solid/style-prop': ['error', { styleProps: ['style', 'css'] }] // Validate style prop
42
+ }
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,78 @@
1
+ import svelte from 'eslint-plugin-svelte'
2
+ import svelteParser from 'svelte-eslint-parser'
3
+ import tseslint from 'typescript-eslint'
4
+
5
+ /**
6
+ * Svelte.js framework configuration
7
+ * Comprehensive rules for Svelte 5 (runes, snippets) and SvelteKit projects
8
+ *
9
+ * Rules organized by category:
10
+ * - Core Svelte best practices
11
+ * - Svelte 5 runes mode
12
+ * - Code style and formatting
13
+ *
14
+ * Note: Accessibility checks are handled by Svelte compiler warnings via svelte/valid-compile
15
+ */
16
+ export default function createSveltePreset() {
17
+ return [
18
+ ...svelte.configs['flat/recommended'],
19
+ {
20
+ files: ['**/*.svelte'],
21
+ languageOptions: {
22
+ parser: svelteParser,
23
+ parserOptions: {
24
+ parser: tseslint.parser,
25
+ extraFileExtensions: ['.svelte']
26
+ }
27
+ },
28
+ rules: {
29
+ // Core Svelte Best Practices (7 rules)
30
+ 'svelte/no-at-html-tags': 'error',
31
+ 'svelte/no-target-blank': 'error',
32
+ 'svelte/no-reactive-reassign': 'error',
33
+ 'svelte/require-store-reactive-access': 'error',
34
+ 'svelte/valid-compile': 'error',
35
+ 'svelte/no-unused-svelte-ignore': 'error',
36
+ 'svelte/no-useless-mustaches': 'error',
37
+ 'svelte/require-optimized-style-attribute': 'error',
38
+
39
+ // Svelte 5 (runes mode) - 4 rules
40
+ 'svelte/block-lang': [
41
+ 'error',
42
+ {
43
+ script: 'ts',
44
+ style: null
45
+ }
46
+ ],
47
+ 'svelte/no-dom-manipulating': 'error',
48
+ 'svelte/no-export-load-in-svelte-module-in-kit-pages': 'error',
49
+ 'svelte/no-store-async': 'error',
50
+
51
+ // Code Style (6 rules)
52
+ 'svelte/shorthand-attribute': 'error',
53
+ 'svelte/shorthand-directive': 'error',
54
+ 'svelte/no-spaces-around-equal-signs-in-attribute': 'error',
55
+ 'svelte/html-quotes': [
56
+ 'error',
57
+ {
58
+ prefer: 'double'
59
+ }
60
+ ],
61
+ 'svelte/indent': [
62
+ 'error',
63
+ {
64
+ indent: 2,
65
+ alignAttributesVertically: true
66
+ }
67
+ ],
68
+ 'svelte/first-attribute-linebreak': [
69
+ 'error',
70
+ {
71
+ multiline: 'below',
72
+ singleline: 'beside'
73
+ }
74
+ ]
75
+ }
76
+ }
77
+ ]
78
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Vanilla JavaScript/TypeScript configuration
3
+ * No framework-specific rules - just modern JavaScript best practices
4
+ * Perfect for: libraries, utilities, Node.js apps without frameworks
5
+ */
6
+ export default function createVanillaPreset() {
7
+ return [
8
+ {
9
+ files: ['**/*.js', '**/*.ts', '**/*.tsx'],
10
+ rules: {
11
+ // No framework-specific rules
12
+ // All rules come from base.js and typescript.js presets
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,125 @@
1
+ import vuePlugin from 'eslint-plugin-vue'
2
+ import tseslint from 'typescript-eslint'
3
+
4
+ /**
5
+ * Vue.js 3 configuration
6
+ * Includes Vue plugin and Vue-specific rules
7
+ */
8
+ export default function createVuePreset() {
9
+ return [
10
+ // Vue recommended configuration (flat config)
11
+ ...vuePlugin.configs['flat/recommended'],
12
+
13
+ // Vue-specific custom rules
14
+ {
15
+ files: ['**/*.vue', '**/*.js', '**/*.ts', '**/*.tsx'],
16
+ rules: {
17
+ // ============================================================
18
+ // VUE.JS RULES
19
+ // Vue 3 best practices and conventions
20
+ // Documentation: https://eslint.vuejs.org/rules/
21
+ // ============================================================
22
+
23
+ // Component naming
24
+ 'vue/component-name-in-template-casing': ['error', 'PascalCase'], // Use PascalCase for components in templates
25
+ 'vue/multi-word-component-names': 'off', // Allow single-word component names (too strict)
26
+ 'vue/component-definition-name-casing': ['error', 'PascalCase'], // Use PascalCase for component definitions
27
+
28
+ // Template best practices
29
+ 'vue/html-self-closing': [
30
+ 'error',
31
+ {
32
+ html: {
33
+ void: 'always',
34
+ normal: 'always',
35
+ component: 'always'
36
+ }
37
+ }
38
+ ], // Always use self-closing tags for consistency
39
+ 'vue/max-attributes-per-line': [
40
+ 'error',
41
+ {
42
+ singleline: 3,
43
+ multiline: 1
44
+ }
45
+ ], // Limit attributes per line for readability
46
+ 'vue/first-attribute-linebreak': [
47
+ 'error',
48
+ {
49
+ singleline: 'ignore',
50
+ multiline: 'below'
51
+ }
52
+ ], // Enforce consistent attribute line breaks
53
+ 'vue/html-closing-bracket-newline': [
54
+ 'error',
55
+ {
56
+ singleline: 'never',
57
+ multiline: 'always'
58
+ }
59
+ ], // Enforce consistent closing bracket placement
60
+
61
+ // Vue 3 Composition API
62
+ 'vue/no-deprecated-v-on-native-modifier': 'error', // No .native modifier in Vue 3
63
+ 'vue/no-deprecated-slot-attribute': 'error', // Use v-slot instead of slot attribute
64
+ 'vue/require-explicit-emits': 'error', // Require emits to be declared
65
+ 'vue/no-setup-props-reactivity-loss': 'error', // Don't lose reactivity when using props
66
+ 'vue/component-api-style': ['error', ['script-setup']], // Prefer <script setup> syntax
67
+ 'vue/define-macros-order': [
68
+ 'error',
69
+ {
70
+ order: ['defineProps', 'defineEmits']
71
+ }
72
+ ], // Enforce consistent order of compiler macros
73
+ 'vue/define-emits-declaration': ['error', 'type-based'], // Use type-based emits declarations
74
+
75
+ // Directives
76
+ 'vue/no-v-html': 'warn', // Warn about v-html (XSS risk)
77
+ 'vue/v-on-event-hyphenation': ['error', 'always'], // Use kebab-case for event names
78
+ 'vue/v-bind-style': ['error', 'shorthand'], // Use : instead of v-bind:
79
+ 'vue/v-on-style': ['error', 'shorthand'], // Use @ instead of v-on:
80
+
81
+ // Attributes
82
+ 'vue/attribute-hyphenation': ['error', 'always'], // Use kebab-case for attributes in templates
83
+ 'vue/prop-name-casing': ['error', 'camelCase'], // Use camelCase for props in script
84
+
85
+ // Order and organization
86
+ 'vue/order-in-components': [
87
+ 'error',
88
+ {
89
+ order: [
90
+ 'el',
91
+ 'name',
92
+ 'parent',
93
+ 'functional',
94
+ ['delimiters', 'comments'],
95
+ ['components', 'directives', 'filters'],
96
+ 'extends',
97
+ 'mixins',
98
+ 'inheritAttrs',
99
+ 'model',
100
+ ['props', 'propsData'],
101
+ 'data',
102
+ 'computed',
103
+ 'watch',
104
+ 'LIFECYCLE_HOOKS',
105
+ 'methods',
106
+ ['template', 'render'],
107
+ 'renderError'
108
+ ]
109
+ }
110
+ ] // Enforce consistent component option order
111
+ }
112
+ },
113
+
114
+ // Vue-specific parser configuration
115
+ {
116
+ files: ['**/*.vue'],
117
+ languageOptions: {
118
+ parserOptions: {
119
+ parser: tseslint.parser,
120
+ extraFileExtensions: ['.vue']
121
+ }
122
+ }
123
+ }
124
+ ]
125
+ }
@@ -0,0 +1,41 @@
1
+ import { fixupPluginRules } from '@eslint/compat'
2
+ import importPlugin from 'eslint-plugin-import'
3
+
4
+ /**
5
+ * Import/export rules configuration
6
+ * Uses @eslint/compat for flat config compatibility
7
+ */
8
+ export default {
9
+ plugins: {
10
+ import: fixupPluginRules(importPlugin)
11
+ },
12
+ rules: {
13
+ // ============================================================
14
+ // IMPORT/MODULE RULES
15
+ // Module import/export best practices
16
+ // Documentation: https://github.com/import-js/eslint-plugin-import
17
+ // ============================================================
18
+
19
+ 'import/order': [
20
+ 'error',
21
+ {
22
+ groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
23
+ 'newlines-between': 'always',
24
+ alphabetize: {
25
+ order: 'asc',
26
+ caseInsensitive: true
27
+ }
28
+ }
29
+ ], // Enforce consistent import order with alphabetization
30
+ 'import/no-duplicates': 'error', // Prevent duplicate imports from same module
31
+ 'import/no-unresolved': 'off', // TypeScript handles this better
32
+ 'import/named': 'off', // TypeScript handles this better
33
+ 'import/namespace': 'off', // TypeScript handles this better
34
+ 'import/default': 'off', // TypeScript handles this better
35
+ 'import/no-named-as-default': 'warn', // Warn on potentially confusing imports
36
+ 'import/no-named-as-default-member': 'warn', // Warn on confusing member access
37
+ 'import/newline-after-import': 'error', // Require blank line after imports
38
+ 'import/no-webpack-loader-syntax': 'error', // No webpack loader syntax in imports
39
+ 'import/first': 'error' // Imports must be at the top of the file
40
+ }
41
+ }
@@ -0,0 +1,131 @@
1
+ /**
2
+ * TypeScript-specific rules
3
+ * Only included when TypeScript is detected or explicitly enabled
4
+ */
5
+ export default {
6
+ rules: {
7
+ // ============================================================
8
+ // TYPESCRIPT RULES
9
+ // TypeScript-specific linting and type safety
10
+ // Documentation: https://typescript-eslint.io/rules/
11
+ // ============================================================
12
+
13
+ // Type safety
14
+ '@typescript-eslint/no-explicit-any': 'warn', // Warn on any usage (allow when necessary)
15
+ // Note: Type-checked rules (no-unsafe-*) require TypeScript project configuration
16
+ // They are disabled here but available in recommended-type-checked preset
17
+
18
+ // Type annotations
19
+ '@typescript-eslint/explicit-function-return-type': 'off', // Too strict - TS can infer return types
20
+ '@typescript-eslint/explicit-module-boundary-types': 'off', // Too strict - TS can infer exports
21
+ '@typescript-eslint/typedef': [
22
+ 'error',
23
+ {
24
+ arrayDestructuring: false,
25
+ arrowParameter: false,
26
+ memberVariableDeclaration: false,
27
+ objectDestructuring: false,
28
+ parameter: false,
29
+ propertyDeclaration: true, // Require type annotations on class properties
30
+ variableDeclaration: false,
31
+ variableDeclarationIgnoreFunction: true
32
+ }
33
+ ], // Require type annotations in specific places
34
+
35
+ // Best practices
36
+ '@typescript-eslint/no-unused-vars': [
37
+ 'error',
38
+ {
39
+ argsIgnorePattern: '^_', // Allow unused args prefixed with _
40
+ varsIgnorePattern: '^_' // Allow unused vars prefixed with _
41
+ }
42
+ ],
43
+ '@typescript-eslint/prefer-for-of': 'error', // Prefer for-of over standard for loop with index
44
+ '@typescript-eslint/no-non-null-assertion': 'warn', // Warn on non-null assertions (! operator)
45
+
46
+ // Consistency
47
+ '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], // Prefer interface over type alias
48
+ '@typescript-eslint/consistent-type-imports': [
49
+ 'error',
50
+ {
51
+ prefer: 'type-imports', // Use import type for type-only imports
52
+ disallowTypeAnnotations: false
53
+ }
54
+ ],
55
+
56
+ // ============================================================
57
+ // NAMING CONVENTIONS
58
+ // Enforce consistent naming patterns across the codebase
59
+ // Documentation: https://typescript-eslint.io/rules/naming-convention/
60
+ //
61
+ // Patterns enforced:
62
+ // - camelCase: variables, functions, methods, parameters
63
+ // - PascalCase: classes, interfaces, types, enums
64
+ // - UPPER_CASE: constants and enum members
65
+ // - underscore prefix: private members, unused parameters
66
+ // ============================================================
67
+
68
+ '@typescript-eslint/naming-convention': [
69
+ 'error',
70
+ // Default: camelCase for most identifiers
71
+ {
72
+ selector: 'default',
73
+ format: ['camelCase'],
74
+ leadingUnderscore: 'allow',
75
+ trailingUnderscore: 'forbid'
76
+ },
77
+ // Variables: camelCase or UPPER_CASE for constants
78
+ {
79
+ selector: 'variable',
80
+ format: ['camelCase', 'UPPER_CASE', 'PascalCase'], // PascalCase for components
81
+ leadingUnderscore: 'allow'
82
+ },
83
+ // Functions and methods: camelCase
84
+ {
85
+ selector: ['function', 'method'],
86
+ format: ['camelCase']
87
+ },
88
+ // Classes, interfaces, types, enums: PascalCase
89
+ {
90
+ selector: 'typeLike',
91
+ format: ['PascalCase']
92
+ },
93
+ // Type parameters: PascalCase with T prefix
94
+ {
95
+ selector: 'typeParameter',
96
+ format: ['PascalCase'],
97
+ prefix: ['T']
98
+ },
99
+ // Enum members: PascalCase or UPPER_CASE
100
+ {
101
+ selector: 'enumMember',
102
+ format: ['PascalCase', 'UPPER_CASE']
103
+ },
104
+ // Object properties: allow camelCase or PascalCase (for API responses, component props)
105
+ {
106
+ selector: 'property',
107
+ format: ['camelCase', 'PascalCase'],
108
+ leadingUnderscore: 'allow',
109
+ filter: {
110
+ // Allow properties with special characters (ESLint rule names, etc.)
111
+ regex: '^(@|no-|prefer-|max-|vue/|import/|spaced-|react/).*$',
112
+ match: false
113
+ }
114
+ },
115
+ // Private class members: require underscore prefix
116
+ {
117
+ selector: 'memberLike',
118
+ modifiers: ['private'],
119
+ format: ['camelCase'],
120
+ leadingUnderscore: 'require'
121
+ },
122
+ // Unused parameters: require underscore prefix
123
+ {
124
+ selector: 'parameter',
125
+ modifiers: ['unused'],
126
+ format: ['camelCase'],
127
+ leadingUnderscore: 'require'
128
+ }
129
+ ]
130
+ }
131
+ }