@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,18 @@
1
+ /**
2
+ * React/Solid-specific Stylelint preset
3
+ *
4
+ * Note: Most React/Solid projects use CSS-in-JS (styled-components, emotion, etc.)
5
+ * which is better linted by ESLint plugins, not Stylelint.
6
+ *
7
+ * This preset is for React/Solid projects that use separate CSS files.
8
+ * If you're using CSS-in-JS exclusively, you don't need Stylelint.
9
+ *
10
+ * CSS Modules support is added conditionally in the factory function
11
+ * when Tailwind CSS is not detected.
12
+ */
13
+
14
+ export default {
15
+ // No special rules needed for React/Solid CSS files
16
+ // They use standard CSS, so base preset is sufficient
17
+ rules: {}
18
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Svelte-specific Stylelint preset
3
+ *
4
+ * Handles <style> blocks in Svelte components (.svelte files)
5
+ *
6
+ * Requires: postcss-html (peer dependency)
7
+ */
8
+
9
+ export default {
10
+ extends: ['stylelint-config-standard'],
11
+
12
+ overrides: [
13
+ {
14
+ files: ['**/*.svelte'],
15
+ customSyntax: 'postcss-html'
16
+ }
17
+ ],
18
+
19
+ rules: {
20
+ // Allow Svelte :global() pseudo-class
21
+ 'selector-pseudo-class-no-unknown': [
22
+ true,
23
+ {
24
+ ignorePseudoClasses: ['global']
25
+ }
26
+ ]
27
+ }
28
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Vanilla JavaScript / Angular / Node.js Stylelint preset
3
+ *
4
+ * For projects with standard CSS files (no framework-specific syntax)
5
+ * This includes:
6
+ * - Vanilla JavaScript projects
7
+ * - Angular projects (component styles use standard CSS)
8
+ * - Any project with separate .css files
9
+ */
10
+
11
+ export default {
12
+ // No framework-specific rules needed
13
+ // Base preset provides everything required for standard CSS
14
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Vue-specific Stylelint preset
3
+ *
4
+ * Handles <style> blocks in Vue Single File Components (.vue files)
5
+ *
6
+ * Requires:
7
+ * - stylelint-config-standard-vue
8
+ * - postcss-html (peer dependencies)
9
+ */
10
+
11
+ export default {
12
+ extends: ['stylelint-config-standard-vue'],
13
+
14
+ overrides: [
15
+ {
16
+ files: ['**/*.vue'],
17
+ customSyntax: 'postcss-html'
18
+ }
19
+ ],
20
+
21
+ rules: {
22
+ // Allow Vue-specific pseudo-classes
23
+ 'selector-pseudo-class-no-unknown': [
24
+ true,
25
+ {
26
+ ignorePseudoClasses: ['deep', 'global', 'slotted']
27
+ }
28
+ ],
29
+
30
+ // Allow Vue-specific pseudo-elements
31
+ 'selector-pseudo-element-no-unknown': [
32
+ true,
33
+ {
34
+ ignorePseudoElements: ['v-deep', 'v-global', 'v-slotted']
35
+ }
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,83 @@
1
+ /**
2
+ * SCSS/Sass Stylelint preset
3
+ *
4
+ * Standard SCSS linting rules for projects using Sass.
5
+ * Extends the standard SCSS configuration with additional quality rules.
6
+ *
7
+ * Key principles:
8
+ * - Support SCSS syntax (variables, mixins, nesting, etc.)
9
+ * - Enforce modern SCSS practices
10
+ * - Avoid common SCSS mistakes
11
+ * - Maintain consistency with CSS base rules
12
+ */
13
+
14
+ export default {
15
+ extends: ['stylelint-config-standard-scss'],
16
+
17
+ rules: {
18
+ // Color rules
19
+ 'color-hex-length': 'short',
20
+
21
+ // Variables
22
+ 'scss/dollar-variable-colon-space-after': 'always',
23
+ 'scss/dollar-variable-colon-space-before': 'never',
24
+ 'scss/dollar-variable-pattern': [
25
+ '^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$',
26
+ {
27
+ message: 'Expected variable to be kebab-case'
28
+ }
29
+ ],
30
+
31
+ // Operators
32
+ 'scss/operator-no-newline-after': true,
33
+ 'scss/operator-no-unspaced': true,
34
+
35
+ // Nesting
36
+ 'max-nesting-depth': 4, // Allow one more level for SCSS
37
+
38
+ // At-rules (allow Tailwind if present)
39
+ 'scss/at-rule-no-unknown': [
40
+ true,
41
+ {
42
+ ignoreAtRules: ['tailwind', 'apply', 'variants', 'responsive', 'screen', 'layer']
43
+ }
44
+ ],
45
+
46
+ // Mixins
47
+ 'scss/at-mixin-pattern': [
48
+ '^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$',
49
+ {
50
+ message: 'Expected mixin name to be kebab-case'
51
+ }
52
+ ],
53
+
54
+ // Functions
55
+ 'scss/at-function-pattern': [
56
+ '^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$',
57
+ {
58
+ message: 'Expected function name to be kebab-case'
59
+ }
60
+ ],
61
+
62
+ // Placeholder selectors
63
+ 'scss/percent-placeholder-pattern': [
64
+ '^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$',
65
+ {
66
+ message: 'Expected placeholder to be kebab-case'
67
+ }
68
+ ],
69
+
70
+ // Selector rules (inherit from base)
71
+ 'selector-max-id': 0,
72
+ 'selector-no-qualifying-type': true,
73
+ 'selector-class-pattern': [
74
+ '^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$',
75
+ {
76
+ message: 'Expected class selector to be kebab-case or BEM format'
77
+ }
78
+ ],
79
+
80
+ // Disable some rules that conflict with SCSS
81
+ 'no-descending-specificity': null
82
+ }
83
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Tailwind CSS Stylelint preset
3
+ *
4
+ * Configuration for projects using Tailwind CSS.
5
+ * Disables rules that conflict with Tailwind's utility-first approach.
6
+ *
7
+ * Key principles:
8
+ * - Allow Tailwind directives (@tailwind, @apply, @layer, etc.)
9
+ * - Disable rules that conflict with utility classes
10
+ * - Support arbitrary values and variants
11
+ * - Work alongside regular CSS/SCSS
12
+ */
13
+
14
+ export default {
15
+ // Note: We don't extend stylelint-config-tailwindcss because it's too opinionated
16
+ // Instead, we selectively disable conflicting rules
17
+
18
+ rules: {
19
+ // Allow Tailwind at-rules
20
+ 'at-rule-no-unknown': [
21
+ true,
22
+ {
23
+ ignoreAtRules: ['tailwind', 'apply', 'layer', 'variants', 'responsive', 'screen', 'config']
24
+ }
25
+ ],
26
+
27
+ // Allow Tailwind functions
28
+ 'function-no-unknown': [
29
+ true,
30
+ {
31
+ ignoreFunctions: ['theme', 'screen']
32
+ }
33
+ ],
34
+
35
+ // Disable rules that conflict with Tailwind's utility classes
36
+ 'selector-class-pattern': null, // Tailwind uses various patterns
37
+ 'selector-max-id': null, // Allow IDs (though not recommended)
38
+ 'no-descending-specificity': null, // Utility classes have complex specificity
39
+ 'declaration-block-no-redundant-longhand-properties': null, // Utilities may look redundant
40
+
41
+ // Allow unknown properties (Tailwind CSS variables)
42
+ 'property-no-unknown': [
43
+ true,
44
+ {
45
+ ignoreProperties: ['/^--/'] // Allow CSS custom properties
46
+ }
47
+ ]
48
+ }
49
+ }
@@ -0,0 +1,42 @@
1
+ import { existsSync, readFileSync } from 'fs'
2
+ import { join } from 'path'
3
+
4
+ /**
5
+ * Read and parse package.json from a directory
6
+ * @param {string} cwd - Directory path
7
+ * @returns {Object|null} Parsed package.json or null if not found
8
+ */
9
+ export function readPackageJson(cwd) {
10
+ const packagePath = join(cwd, 'package.json')
11
+
12
+ if (!existsSync(packagePath)) {
13
+ return null
14
+ }
15
+
16
+ try {
17
+ const content = readFileSync(packagePath, 'utf8')
18
+ return JSON.parse(content)
19
+ } catch (error) {
20
+ console.warn(`Warning: Failed to read package.json: ${error.message}`)
21
+ return null
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Get production dependencies from package.json
27
+ * Only returns dependencies, not devDependencies, since devDependencies
28
+ * are for tooling/testing and should not influence framework detection.
29
+ * @param {Object} pkg - Parsed package.json
30
+ * @returns {Object} Production dependencies
31
+ */
32
+ export function getAllDependencies(pkg) {
33
+ if (!pkg) {
34
+ return {}
35
+ }
36
+
37
+ // Only return production dependencies for framework detection
38
+ // devDependencies are for tooling/testing, not the actual framework
39
+ return {
40
+ ...pkg.dependencies
41
+ }
42
+ }