uilint-eslint 0.2.164 → 0.2.166

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 (38) hide show
  1. package/dist/index.d.ts +72 -4
  2. package/dist/index.js +693 -89
  3. package/dist/index.js.map +1 -1
  4. package/dist/rules/consistent-dark-mode.js +309 -1
  5. package/dist/rules/consistent-dark-mode.js.map +1 -1
  6. package/dist/rules/enforce-absolute-imports.js +309 -1
  7. package/dist/rules/enforce-absolute-imports.js.map +1 -1
  8. package/dist/rules/no-any-in-props.js +309 -1
  9. package/dist/rules/no-any-in-props.js.map +1 -1
  10. package/dist/rules/no-direct-store-import.js +309 -1
  11. package/dist/rules/no-direct-store-import.js.map +1 -1
  12. package/dist/rules/no-mixed-component-libraries.js +321 -13
  13. package/dist/rules/no-mixed-component-libraries.js.map +1 -1
  14. package/dist/rules/no-prop-drilling-depth.js +309 -1
  15. package/dist/rules/no-prop-drilling-depth.js.map +1 -1
  16. package/dist/rules/no-raw-ui-elements.js +323 -15
  17. package/dist/rules/no-raw-ui-elements.js.map +1 -1
  18. package/dist/rules/no-secrets-in-code.js +309 -1
  19. package/dist/rules/no-secrets-in-code.js.map +1 -1
  20. package/dist/rules/no-unsafe-type-casts.js +309 -1
  21. package/dist/rules/no-unsafe-type-casts.js.map +1 -1
  22. package/dist/rules/prefer-store-selectors.js +309 -1
  23. package/dist/rules/prefer-store-selectors.js.map +1 -1
  24. package/dist/rules/prefer-tailwind.js +614 -41
  25. package/dist/rules/prefer-tailwind.js.map +1 -1
  26. package/dist/rules/prefer-zustand-state-management.js +309 -1
  27. package/dist/rules/prefer-zustand-state-management.js.map +1 -1
  28. package/dist/rules/require-input-validation.js +309 -1
  29. package/dist/rules/require-input-validation.js.map +1 -1
  30. package/dist/rules/zustand-use-selectors.js +309 -1
  31. package/dist/rules/zustand-use-selectors.js.map +1 -1
  32. package/package.json +2 -2
  33. package/src/index.ts +30 -2
  34. package/src/rules/prefer-tailwind/index.test.ts +96 -0
  35. package/src/rules/prefer-tailwind/index.ts +405 -25
  36. package/src/utils/create-rule.ts +121 -2
  37. package/src/utils/rule-profiler.test.ts +167 -0
  38. package/src/utils/rule-profiler.ts +383 -0
package/dist/index.d.ts CHANGED
@@ -8,9 +8,10 @@ export { ResolverFactory } from 'oxc-resolver';
8
8
  * Rule creation helper using @typescript-eslint/utils
9
9
  */
10
10
 
11
- declare const createRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener> & {
11
+ declare const baseCreateRule: <Options extends readonly unknown[], MessageIds extends string>({ meta, name, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<Options, MessageIds, unknown>>) => ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener> & {
12
12
  name: string;
13
13
  };
14
+ declare const createRule: typeof baseCreateRule;
14
15
  /**
15
16
  * Schema for prompting user to configure a rule option in the CLI
16
17
  */
@@ -278,6 +279,63 @@ declare function clearCache$1(projectRoot: string): void;
278
279
  */
279
280
  declare function clearAllSuggestions(projectRoot: string): void;
280
281
 
282
+ /**
283
+ * Lightweight process-local profiling for UILint ESLint rules.
284
+ *
285
+ * The profiler is intentionally quiet during linting: visitor callbacks only
286
+ * update in-memory aggregates, and summaries are flushed once at process exit.
287
+ */
288
+ interface RuleProfilerOptions {
289
+ enabled: boolean;
290
+ profileDir: string;
291
+ outlierLimit: number;
292
+ minOutlierMs: number;
293
+ }
294
+ interface RuleProfileListenerSummary {
295
+ selector: string;
296
+ totalMs: number;
297
+ calls: number;
298
+ }
299
+ interface RuleProfileSummary {
300
+ ruleId: string;
301
+ files: number;
302
+ reports: number;
303
+ setupMs: number;
304
+ listenerMs: number;
305
+ totalMs: number;
306
+ listenerCalls: number;
307
+ avgFileMs: number;
308
+ p95FileMs: number;
309
+ p99FileMs: number;
310
+ maxFileMs: number;
311
+ listeners: RuleProfileListenerSummary[];
312
+ }
313
+ interface RuleProfileOutlier {
314
+ ruleId: string;
315
+ filePath: string;
316
+ totalMs: number;
317
+ setupMs: number;
318
+ listenerMs: number;
319
+ listenerCalls: number;
320
+ reports: number;
321
+ }
322
+ interface RuleProfileSession {
323
+ version: number;
324
+ generatedAt: string;
325
+ durationMs: number;
326
+ cwd: string;
327
+ nodeVersion: string;
328
+ fileCount: number;
329
+ enabledRuleCount: number;
330
+ rules: RuleProfileSummary[];
331
+ outliers: RuleProfileOutlier[];
332
+ }
333
+ declare function getRuleProfilerOptions(): RuleProfilerOptions;
334
+ declare function buildRuleProfileSession(): RuleProfileSession;
335
+ declare function flushRuleProfiler(): RuleProfileSession | null;
336
+ declare function resetRuleProfilerForTests(now?: () => bigint): void;
337
+ declare function setRuleProfilerNowForTests(now: () => bigint): void;
338
+
281
339
  /**
282
340
  * Component Parser
283
341
  *
@@ -529,7 +587,7 @@ declare const rules: {
529
587
  }], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
530
588
  name: string;
531
589
  };
532
- "prefer-tailwind": _typescript_eslint_utils_ts_eslint.RuleModule<"preferTailwind" | "preferSemanticColors" | "preferSemanticColorsWithSuggestion" | "preferSemanticClassGroups" | "semanticOpacityModifier", [({
590
+ "prefer-tailwind": _typescript_eslint_utils_ts_eslint.RuleModule<"preferTailwind" | "preferSemanticColors" | "preferSemanticColorsWithSuggestion" | "preferSemanticClassGroups" | "semanticOpacityModifier" | "componentVariantLeakage", [({
533
591
  styleRatioThreshold?: number;
534
592
  minElementsForAnalysis?: number;
535
593
  allowedStyleProperties?: string[];
@@ -543,6 +601,11 @@ declare const rules: {
543
601
  disallowSemanticOpacityModifiers?: boolean;
544
602
  allowedOpacityModifierClasses?: string[];
545
603
  allowedVisualUtilityClasses?: string[];
604
+ preferComponentVariants?: boolean;
605
+ componentVariantComponents?: string[];
606
+ componentVariantProps?: string[];
607
+ componentVariantClassThreshold?: number;
608
+ allowedComponentVariantClasses?: string[];
546
609
  } | undefined)?], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
547
610
  name: string;
548
611
  };
@@ -655,7 +718,7 @@ declare const plugin: {
655
718
  }], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
656
719
  name: string;
657
720
  };
658
- "prefer-tailwind": _typescript_eslint_utils_ts_eslint.RuleModule<"preferTailwind" | "preferSemanticColors" | "preferSemanticColorsWithSuggestion" | "preferSemanticClassGroups" | "semanticOpacityModifier", [({
721
+ "prefer-tailwind": _typescript_eslint_utils_ts_eslint.RuleModule<"preferTailwind" | "preferSemanticColors" | "preferSemanticColorsWithSuggestion" | "preferSemanticClassGroups" | "semanticOpacityModifier" | "componentVariantLeakage", [({
659
722
  styleRatioThreshold?: number;
660
723
  minElementsForAnalysis?: number;
661
724
  allowedStyleProperties?: string[];
@@ -669,6 +732,11 @@ declare const plugin: {
669
732
  disallowSemanticOpacityModifiers?: boolean;
670
733
  allowedOpacityModifierClasses?: string[];
671
734
  allowedVisualUtilityClasses?: string[];
735
+ preferComponentVariants?: boolean;
736
+ componentVariantComponents?: string[];
737
+ componentVariantProps?: string[];
738
+ componentVariantClassThreshold?: number;
739
+ allowedComponentVariantClasses?: string[];
672
740
  } | undefined)?], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
673
741
  name: string;
674
742
  };
@@ -692,4 +760,4 @@ interface UILintESLint {
692
760
  */
693
761
  declare const uilintEslint: UILintESLint;
694
762
 
695
- export { type CacheEntry, type CacheStore, type CachedIssue, type CategoryMeta, type LibraryName, type OptionFieldSchema, type RuleMeta, type RuleMeta as RuleMetadata, type RuleMigration, type RuleOptionSchema, type RuleRequirement, type UILintESLint, categoryRegistry, clearAllSuggestions, clearCache$1 as clearCache, clearCacheEntry, clearExternalRules, clearCache as clearImportGraphCache, configs, createRule, uilintEslint as default, defineRuleMeta, findStyleguidePath, getAllRuleIds, getCacheEntry, getCategoryMeta, getComponentLibrary, getExternalRules, getPluginCategories, getRuleDocs, getRuleMetadata, getRulesByCategory, getStyleguide, hashContent, hashContentSync, loadCache, loadStyleguide, meta, plugin, registerCategory, registerESLintRule, registerRuleMeta, registerRuleMetas, ruleRegistry, rules, saveCache, setCacheEntry };
763
+ export { type CacheEntry, type CacheStore, type CachedIssue, type CategoryMeta, type LibraryName, type OptionFieldSchema, type RuleMeta, type RuleMeta as RuleMetadata, type RuleMigration, type RuleOptionSchema, type RuleProfileOutlier, type RuleProfileSession, type RuleProfileSummary, type RuleRequirement, type UILintESLint, buildRuleProfileSession, categoryRegistry, clearAllSuggestions, clearCache$1 as clearCache, clearCacheEntry, clearExternalRules, clearCache as clearImportGraphCache, configs, createRule, uilintEslint as default, defineRuleMeta, findStyleguidePath, flushRuleProfiler, getAllRuleIds, getCacheEntry, getCategoryMeta, getComponentLibrary, getExternalRules, getPluginCategories, getRuleDocs, getRuleMetadata, getRuleProfilerOptions, getRulesByCategory, getStyleguide, hashContent, hashContentSync, loadCache, loadStyleguide, meta, plugin, registerCategory, registerESLintRule, registerRuleMeta, registerRuleMetas, resetRuleProfilerForTests, ruleRegistry, rules, saveCache, setCacheEntry, setRuleProfilerNowForTests };