@aiready/consistency 0.6.5 → 0.6.6
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/.turbo/turbo-build.log +10 -10
- package/.turbo/turbo-test.log +3 -3
- package/README.md +35 -5
- package/dist/chunk-WTBDNCEN.mjs +1352 -0
- package/dist/cli.js +29 -2
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +42 -397
- package/dist/index.mjs +6 -395
- package/package.json +1 -1
- package/src/analyzers/naming-ast.ts +4 -47
- package/src/analyzers/naming-constants.ts +107 -0
- package/src/analyzers/naming.ts +5 -95
- package/src/index.ts +2 -1
package/dist/cli.js
CHANGED
|
@@ -457,8 +457,9 @@ function isAcceptableInContext(name, context, options) {
|
|
|
457
457
|
return false;
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
// src/analyzers/naming-
|
|
460
|
+
// src/analyzers/naming-constants.ts
|
|
461
461
|
var COMMON_SHORT_WORDS = /* @__PURE__ */ new Set([
|
|
462
|
+
// Full English words (1-3 letters)
|
|
462
463
|
"day",
|
|
463
464
|
"key",
|
|
464
465
|
"net",
|
|
@@ -514,12 +515,14 @@ var COMMON_SHORT_WORDS = /* @__PURE__ */ new Set([
|
|
|
514
515
|
"tmp",
|
|
515
516
|
"ext",
|
|
516
517
|
"sep",
|
|
518
|
+
// Prepositions and conjunctions
|
|
517
519
|
"and",
|
|
518
520
|
"from",
|
|
519
521
|
"how",
|
|
520
522
|
"pad",
|
|
521
523
|
"bar",
|
|
522
524
|
"non",
|
|
525
|
+
// Additional full words commonly flagged
|
|
523
526
|
"tax",
|
|
524
527
|
"cat",
|
|
525
528
|
"dog",
|
|
@@ -599,15 +602,18 @@ var COMMON_SHORT_WORDS = /* @__PURE__ */ new Set([
|
|
|
599
602
|
"won"
|
|
600
603
|
]);
|
|
601
604
|
var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
605
|
+
// Standard identifiers
|
|
602
606
|
"id",
|
|
603
607
|
"uid",
|
|
604
608
|
"gid",
|
|
605
609
|
"pid",
|
|
610
|
+
// Loop counters and iterators
|
|
606
611
|
"i",
|
|
607
612
|
"j",
|
|
608
613
|
"k",
|
|
609
614
|
"n",
|
|
610
615
|
"m",
|
|
616
|
+
// Web/Network
|
|
611
617
|
"url",
|
|
612
618
|
"uri",
|
|
613
619
|
"api",
|
|
@@ -627,6 +633,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
627
633
|
"cors",
|
|
628
634
|
"ws",
|
|
629
635
|
"wss",
|
|
636
|
+
// Data formats
|
|
630
637
|
"json",
|
|
631
638
|
"xml",
|
|
632
639
|
"yaml",
|
|
@@ -635,6 +642,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
635
642
|
"css",
|
|
636
643
|
"svg",
|
|
637
644
|
"pdf",
|
|
645
|
+
// File types & extensions
|
|
638
646
|
"img",
|
|
639
647
|
"txt",
|
|
640
648
|
"doc",
|
|
@@ -646,6 +654,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
646
654
|
"jpg",
|
|
647
655
|
"png",
|
|
648
656
|
"gif",
|
|
657
|
+
// Databases
|
|
649
658
|
"db",
|
|
650
659
|
"sql",
|
|
651
660
|
"orm",
|
|
@@ -654,6 +663,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
654
663
|
"ddb",
|
|
655
664
|
"rds",
|
|
656
665
|
"nosql",
|
|
666
|
+
// File system
|
|
657
667
|
"fs",
|
|
658
668
|
"dir",
|
|
659
669
|
"tmp",
|
|
@@ -662,6 +672,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
662
672
|
"bin",
|
|
663
673
|
"lib",
|
|
664
674
|
"pkg",
|
|
675
|
+
// Operating system
|
|
665
676
|
"os",
|
|
666
677
|
"env",
|
|
667
678
|
"arg",
|
|
@@ -670,17 +681,20 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
670
681
|
"exe",
|
|
671
682
|
"cwd",
|
|
672
683
|
"pwd",
|
|
684
|
+
// UI/UX
|
|
673
685
|
"ui",
|
|
674
686
|
"ux",
|
|
675
687
|
"gui",
|
|
676
688
|
"dom",
|
|
677
689
|
"ref",
|
|
690
|
+
// Request/Response
|
|
678
691
|
"req",
|
|
679
692
|
"res",
|
|
680
693
|
"ctx",
|
|
681
694
|
"err",
|
|
682
695
|
"msg",
|
|
683
696
|
"auth",
|
|
697
|
+
// Mathematics/Computing
|
|
684
698
|
"max",
|
|
685
699
|
"min",
|
|
686
700
|
"avg",
|
|
@@ -698,6 +712,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
698
712
|
"int",
|
|
699
713
|
"num",
|
|
700
714
|
"idx",
|
|
715
|
+
// Time
|
|
701
716
|
"now",
|
|
702
717
|
"utc",
|
|
703
718
|
"tz",
|
|
@@ -707,6 +722,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
707
722
|
"min",
|
|
708
723
|
"yr",
|
|
709
724
|
"mo",
|
|
725
|
+
// Common patterns
|
|
710
726
|
"app",
|
|
711
727
|
"cfg",
|
|
712
728
|
"config",
|
|
@@ -725,6 +741,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
725
741
|
"post",
|
|
726
742
|
"sub",
|
|
727
743
|
"pub",
|
|
744
|
+
// Programming/Framework specific
|
|
728
745
|
"ts",
|
|
729
746
|
"js",
|
|
730
747
|
"jsx",
|
|
@@ -738,6 +755,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
738
755
|
"mod",
|
|
739
756
|
"opts",
|
|
740
757
|
"dev",
|
|
758
|
+
// Cloud/Infrastructure
|
|
741
759
|
"s3",
|
|
742
760
|
"ec2",
|
|
743
761
|
"sqs",
|
|
@@ -761,6 +779,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
761
779
|
"cf",
|
|
762
780
|
"cfn",
|
|
763
781
|
"ga",
|
|
782
|
+
// Metrics/Performance
|
|
764
783
|
"fcp",
|
|
765
784
|
"lcp",
|
|
766
785
|
"cls",
|
|
@@ -772,12 +791,14 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
772
791
|
"rps",
|
|
773
792
|
"tps",
|
|
774
793
|
"wpm",
|
|
794
|
+
// Testing & i18n
|
|
775
795
|
"po",
|
|
776
796
|
"e2e",
|
|
777
797
|
"a11y",
|
|
778
798
|
"i18n",
|
|
779
799
|
"l10n",
|
|
780
800
|
"spy",
|
|
801
|
+
// Domain-specific abbreviations (context-aware)
|
|
781
802
|
"sk",
|
|
782
803
|
"fy",
|
|
783
804
|
"faq",
|
|
@@ -788,6 +809,7 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
788
809
|
"kpi",
|
|
789
810
|
"ttl",
|
|
790
811
|
"pct",
|
|
812
|
+
// Technical abbreviations
|
|
791
813
|
"mac",
|
|
792
814
|
"hex",
|
|
793
815
|
"esm",
|
|
@@ -795,26 +817,31 @@ var ACCEPTABLE_ABBREVIATIONS = /* @__PURE__ */ new Set([
|
|
|
795
817
|
"rec",
|
|
796
818
|
"loc",
|
|
797
819
|
"dup",
|
|
820
|
+
// Boolean helpers (these are intentional short names)
|
|
798
821
|
"is",
|
|
799
822
|
"has",
|
|
800
823
|
"can",
|
|
801
824
|
"did",
|
|
802
825
|
"was",
|
|
803
826
|
"are",
|
|
827
|
+
// Date/Time context (when in date contexts)
|
|
804
828
|
"d",
|
|
805
829
|
"t",
|
|
806
830
|
"dt",
|
|
831
|
+
// Coverage metrics (industry standard: statements/branches/functions/lines)
|
|
807
832
|
"s",
|
|
808
833
|
"b",
|
|
809
834
|
"f",
|
|
810
835
|
"l",
|
|
811
|
-
//
|
|
836
|
+
// Common media/content abbreviations
|
|
812
837
|
"vid",
|
|
813
838
|
"pic",
|
|
814
839
|
"img",
|
|
815
840
|
"doc",
|
|
816
841
|
"msg"
|
|
817
842
|
]);
|
|
843
|
+
|
|
844
|
+
// src/analyzers/naming-ast.ts
|
|
818
845
|
async function analyzeNamingAST(files) {
|
|
819
846
|
const issues = [];
|
|
820
847
|
const rootDir = files.length > 0 ? (0, import_path.dirname)(files[0]) : process.cwd();
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -66,10 +66,14 @@ declare function analyzeNamingAST(files: string[]): Promise<NamingIssue[]>;
|
|
|
66
66
|
* Analyzes naming conventions and quality
|
|
67
67
|
*/
|
|
68
68
|
declare function analyzeNaming(files: string[]): Promise<NamingIssue[]>;
|
|
69
|
+
|
|
69
70
|
/**
|
|
70
|
-
*
|
|
71
|
+
* Detect naming convention patterns across the codebase
|
|
71
72
|
*/
|
|
72
|
-
declare function detectNamingConventions(files: string[], allIssues:
|
|
73
|
+
declare function detectNamingConventions(files: string[], allIssues: Array<{
|
|
74
|
+
type: string;
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
}>): {
|
|
73
77
|
dominantConvention: 'camelCase' | 'snake_case' | 'PascalCase' | 'mixed';
|
|
74
78
|
conventionScore: number;
|
|
75
79
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -66,10 +66,14 @@ declare function analyzeNamingAST(files: string[]): Promise<NamingIssue[]>;
|
|
|
66
66
|
* Analyzes naming conventions and quality
|
|
67
67
|
*/
|
|
68
68
|
declare function analyzeNaming(files: string[]): Promise<NamingIssue[]>;
|
|
69
|
+
|
|
69
70
|
/**
|
|
70
|
-
*
|
|
71
|
+
* Detect naming convention patterns across the codebase
|
|
71
72
|
*/
|
|
72
|
-
declare function detectNamingConventions(files: string[], allIssues:
|
|
73
|
+
declare function detectNamingConventions(files: string[], allIssues: Array<{
|
|
74
|
+
type: string;
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
}>): {
|
|
73
77
|
dominantConvention: 'camelCase' | 'snake_case' | 'PascalCase' | 'mixed';
|
|
74
78
|
conventionScore: number;
|
|
75
79
|
};
|