uilint-eslint 0.2.41 → 0.2.43

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 (55) hide show
  1. package/dist/index.d.ts +23 -1
  2. package/dist/index.js +16 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/rules/consistent-dark-mode.js +1 -0
  5. package/dist/rules/consistent-dark-mode.js.map +1 -1
  6. package/dist/rules/consistent-spacing.js +1 -0
  7. package/dist/rules/consistent-spacing.js.map +1 -1
  8. package/dist/rules/enforce-absolute-imports.js +1 -0
  9. package/dist/rules/enforce-absolute-imports.js.map +1 -1
  10. package/dist/rules/no-any-in-props.js +1 -0
  11. package/dist/rules/no-any-in-props.js.map +1 -1
  12. package/dist/rules/no-arbitrary-tailwind.js +1 -0
  13. package/dist/rules/no-arbitrary-tailwind.js.map +1 -1
  14. package/dist/rules/no-direct-store-import.js +1 -0
  15. package/dist/rules/no-direct-store-import.js.map +1 -1
  16. package/dist/rules/no-mixed-component-libraries.js +1 -0
  17. package/dist/rules/no-mixed-component-libraries.js.map +1 -1
  18. package/dist/rules/no-prop-drilling-depth.js +1 -0
  19. package/dist/rules/no-prop-drilling-depth.js.map +1 -1
  20. package/dist/rules/no-secrets-in-code.js +1 -0
  21. package/dist/rules/no-secrets-in-code.js.map +1 -1
  22. package/dist/rules/no-semantic-duplicates.js +1 -0
  23. package/dist/rules/no-semantic-duplicates.js.map +1 -1
  24. package/dist/rules/prefer-zustand-state-management.js +1 -0
  25. package/dist/rules/prefer-zustand-state-management.js.map +1 -1
  26. package/dist/rules/require-input-validation.js +1 -0
  27. package/dist/rules/require-input-validation.js.map +1 -1
  28. package/dist/rules/require-test-coverage.js +1 -0
  29. package/dist/rules/require-test-coverage.js.map +1 -1
  30. package/dist/rules/semantic-vision.js +1 -0
  31. package/dist/rules/semantic-vision.js.map +1 -1
  32. package/dist/rules/semantic.js +1 -0
  33. package/dist/rules/semantic.js.map +1 -1
  34. package/dist/rules/zustand-use-selectors.js +1 -0
  35. package/dist/rules/zustand-use-selectors.js.map +1 -1
  36. package/package.json +2 -2
  37. package/src/index.ts +1 -0
  38. package/src/rule-registry.ts +1 -0
  39. package/src/rules/consistent-dark-mode.ts +1 -0
  40. package/src/rules/consistent-spacing.ts +1 -0
  41. package/src/rules/enforce-absolute-imports.ts +1 -0
  42. package/src/rules/no-any-in-props.ts +1 -0
  43. package/src/rules/no-arbitrary-tailwind.ts +1 -0
  44. package/src/rules/no-direct-store-import.ts +1 -0
  45. package/src/rules/no-mixed-component-libraries/index.ts +1 -0
  46. package/src/rules/no-prop-drilling-depth.ts +1 -0
  47. package/src/rules/no-secrets-in-code.ts +1 -0
  48. package/src/rules/no-semantic-duplicates.ts +1 -0
  49. package/src/rules/prefer-zustand-state-management.ts +1 -0
  50. package/src/rules/require-input-validation.ts +1 -0
  51. package/src/rules/require-test-coverage/index.ts +1 -0
  52. package/src/rules/semantic/index.ts +1 -0
  53. package/src/rules/semantic-vision.ts +1 -0
  54. package/src/rules/zustand-use-selectors.ts +1 -0
  55. package/src/utils/create-rule.ts +25 -0
package/dist/index.d.ts CHANGED
@@ -49,6 +49,21 @@ interface RuleRequirement {
49
49
  /** Optional: how to satisfy the requirement */
50
50
  setupHint?: string;
51
51
  }
52
+ /**
53
+ * Rule migration definition for updating rule options between versions
54
+ */
55
+ interface RuleMigration {
56
+ /** Source version (semver) */
57
+ from: string;
58
+ /** Target version (semver) */
59
+ to: string;
60
+ /** Human-readable description of what changed */
61
+ description: string;
62
+ /** Function to migrate options from old format to new format */
63
+ migrate: (oldOptions: unknown[]) => unknown[];
64
+ /** Whether this migration contains breaking changes */
65
+ breaking?: boolean;
66
+ }
52
67
  /**
53
68
  * Colocated rule metadata - exported alongside each rule
54
69
  *
@@ -58,6 +73,8 @@ interface RuleRequirement {
58
73
  interface RuleMeta {
59
74
  /** Rule identifier (e.g., "no-arbitrary-tailwind") - must match filename */
60
75
  id: string;
76
+ /** Semantic version of the rule (e.g., "1.0.0") */
77
+ version: string;
61
78
  /** Display name for CLI (e.g., "No Arbitrary Tailwind") */
62
79
  name: string;
63
80
  /** Short description for CLI selection prompts (one line) */
@@ -113,6 +130,11 @@ interface RuleMeta {
113
130
  * ./.uilint/rules/rule-id.js
114
131
  */
115
132
  isDirectoryBased?: boolean;
133
+ /**
134
+ * Migrations for updating rule options between versions.
135
+ * Migrations are applied in order to transform options from older versions.
136
+ */
137
+ migrations?: RuleMigration[];
116
138
  }
117
139
  /**
118
140
  * Helper to define rule metadata with type safety
@@ -906,4 +928,4 @@ interface UILintESLint {
906
928
  */
907
929
  declare const uilintEslint: UILintESLint;
908
930
 
909
- export { type AggregatedCoverage, type CacheEntry, type CacheStore, type CachedIssue, type CategoryMeta, type CoverageStats, type DependencyGraph, type FileCategory, type FileCategoryResult, type FileCoverageInfo, type IstanbulCoverage, type IstanbulFileCoverage, type JSXCoverageResult, type LibraryName, type OptionFieldSchema, type RuleMeta, type RuleMeta as RuleMetadata, type RuleOptionSchema, type RuleRequirement, type SourceLocation, type UILintESLint, aggregateCoverage, analyzeJSXElementCoverage, buildDataLoc, buildDependencyGraph, calculateCoverageFromStatements, categorizeFile, categoryRegistry, clearCache$1 as clearCache, clearCacheEntry, clearCache as clearImportGraphCache, configs, createRule, uilintEslint as default, defineRuleMeta, findCoverageForFile, findStatementsInRange, findStyleguidePath, getAllRuleIds, getCacheEntry, getCategoryMeta, getComponentLibrary, getRuleDocs, getRuleMetadata, getRulesByCategory, getStyleguide, hashContent, hashContentSync, isEventHandlerAttribute, loadCache, loadStyleguide, meta, plugin, ruleRegistry, rules, saveCache, setCacheEntry };
931
+ export { type AggregatedCoverage, type CacheEntry, type CacheStore, type CachedIssue, type CategoryMeta, type CoverageStats, type DependencyGraph, type FileCategory, type FileCategoryResult, type FileCoverageInfo, type IstanbulCoverage, type IstanbulFileCoverage, type JSXCoverageResult, type LibraryName, type OptionFieldSchema, type RuleMeta, type RuleMeta as RuleMetadata, type RuleMigration, type RuleOptionSchema, type RuleRequirement, type SourceLocation, type UILintESLint, aggregateCoverage, analyzeJSXElementCoverage, buildDataLoc, buildDependencyGraph, calculateCoverageFromStatements, categorizeFile, categoryRegistry, clearCache$1 as clearCache, clearCacheEntry, clearCache as clearImportGraphCache, configs, createRule, uilintEslint as default, defineRuleMeta, findCoverageForFile, findStatementsInRange, findStyleguidePath, getAllRuleIds, getCacheEntry, getCategoryMeta, getComponentLibrary, getRuleDocs, getRuleMetadata, getRulesByCategory, getStyleguide, hashContent, hashContentSync, isEventHandlerAttribute, loadCache, loadStyleguide, meta, plugin, ruleRegistry, rules, saveCache, setCacheEntry };
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ function defineRuleMeta(meta18) {
10
10
  // src/rules/no-arbitrary-tailwind.ts
11
11
  var meta = defineRuleMeta({
12
12
  id: "no-arbitrary-tailwind",
13
+ version: "1.0.0",
13
14
  name: "No Arbitrary Tailwind",
14
15
  description: "Forbid arbitrary values like w-[123px], bg-[#fff]",
15
16
  defaultSeverity: "error",
@@ -129,6 +130,7 @@ function checkClassString(context, node, classString) {
129
130
  // src/rules/consistent-spacing.ts
130
131
  var meta2 = defineRuleMeta({
131
132
  id: "consistent-spacing",
133
+ version: "1.0.0",
132
134
  name: "Consistent Spacing",
133
135
  description: "Enforce spacing scale (no magic numbers in gap/padding)",
134
136
  defaultSeverity: "warn",
@@ -358,6 +360,7 @@ function checkSpacing(context, node, classString, scale, scaleList) {
358
360
  // src/rules/consistent-dark-mode.ts
359
361
  var meta3 = defineRuleMeta({
360
362
  id: "consistent-dark-mode",
363
+ version: "1.0.0",
361
364
  name: "Consistent Dark Mode",
362
365
  description: "Ensure consistent dark: theming (error on mix, warn on missing)",
363
366
  defaultSeverity: "error",
@@ -695,6 +698,7 @@ var consistent_dark_mode_default = createRule({
695
698
  // src/rules/no-direct-store-import.ts
696
699
  var meta4 = defineRuleMeta({
697
700
  id: "no-direct-store-import",
701
+ version: "1.0.0",
698
702
  name: "No Direct Store Import",
699
703
  description: "Forbid direct Zustand store imports (use context hooks)",
700
704
  defaultSeverity: "warn",
@@ -836,6 +840,7 @@ var no_direct_store_import_default = createRule({
836
840
  // src/rules/prefer-zustand-state-management.ts
837
841
  var meta5 = defineRuleMeta({
838
842
  id: "prefer-zustand-state-management",
843
+ version: "1.0.0",
839
844
  name: "Prefer Zustand State Management",
840
845
  description: "Detect excessive useState/useReducer/useContext; suggest Zustand",
841
846
  defaultSeverity: "warn",
@@ -1618,6 +1623,7 @@ function clearCache() {
1618
1623
  // src/rules/no-mixed-component-libraries/index.ts
1619
1624
  var meta6 = defineRuleMeta({
1620
1625
  id: "no-mixed-component-libraries",
1626
+ version: "1.0.0",
1621
1627
  name: "No Mixed Component Libraries",
1622
1628
  description: "Forbid mixing component libraries (e.g., shadcn + MUI)",
1623
1629
  defaultSeverity: "error",
@@ -2004,6 +2010,7 @@ import { UILINT_DEFAULT_OLLAMA_MODEL } from "uilint-core";
2004
2010
  import { buildSourceScanPrompt } from "uilint-core";
2005
2011
  var meta7 = defineRuleMeta({
2006
2012
  id: "semantic",
2013
+ version: "1.0.0",
2007
2014
  name: "Semantic Analysis",
2008
2015
  description: "LLM-powered semantic UI analysis using your styleguide",
2009
2016
  defaultSeverity: "warn",
@@ -2346,6 +2353,7 @@ import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync5 }
2346
2353
  import { dirname as dirname5, join as join5, relative as relative2 } from "path";
2347
2354
  var meta8 = defineRuleMeta({
2348
2355
  id: "semantic-vision",
2356
+ version: "1.0.0",
2349
2357
  name: "Vision Analysis",
2350
2358
  description: "Report cached vision analysis results from UILint browser overlay",
2351
2359
  defaultSeverity: "warn",
@@ -2566,6 +2574,7 @@ var semantic_vision_default = createRule({
2566
2574
  // src/rules/enforce-absolute-imports.ts
2567
2575
  var meta9 = defineRuleMeta({
2568
2576
  id: "enforce-absolute-imports",
2577
+ version: "1.0.0",
2569
2578
  name: "Enforce Absolute Imports",
2570
2579
  description: "Require alias imports for paths beyond a configurable directory depth",
2571
2580
  defaultSeverity: "warn",
@@ -2741,6 +2750,7 @@ var enforce_absolute_imports_default = createRule({
2741
2750
  // src/rules/no-any-in-props.ts
2742
2751
  var meta10 = defineRuleMeta({
2743
2752
  id: "no-any-in-props",
2753
+ version: "1.0.0",
2744
2754
  name: "No Any in Props",
2745
2755
  description: "Disallow 'any' type in React component props",
2746
2756
  defaultSeverity: "error",
@@ -3090,6 +3100,7 @@ var no_any_in_props_default = createRule({
3090
3100
  // src/rules/zustand-use-selectors.ts
3091
3101
  var meta11 = defineRuleMeta({
3092
3102
  id: "zustand-use-selectors",
3103
+ version: "1.0.0",
3093
3104
  name: "Zustand Use Selectors",
3094
3105
  description: "Require selector functions when accessing Zustand store state",
3095
3106
  defaultSeverity: "warn",
@@ -3318,6 +3329,7 @@ var zustand_use_selectors_default = createRule({
3318
3329
  // src/rules/no-prop-drilling-depth.ts
3319
3330
  var meta12 = defineRuleMeta({
3320
3331
  id: "no-prop-drilling-depth",
3332
+ version: "1.0.0",
3321
3333
  name: "No Prop Drilling Depth",
3322
3334
  description: "Warn when props are drilled through too many components",
3323
3335
  defaultSeverity: "warn",
@@ -3673,6 +3685,7 @@ var no_prop_drilling_depth_default = createRule({
3673
3685
  // src/rules/no-secrets-in-code.ts
3674
3686
  var meta13 = defineRuleMeta({
3675
3687
  id: "no-secrets-in-code",
3688
+ version: "1.0.0",
3676
3689
  name: "No Secrets in Code",
3677
3690
  description: "Detect hardcoded secrets, API keys, and tokens",
3678
3691
  defaultSeverity: "error",
@@ -4027,6 +4040,7 @@ var no_secrets_in_code_default = createRule({
4027
4040
  // src/rules/require-input-validation.ts
4028
4041
  var meta14 = defineRuleMeta({
4029
4042
  id: "require-input-validation",
4043
+ version: "1.0.0",
4030
4044
  name: "Require Input Validation",
4031
4045
  description: "Require schema validation in API route handlers",
4032
4046
  defaultSeverity: "warn",
@@ -4368,6 +4382,7 @@ function log(message) {
4368
4382
  }
4369
4383
  var meta15 = defineRuleMeta({
4370
4384
  id: "no-semantic-duplicates",
4385
+ version: "1.0.0",
4371
4386
  name: "No Semantic Duplicates",
4372
4387
  description: "Warn when code is semantically similar to existing code",
4373
4388
  defaultSeverity: "warn",
@@ -5996,6 +6011,7 @@ function simpleGlobMatch(pattern, path) {
5996
6011
  }
5997
6012
  var meta16 = defineRuleMeta({
5998
6013
  id: "require-test-coverage",
6014
+ version: "1.0.0",
5999
6015
  name: "Require Test Coverage",
6000
6016
  description: "Enforce that source files have adequate test coverage",
6001
6017
  defaultSeverity: "warn",