knip 5.50.4 → 5.51.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.
- package/README.md +1 -1
- package/dist/ConfigurationChief.d.ts +4 -1
- package/dist/ConfigurationChief.js +3 -0
- package/dist/DependencyDeputy.js +11 -0
- package/dist/binaries/fallback.js +1 -1
- package/dist/binaries/package-manager/bun.js +2 -0
- package/dist/cli.js +3 -3
- package/dist/compilers/astro.js +5 -1
- package/dist/compilers/compilers.js +1 -1
- package/dist/compilers/index.d.ts +44 -13
- package/dist/compilers/index.js +9 -6
- package/dist/compilers/types.d.ts +1 -0
- package/dist/graph/build.js +8 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -1
- package/dist/plugins/bun/index.d.ts +11 -0
- package/dist/plugins/bun/index.js +28 -0
- package/dist/plugins/eslint/index.js +1 -2
- package/dist/plugins/index.d.ts +37 -10
- package/dist/plugins/index.js +8 -2
- package/dist/plugins/lint-staged/index.d.ts +0 -1
- package/dist/plugins/lint-staged/index.js +0 -2
- package/dist/plugins/nano-staged/index.d.ts +10 -0
- package/dist/plugins/nano-staged/index.js +33 -0
- package/dist/plugins/nano-staged/types.d.ts +7 -0
- package/dist/plugins/next/index.js +2 -1
- package/dist/plugins/oxlint/index.d.ts +12 -0
- package/dist/plugins/oxlint/index.js +16 -0
- package/dist/plugins/preconstruct/index.js +2 -2
- package/dist/plugins/prettier/index.js +1 -1
- package/dist/plugins/relay/index.d.ts +15 -0
- package/dist/plugins/relay/index.js +31 -0
- package/dist/plugins/relay/types.d.ts +12 -0
- package/dist/plugins/relay/types.js +1 -0
- package/dist/plugins/tsup/index.js +1 -1
- package/dist/plugins/xo/index.js +1 -1
- package/dist/schema/configuration.d.ts +241 -70
- package/dist/schema/configuration.js +2 -1
- package/dist/schema/plugins.d.ts +92 -23
- package/dist/schema/plugins.js +4 -1
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +4 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/typescript/ast-helpers.d.ts +16 -3
- package/dist/typescript/ast-helpers.js +21 -15
- package/dist/typescript/visitors/dynamic-imports/importCall.js +47 -53
- package/dist/typescript/visitors/exports/exportAssignment.js +17 -2
- package/dist/typescript/visitors/exports/exportKeyword.js +3 -22
- package/dist/util/cli-arguments.d.ts +1 -1
- package/dist/util/cli-arguments.js +1 -1
- package/dist/util/codeowners.js +1 -1
- package/dist/util/glob-core.d.ts +0 -8
- package/dist/util/glob-core.js +16 -49
- package/dist/util/input.d.ts +3 -1
- package/dist/util/parse-and-convert-gitignores.d.ts +8 -0
- package/dist/util/parse-and-convert-gitignores.js +40 -0
- package/dist/util/to-source-path.d.ts +1 -1
- package/dist/util/to-source-path.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -3
- package/schema.json +20 -4
- package/dist/plugins/tanstack-router/index.d.ts +0 -12
- package/dist/plugins/tanstack-router/index.js +0 -46
- package/dist/plugins/tanstack-router/resolveFromAST.d.ts +0 -2
- package/dist/plugins/tanstack-router/resolveFromAST.js +0 -28
- package/dist/plugins/tanstack-router/types.d.ts +0 -7
- /package/dist/plugins/{tanstack-router → nano-staged}/types.js +0 -0
package/dist/schema/plugins.d.ts
CHANGED
|
@@ -66,6 +66,19 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
66
66
|
entry?: string | string[] | undefined;
|
|
67
67
|
project?: string | string[] | undefined;
|
|
68
68
|
}>]>;
|
|
69
|
+
bun: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
70
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
71
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
72
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
config?: string | string[] | undefined;
|
|
75
|
+
entry?: string | string[] | undefined;
|
|
76
|
+
project?: string | string[] | undefined;
|
|
77
|
+
}, {
|
|
78
|
+
config?: string | string[] | undefined;
|
|
79
|
+
entry?: string | string[] | undefined;
|
|
80
|
+
project?: string | string[] | undefined;
|
|
81
|
+
}>]>;
|
|
69
82
|
c8: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
70
83
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
71
84
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -521,6 +534,19 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
521
534
|
entry?: string | string[] | undefined;
|
|
522
535
|
project?: string | string[] | undefined;
|
|
523
536
|
}>]>;
|
|
537
|
+
'nano-staged': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
538
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
539
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
540
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
541
|
+
}, "strip", z.ZodTypeAny, {
|
|
542
|
+
config?: string | string[] | undefined;
|
|
543
|
+
entry?: string | string[] | undefined;
|
|
544
|
+
project?: string | string[] | undefined;
|
|
545
|
+
}, {
|
|
546
|
+
config?: string | string[] | undefined;
|
|
547
|
+
entry?: string | string[] | undefined;
|
|
548
|
+
project?: string | string[] | undefined;
|
|
549
|
+
}>]>;
|
|
524
550
|
nest: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
525
551
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
526
552
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -651,6 +677,19 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
651
677
|
entry?: string | string[] | undefined;
|
|
652
678
|
project?: string | string[] | undefined;
|
|
653
679
|
}>]>;
|
|
680
|
+
oxlint: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
681
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
682
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
683
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
684
|
+
}, "strip", z.ZodTypeAny, {
|
|
685
|
+
config?: string | string[] | undefined;
|
|
686
|
+
entry?: string | string[] | undefined;
|
|
687
|
+
project?: string | string[] | undefined;
|
|
688
|
+
}, {
|
|
689
|
+
config?: string | string[] | undefined;
|
|
690
|
+
entry?: string | string[] | undefined;
|
|
691
|
+
project?: string | string[] | undefined;
|
|
692
|
+
}>]>;
|
|
654
693
|
playwright: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
655
694
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
656
695
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -768,6 +807,19 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
768
807
|
entry?: string | string[] | undefined;
|
|
769
808
|
project?: string | string[] | undefined;
|
|
770
809
|
}>]>;
|
|
810
|
+
relay: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
811
|
+
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
812
|
+
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
813
|
+
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
814
|
+
}, "strip", z.ZodTypeAny, {
|
|
815
|
+
config?: string | string[] | undefined;
|
|
816
|
+
entry?: string | string[] | undefined;
|
|
817
|
+
project?: string | string[] | undefined;
|
|
818
|
+
}, {
|
|
819
|
+
config?: string | string[] | undefined;
|
|
820
|
+
entry?: string | string[] | undefined;
|
|
821
|
+
project?: string | string[] | undefined;
|
|
822
|
+
}>]>;
|
|
771
823
|
'release-it': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
772
824
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
773
825
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -1002,19 +1054,6 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1002
1054
|
entry?: string | string[] | undefined;
|
|
1003
1055
|
project?: string | string[] | undefined;
|
|
1004
1056
|
}>]>;
|
|
1005
|
-
'tanstack-router': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1006
|
-
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1007
|
-
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1008
|
-
project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1009
|
-
}, "strip", z.ZodTypeAny, {
|
|
1010
|
-
config?: string | string[] | undefined;
|
|
1011
|
-
entry?: string | string[] | undefined;
|
|
1012
|
-
project?: string | string[] | undefined;
|
|
1013
|
-
}, {
|
|
1014
|
-
config?: string | string[] | undefined;
|
|
1015
|
-
entry?: string | string[] | undefined;
|
|
1016
|
-
project?: string | string[] | undefined;
|
|
1017
|
-
}>]>;
|
|
1018
1057
|
travis: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
|
|
1019
1058
|
config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1020
1059
|
entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -1301,6 +1340,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1301
1340
|
entry?: string | string[] | undefined;
|
|
1302
1341
|
project?: string | string[] | undefined;
|
|
1303
1342
|
};
|
|
1343
|
+
bun: string | boolean | string[] | {
|
|
1344
|
+
config?: string | string[] | undefined;
|
|
1345
|
+
entry?: string | string[] | undefined;
|
|
1346
|
+
project?: string | string[] | undefined;
|
|
1347
|
+
};
|
|
1304
1348
|
c8: string | boolean | string[] | {
|
|
1305
1349
|
config?: string | string[] | undefined;
|
|
1306
1350
|
entry?: string | string[] | undefined;
|
|
@@ -1476,6 +1520,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1476
1520
|
entry?: string | string[] | undefined;
|
|
1477
1521
|
project?: string | string[] | undefined;
|
|
1478
1522
|
};
|
|
1523
|
+
'nano-staged': string | boolean | string[] | {
|
|
1524
|
+
config?: string | string[] | undefined;
|
|
1525
|
+
entry?: string | string[] | undefined;
|
|
1526
|
+
project?: string | string[] | undefined;
|
|
1527
|
+
};
|
|
1479
1528
|
nest: string | boolean | string[] | {
|
|
1480
1529
|
config?: string | string[] | undefined;
|
|
1481
1530
|
entry?: string | string[] | undefined;
|
|
@@ -1521,6 +1570,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1521
1570
|
entry?: string | string[] | undefined;
|
|
1522
1571
|
project?: string | string[] | undefined;
|
|
1523
1572
|
};
|
|
1573
|
+
oxlint: string | boolean | string[] | {
|
|
1574
|
+
config?: string | string[] | undefined;
|
|
1575
|
+
entry?: string | string[] | undefined;
|
|
1576
|
+
project?: string | string[] | undefined;
|
|
1577
|
+
};
|
|
1524
1578
|
playwright: string | boolean | string[] | {
|
|
1525
1579
|
config?: string | string[] | undefined;
|
|
1526
1580
|
entry?: string | string[] | undefined;
|
|
@@ -1566,6 +1620,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1566
1620
|
entry?: string | string[] | undefined;
|
|
1567
1621
|
project?: string | string[] | undefined;
|
|
1568
1622
|
};
|
|
1623
|
+
relay: string | boolean | string[] | {
|
|
1624
|
+
config?: string | string[] | undefined;
|
|
1625
|
+
entry?: string | string[] | undefined;
|
|
1626
|
+
project?: string | string[] | undefined;
|
|
1627
|
+
};
|
|
1569
1628
|
'release-it': string | boolean | string[] | {
|
|
1570
1629
|
config?: string | string[] | undefined;
|
|
1571
1630
|
entry?: string | string[] | undefined;
|
|
@@ -1656,11 +1715,6 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1656
1715
|
entry?: string | string[] | undefined;
|
|
1657
1716
|
project?: string | string[] | undefined;
|
|
1658
1717
|
};
|
|
1659
|
-
'tanstack-router': string | boolean | string[] | {
|
|
1660
|
-
config?: string | string[] | undefined;
|
|
1661
|
-
entry?: string | string[] | undefined;
|
|
1662
|
-
project?: string | string[] | undefined;
|
|
1663
|
-
};
|
|
1664
1718
|
travis: string | boolean | string[] | {
|
|
1665
1719
|
config?: string | string[] | undefined;
|
|
1666
1720
|
entry?: string | string[] | undefined;
|
|
@@ -1787,6 +1841,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1787
1841
|
entry?: string | string[] | undefined;
|
|
1788
1842
|
project?: string | string[] | undefined;
|
|
1789
1843
|
};
|
|
1844
|
+
bun: string | boolean | string[] | {
|
|
1845
|
+
config?: string | string[] | undefined;
|
|
1846
|
+
entry?: string | string[] | undefined;
|
|
1847
|
+
project?: string | string[] | undefined;
|
|
1848
|
+
};
|
|
1790
1849
|
c8: string | boolean | string[] | {
|
|
1791
1850
|
config?: string | string[] | undefined;
|
|
1792
1851
|
entry?: string | string[] | undefined;
|
|
@@ -1962,6 +2021,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
1962
2021
|
entry?: string | string[] | undefined;
|
|
1963
2022
|
project?: string | string[] | undefined;
|
|
1964
2023
|
};
|
|
2024
|
+
'nano-staged': string | boolean | string[] | {
|
|
2025
|
+
config?: string | string[] | undefined;
|
|
2026
|
+
entry?: string | string[] | undefined;
|
|
2027
|
+
project?: string | string[] | undefined;
|
|
2028
|
+
};
|
|
1965
2029
|
nest: string | boolean | string[] | {
|
|
1966
2030
|
config?: string | string[] | undefined;
|
|
1967
2031
|
entry?: string | string[] | undefined;
|
|
@@ -2007,6 +2071,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
2007
2071
|
entry?: string | string[] | undefined;
|
|
2008
2072
|
project?: string | string[] | undefined;
|
|
2009
2073
|
};
|
|
2074
|
+
oxlint: string | boolean | string[] | {
|
|
2075
|
+
config?: string | string[] | undefined;
|
|
2076
|
+
entry?: string | string[] | undefined;
|
|
2077
|
+
project?: string | string[] | undefined;
|
|
2078
|
+
};
|
|
2010
2079
|
playwright: string | boolean | string[] | {
|
|
2011
2080
|
config?: string | string[] | undefined;
|
|
2012
2081
|
entry?: string | string[] | undefined;
|
|
@@ -2052,6 +2121,11 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
2052
2121
|
entry?: string | string[] | undefined;
|
|
2053
2122
|
project?: string | string[] | undefined;
|
|
2054
2123
|
};
|
|
2124
|
+
relay: string | boolean | string[] | {
|
|
2125
|
+
config?: string | string[] | undefined;
|
|
2126
|
+
entry?: string | string[] | undefined;
|
|
2127
|
+
project?: string | string[] | undefined;
|
|
2128
|
+
};
|
|
2055
2129
|
'release-it': string | boolean | string[] | {
|
|
2056
2130
|
config?: string | string[] | undefined;
|
|
2057
2131
|
entry?: string | string[] | undefined;
|
|
@@ -2142,11 +2216,6 @@ export declare const pluginsSchema: z.ZodObject<{
|
|
|
2142
2216
|
entry?: string | string[] | undefined;
|
|
2143
2217
|
project?: string | string[] | undefined;
|
|
2144
2218
|
};
|
|
2145
|
-
'tanstack-router': string | boolean | string[] | {
|
|
2146
|
-
config?: string | string[] | undefined;
|
|
2147
|
-
entry?: string | string[] | undefined;
|
|
2148
|
-
project?: string | string[] | undefined;
|
|
2149
|
-
};
|
|
2150
2219
|
travis: string | boolean | string[] | {
|
|
2151
2220
|
config?: string | string[] | undefined;
|
|
2152
2221
|
entry?: string | string[] | undefined;
|
package/dist/schema/plugins.js
CHANGED
|
@@ -14,6 +14,7 @@ export const pluginsSchema = z.object({
|
|
|
14
14
|
astro: pluginSchema,
|
|
15
15
|
ava: pluginSchema,
|
|
16
16
|
babel: pluginSchema,
|
|
17
|
+
bun: pluginSchema,
|
|
17
18
|
c8: pluginSchema,
|
|
18
19
|
capacitor: pluginSchema,
|
|
19
20
|
changesets: pluginSchema,
|
|
@@ -49,6 +50,7 @@ export const pluginsSchema = z.object({
|
|
|
49
50
|
mocha: pluginSchema,
|
|
50
51
|
moonrepo: pluginSchema,
|
|
51
52
|
msw: pluginSchema,
|
|
53
|
+
'nano-staged': pluginSchema,
|
|
52
54
|
nest: pluginSchema,
|
|
53
55
|
netlify: pluginSchema,
|
|
54
56
|
next: pluginSchema,
|
|
@@ -59,6 +61,7 @@ export const pluginsSchema = z.object({
|
|
|
59
61
|
nx: pluginSchema,
|
|
60
62
|
nyc: pluginSchema,
|
|
61
63
|
oclif: pluginSchema,
|
|
64
|
+
oxlint: pluginSchema,
|
|
62
65
|
playwright: pluginSchema,
|
|
63
66
|
'playwright-ct': pluginSchema,
|
|
64
67
|
'playwright-test': pluginSchema,
|
|
@@ -68,6 +71,7 @@ export const pluginsSchema = z.object({
|
|
|
68
71
|
prettier: pluginSchema,
|
|
69
72
|
'react-cosmos': pluginSchema,
|
|
70
73
|
'react-router': pluginSchema,
|
|
74
|
+
relay: pluginSchema,
|
|
71
75
|
'release-it': pluginSchema,
|
|
72
76
|
remark: pluginSchema,
|
|
73
77
|
remix: pluginSchema,
|
|
@@ -86,7 +90,6 @@ export const pluginsSchema = z.object({
|
|
|
86
90
|
svelte: pluginSchema,
|
|
87
91
|
syncpack: pluginSchema,
|
|
88
92
|
tailwind: pluginSchema,
|
|
89
|
-
'tanstack-router': pluginSchema,
|
|
90
93
|
travis: pluginSchema,
|
|
91
94
|
'ts-node': pluginSchema,
|
|
92
95
|
tsup: pluginSchema,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'react-router' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'syncpack' | 'tailwind' | '
|
|
2
|
-
export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "c8", "capacitor", "changesets", "commitizen", "commitlint", "create-typescript-app", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "react-router", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "syncpack", "tailwind", "
|
|
1
|
+
export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'bun' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
|
|
2
|
+
export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "bun", "c8", "capacitor", "changesets", "commitizen", "commitlint", "create-typescript-app", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "syncpack", "tailwind", "travis", "ts-node", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
|
|
@@ -3,6 +3,7 @@ export const pluginNames = [
|
|
|
3
3
|
'astro',
|
|
4
4
|
'ava',
|
|
5
5
|
'babel',
|
|
6
|
+
'bun',
|
|
6
7
|
'c8',
|
|
7
8
|
'capacitor',
|
|
8
9
|
'changesets',
|
|
@@ -38,6 +39,7 @@ export const pluginNames = [
|
|
|
38
39
|
'mocha',
|
|
39
40
|
'moonrepo',
|
|
40
41
|
'msw',
|
|
42
|
+
'nano-staged',
|
|
41
43
|
'nest',
|
|
42
44
|
'netlify',
|
|
43
45
|
'next',
|
|
@@ -48,6 +50,7 @@ export const pluginNames = [
|
|
|
48
50
|
'nx',
|
|
49
51
|
'nyc',
|
|
50
52
|
'oclif',
|
|
53
|
+
'oxlint',
|
|
51
54
|
'playwright',
|
|
52
55
|
'playwright-ct',
|
|
53
56
|
'playwright-test',
|
|
@@ -57,6 +60,7 @@ export const pluginNames = [
|
|
|
57
60
|
'prettier',
|
|
58
61
|
'react-cosmos',
|
|
59
62
|
'react-router',
|
|
63
|
+
'relay',
|
|
60
64
|
'release-it',
|
|
61
65
|
'remark',
|
|
62
66
|
'remix',
|
|
@@ -75,7 +79,6 @@ export const pluginNames = [
|
|
|
75
79
|
'svelte',
|
|
76
80
|
'syncpack',
|
|
77
81
|
'tailwind',
|
|
78
|
-
'tanstack-router',
|
|
79
82
|
'travis',
|
|
80
83
|
'ts-node',
|
|
81
84
|
'tsup',
|
package/dist/types/config.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export interface Configuration {
|
|
|
45
45
|
ignoreMembers: IgnorePatterns;
|
|
46
46
|
ignoreWorkspaces: string[];
|
|
47
47
|
isIncludeEntryExports: boolean;
|
|
48
|
+
isTreatConfigHintsAsErrors: boolean;
|
|
48
49
|
syncCompilers: SyncCompilers;
|
|
49
50
|
asyncCompilers: AsyncCompilers;
|
|
50
51
|
rootPluginConfigs: Partial<PluginsConfiguration>;
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
+
import type { Fix } from '../types/exports.js';
|
|
2
3
|
import { SymbolType } from '../types/issues.js';
|
|
3
|
-
export declare function isGetOrSetAccessorDeclaration(node: ts.Node): node is ts.AccessorDeclaration;
|
|
4
|
-
export declare function isPrivateMember(node: ts.MethodDeclaration | ts.PropertyDeclaration | ts.SetAccessorDeclaration | ts.GetAccessorDeclaration): boolean;
|
|
5
4
|
export declare function isDefaultImport(node: ts.ImportDeclaration | ts.ImportEqualsDeclaration | ts.ExportDeclaration): boolean;
|
|
6
5
|
export declare function isAccessExpression(node: ts.Node): node is ts.AccessExpression;
|
|
7
6
|
export declare function isImportCall(node: ts.Node): node is ts.ImportCall;
|
|
8
7
|
export declare function isRequireCall(callExpression: ts.Node): callExpression is ts.CallExpression;
|
|
9
8
|
export declare function isPropertyAccessCall(node: ts.Node, identifier: string): node is ts.CallExpression;
|
|
10
9
|
export declare const getNodeType: (node: ts.Node) => SymbolType;
|
|
10
|
+
export declare const isNonPrivatePropertyOrMethodDeclaration: (member: ts.ClassElement) => member is ts.MethodDeclaration | ts.PropertyDeclaration;
|
|
11
|
+
export declare const getClassMember: (member: ts.MethodDeclaration | ts.PropertyDeclaration, isFixTypes: boolean) => {
|
|
12
|
+
node: ts.MethodDeclaration | ts.PropertyDeclaration;
|
|
13
|
+
identifier: string;
|
|
14
|
+
pos: number;
|
|
15
|
+
type: SymbolType;
|
|
16
|
+
fix: Fix;
|
|
17
|
+
};
|
|
18
|
+
export declare const getEnumMember: (member: ts.EnumMember, isFixTypes: boolean) => {
|
|
19
|
+
node: ts.EnumMember;
|
|
20
|
+
identifier: string;
|
|
21
|
+
pos: number;
|
|
22
|
+
type: SymbolType;
|
|
23
|
+
fix: Fix;
|
|
24
|
+
};
|
|
11
25
|
export declare function stripQuotes(name: string): string;
|
|
12
26
|
export declare function findAncestor<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T | undefined;
|
|
13
27
|
export declare function findDescendants<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T[];
|
|
@@ -35,4 +49,3 @@ export declare const isModuleExportsAccess: (node: ts.PropertyAccessExpression)
|
|
|
35
49
|
export declare const getImportMap: (sourceFile: ts.SourceFile) => Map<string, string>;
|
|
36
50
|
export declare const getDefaultImportName: (importMap: ReturnType<typeof getImportMap>, specifier: string) => string | undefined;
|
|
37
51
|
export declare const getPropertyValues: (node: ts.ObjectLiteralExpression, propertyName: string) => Set<string>;
|
|
38
|
-
export declare const getPropertyValueEntries: (node: ts.ObjectLiteralExpression, propertyNames: Set<string>) => [string, string][];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
+
import { FIX_FLAGS } from '../constants.js';
|
|
2
3
|
import { SymbolType } from '../types/issues.js';
|
|
3
|
-
|
|
4
|
+
function isGetOrSetAccessorDeclaration(node) {
|
|
4
5
|
return node.kind === ts.SyntaxKind.SetAccessor || node.kind === ts.SyntaxKind.GetAccessor;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
function isPrivateMember(node) {
|
|
7
8
|
return node.modifiers?.some(modifier => modifier.kind === ts.SyntaxKind.PrivateKeyword) ?? false;
|
|
8
9
|
}
|
|
9
10
|
export function isDefaultImport(node) {
|
|
@@ -48,6 +49,24 @@ export const getNodeType = (node) => {
|
|
|
48
49
|
return SymbolType.VARIABLE;
|
|
49
50
|
return SymbolType.UNKNOWN;
|
|
50
51
|
};
|
|
52
|
+
export const isNonPrivatePropertyOrMethodDeclaration = (member) => (ts.isPropertyDeclaration(member) || ts.isMethodDeclaration(member) || isGetOrSetAccessorDeclaration(member)) &&
|
|
53
|
+
!isPrivateMember(member);
|
|
54
|
+
export const getClassMember = (member, isFixTypes) => ({
|
|
55
|
+
node: member,
|
|
56
|
+
identifier: member.name.getText(),
|
|
57
|
+
pos: member.name.getStart() + (ts.isComputedPropertyName(member.name) ? 1 : 0),
|
|
58
|
+
type: SymbolType.MEMBER,
|
|
59
|
+
fix: isFixTypes ? [member.getStart(), member.getEnd(), FIX_FLAGS.NONE] : undefined,
|
|
60
|
+
});
|
|
61
|
+
export const getEnumMember = (member, isFixTypes) => ({
|
|
62
|
+
node: member,
|
|
63
|
+
identifier: stripQuotes(member.name.getText()),
|
|
64
|
+
pos: member.name.getStart(),
|
|
65
|
+
type: SymbolType.MEMBER,
|
|
66
|
+
fix: isFixTypes
|
|
67
|
+
? [member.getStart(), member.getEnd(), FIX_FLAGS.OBJECT_BINDING | FIX_FLAGS.WITH_NEWLINE]
|
|
68
|
+
: undefined,
|
|
69
|
+
});
|
|
51
70
|
export function stripQuotes(name) {
|
|
52
71
|
const length = name.length;
|
|
53
72
|
if (length >= 2 && name.charCodeAt(0) === name.charCodeAt(length - 1) && isQuoteOrBacktick(name.charCodeAt(0))) {
|
|
@@ -246,16 +265,3 @@ export const getPropertyValues = (node, propertyName) => {
|
|
|
246
265
|
}
|
|
247
266
|
return values;
|
|
248
267
|
};
|
|
249
|
-
export const getPropertyValueEntries = (node, propertyNames) => {
|
|
250
|
-
const entries = [];
|
|
251
|
-
for (const prop of node.properties) {
|
|
252
|
-
if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {
|
|
253
|
-
if (propertyNames.has(prop.name.text)) {
|
|
254
|
-
if (ts.isStringLiteral(prop.initializer)) {
|
|
255
|
-
entries.push([prop.name.text, prop.initializer.text]);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return entries;
|
|
261
|
-
};
|
|
@@ -41,17 +41,8 @@ export default visit(() => true, node => {
|
|
|
41
41
|
}
|
|
42
42
|
return { identifier: 'default', specifier, pos };
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return 'STOP';
|
|
47
|
-
return ts.isVariableDeclaration(_node);
|
|
48
|
-
});
|
|
49
|
-
if (variableDeclaration) {
|
|
50
|
-
const alias = String(variableDeclaration.name.escapedText);
|
|
51
|
-
const symbol = getSymbol(variableDeclaration, isTopLevel(variableDeclaration.parent));
|
|
52
|
-
return { identifier, alias, symbol, specifier, pos };
|
|
53
|
-
}
|
|
54
|
-
return { identifier, specifier, pos };
|
|
44
|
+
if (identifier !== 'catch')
|
|
45
|
+
return { identifier, specifier, pos };
|
|
55
46
|
}
|
|
56
47
|
if (ts.isElementAccessExpression(accessExpression) &&
|
|
57
48
|
ts.isStringLiteral(accessExpression.argumentExpression)) {
|
|
@@ -61,56 +52,59 @@ export default visit(() => true, node => {
|
|
|
61
52
|
return { identifier, specifier, pos };
|
|
62
53
|
}
|
|
63
54
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
55
|
+
const variableDeclaration = accessExpression &&
|
|
56
|
+
ts.isPropertyAccessExpression(accessExpression) &&
|
|
57
|
+
accessExpression.name &&
|
|
58
|
+
accessExpression.name.escapedText === 'catch'
|
|
59
|
+
? node.parent.parent.parent.parent
|
|
60
|
+
: node.parent.parent;
|
|
61
|
+
if (ts.isVariableDeclaration(variableDeclaration) &&
|
|
62
|
+
ts.isVariableDeclarationList(variableDeclaration.parent)) {
|
|
63
|
+
const isTLA = isTopLevel(variableDeclaration.parent);
|
|
64
|
+
if (ts.isIdentifier(variableDeclaration.name)) {
|
|
65
|
+
const alias = String(variableDeclaration.name.escapedText);
|
|
66
|
+
const symbol = getSymbol(variableDeclaration, isTLA);
|
|
67
|
+
return { identifier: 'default', alias, symbol, specifier, pos: node.arguments[0].pos };
|
|
68
|
+
}
|
|
69
|
+
const bindings = findDescendants(variableDeclaration, ts.isBindingElement);
|
|
70
|
+
if (bindings.length > 0) {
|
|
71
|
+
return bindings.map(element => {
|
|
72
|
+
const identifier = (element.propertyName ?? element.name).getText();
|
|
73
|
+
const alias = element.propertyName ? element.name.getText() : undefined;
|
|
74
|
+
const symbol = getSymbol(element, isTLA);
|
|
75
|
+
return { identifier, alias, symbol, specifier, pos: element.pos };
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return { identifier: ANONYMOUS, specifier, pos: node.arguments[0].pos };
|
|
79
|
+
}
|
|
80
|
+
const arrayLiteralExpression = node.parent;
|
|
81
|
+
const variableDeclarationParent = node.parent.parent?.parent?.parent;
|
|
82
|
+
if (ts.isArrayLiteralExpression(arrayLiteralExpression) &&
|
|
83
|
+
variableDeclarationParent &&
|
|
84
|
+
ts.isVariableDeclarationList(variableDeclarationParent.parent) &&
|
|
85
|
+
ts.isVariableDeclaration(variableDeclarationParent) &&
|
|
86
|
+
ts.isArrayBindingPattern(variableDeclarationParent.name)) {
|
|
87
|
+
const index = arrayLiteralExpression.elements.indexOf(node);
|
|
88
|
+
const element = variableDeclarationParent.name.elements[index];
|
|
89
|
+
if (element) {
|
|
90
|
+
const isTL = isTopLevel(variableDeclarationParent.parent);
|
|
91
|
+
if (ts.isBindingElement(element) && ts.isObjectBindingPattern(element.name) && element.name.elements) {
|
|
92
|
+
return element.name.elements.map(element => {
|
|
77
93
|
const identifier = (element.propertyName ?? element.name).getText();
|
|
78
94
|
const alias = element.propertyName ? element.name.getText() : undefined;
|
|
79
|
-
const symbol = getSymbol(element,
|
|
95
|
+
const symbol = getSymbol(element, isTL);
|
|
80
96
|
return { identifier, alias, symbol, specifier, pos: element.pos };
|
|
81
97
|
});
|
|
82
98
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (ts.isArrayLiteralExpression(arrayLiteralExpression) &&
|
|
88
|
-
variableDeclarationParent &&
|
|
89
|
-
ts.isVariableDeclarationList(variableDeclarationParent.parent) &&
|
|
90
|
-
ts.isVariableDeclaration(variableDeclarationParent) &&
|
|
91
|
-
ts.isArrayBindingPattern(variableDeclarationParent.name)) {
|
|
92
|
-
const index = arrayLiteralExpression.elements.indexOf(node);
|
|
93
|
-
const element = variableDeclarationParent.name.elements[index];
|
|
94
|
-
if (element) {
|
|
95
|
-
const isTL = isTopLevel(variableDeclarationParent.parent);
|
|
96
|
-
if (ts.isBindingElement(element) && ts.isObjectBindingPattern(element.name) && element.name.elements) {
|
|
97
|
-
return element.name.elements.map(element => {
|
|
98
|
-
const identifier = (element.propertyName ?? element.name).getText();
|
|
99
|
-
const alias = element.propertyName ? element.name.getText() : undefined;
|
|
100
|
-
const symbol = getSymbol(element, isTL);
|
|
101
|
-
return { identifier, alias, symbol, specifier, pos: element.pos };
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
if (!ts.isOmittedExpression(element) && ts.isIdentifier(element.name)) {
|
|
105
|
-
const alias = String(element.name.escapedText);
|
|
106
|
-
const symbol = getSymbol(element, isTL);
|
|
107
|
-
return { identifier: 'default', symbol, alias, specifier, pos: element.pos };
|
|
108
|
-
}
|
|
109
|
-
return { identifier: 'default', specifier, pos: element.pos };
|
|
99
|
+
if (!ts.isOmittedExpression(element) && ts.isIdentifier(element.name)) {
|
|
100
|
+
const alias = String(element.name.escapedText);
|
|
101
|
+
const symbol = getSymbol(element, isTL);
|
|
102
|
+
return { identifier: 'default', symbol, alias, specifier, pos: element.pos };
|
|
110
103
|
}
|
|
104
|
+
return { identifier: 'default', specifier, pos: element.pos };
|
|
111
105
|
}
|
|
112
|
-
return { identifier: 'default', specifier, pos: node.arguments[0].pos };
|
|
113
106
|
}
|
|
107
|
+
return { identifier: 'default', specifier, pos: node.arguments[0].pos };
|
|
114
108
|
}
|
|
115
109
|
return { specifier, identifier: 'default', pos: node.arguments[0].pos };
|
|
116
110
|
}
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { FIX_FLAGS } from '../../../constants.js';
|
|
3
|
-
import { getNodeType } from '../../ast-helpers.js';
|
|
3
|
+
import { getClassMember, getEnumMember, getNodeType, isNonPrivatePropertyOrMethodDeclaration, } from '../../ast-helpers.js';
|
|
4
4
|
import { isModule } from '../helpers.js';
|
|
5
5
|
import { exportVisitor as visit } from '../index.js';
|
|
6
|
-
export default visit(isModule, (node, { isFixExports }) => {
|
|
6
|
+
export default visit(isModule, (node, { isFixExports, isReportClassMembers, isFixTypes }) => {
|
|
7
7
|
if (ts.isExportAssignment(node)) {
|
|
8
8
|
const pos = node.getChildAt(1).getStart();
|
|
9
9
|
const fix = isFixExports ? [node.getStart(), node.getEnd() + 1, FIX_FLAGS.NONE] : undefined;
|
|
10
10
|
const symbol = node.getSourceFile().locals?.get(node.expression.escapedText);
|
|
11
11
|
const type = getNodeType(symbol?.valueDeclaration);
|
|
12
|
+
if (symbol?.valueDeclaration) {
|
|
13
|
+
const decl = symbol.valueDeclaration;
|
|
14
|
+
if (ts.isEnumDeclaration(decl)) {
|
|
15
|
+
const members = decl.members.map(member => getEnumMember(member, isFixExports));
|
|
16
|
+
return { node, symbol, identifier: 'default', type, pos, fix, members };
|
|
17
|
+
}
|
|
18
|
+
if (ts.isClassDeclaration(decl)) {
|
|
19
|
+
const members = isReportClassMembers
|
|
20
|
+
? decl.members
|
|
21
|
+
.filter(isNonPrivatePropertyOrMethodDeclaration)
|
|
22
|
+
.map(member => getClassMember(member, isFixTypes))
|
|
23
|
+
: [];
|
|
24
|
+
return { node, symbol, identifier: 'default', type, pos, fix, members };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
12
27
|
return { node, symbol, identifier: 'default', type, pos, fix };
|
|
13
28
|
}
|
|
14
29
|
});
|
|
@@ -2,7 +2,7 @@ import ts from 'typescript';
|
|
|
2
2
|
import { FIX_FLAGS } from '../../../constants.js';
|
|
3
3
|
import { SymbolType } from '../../../types/issues.js';
|
|
4
4
|
import { compact } from '../../../util/array.js';
|
|
5
|
-
import {
|
|
5
|
+
import { getClassMember, getDefaultKeywordNode, getEnumMember, getExportKeywordNode, isNonPrivatePropertyOrMethodDeclaration, } from '../../ast-helpers.js';
|
|
6
6
|
import { isModule } from '../helpers.js';
|
|
7
7
|
import { exportVisitor as visit } from '../index.js';
|
|
8
8
|
export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassMembers }) => {
|
|
@@ -60,18 +60,7 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
|
|
|
60
60
|
const pos = (node.name ?? node).getStart();
|
|
61
61
|
const fix = getFix(exportKeyword, defaultKeyword);
|
|
62
62
|
const members = isReportClassMembers
|
|
63
|
-
? node.members
|
|
64
|
-
.filter((member) => (ts.isPropertyDeclaration(member) ||
|
|
65
|
-
ts.isMethodDeclaration(member) ||
|
|
66
|
-
isGetOrSetAccessorDeclaration(member)) &&
|
|
67
|
-
!isPrivateMember(member))
|
|
68
|
-
.map(member => ({
|
|
69
|
-
node: member,
|
|
70
|
-
identifier: member.name.getText(),
|
|
71
|
-
pos: member.name.getStart() + (ts.isComputedPropertyName(member.name) ? 1 : 0),
|
|
72
|
-
type: SymbolType.MEMBER,
|
|
73
|
-
fix: isFixTypes ? [member.getStart(), member.getEnd(), FIX_FLAGS.NONE] : undefined,
|
|
74
|
-
}))
|
|
63
|
+
? node.members.filter(isNonPrivatePropertyOrMethodDeclaration).map(member => getClassMember(member, isFixTypes))
|
|
75
64
|
: [];
|
|
76
65
|
return { node, identifier, type: SymbolType.CLASS, pos, members, fix };
|
|
77
66
|
}
|
|
@@ -91,15 +80,7 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
|
|
|
91
80
|
const identifier = node.name.getText();
|
|
92
81
|
const pos = node.name.getStart();
|
|
93
82
|
const fix = getTypeFix(exportKeyword);
|
|
94
|
-
const members = node.members.map(member => (
|
|
95
|
-
node: member,
|
|
96
|
-
identifier: stripQuotes(member.name.getText()),
|
|
97
|
-
pos: member.name.getStart(),
|
|
98
|
-
type: SymbolType.MEMBER,
|
|
99
|
-
fix: isFixTypes
|
|
100
|
-
? [member.getStart(), member.getEnd(), FIX_FLAGS.OBJECT_BINDING | FIX_FLAGS.WITH_NEWLINE]
|
|
101
|
-
: undefined,
|
|
102
|
-
}));
|
|
83
|
+
const members = node.members.map(member => getEnumMember(member, isFixExports));
|
|
103
84
|
return { node, identifier, type: SymbolType.ENUM, pos, members, fix };
|
|
104
85
|
}
|
|
105
86
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const helpText = "\u2702\uFE0F Find unused
|
|
1
|
+
export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no test files, devDependencies)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from external dependencies (default: false)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, codeclimate, markdown, disclosure, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --trace Show trace output\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n --performance Measure count and running time of expensive functions and display stats table\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-lintignore\n\nWebsite: https://knip.dev";
|
|
2
2
|
declare const _default: {
|
|
3
3
|
cache?: boolean | undefined;
|
|
4
4
|
'cache-location'?: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
|
-
export const helpText = `✂️ Find unused
|
|
2
|
+
export const helpText = `✂️ Find unused dependencies, exports and files in your JavaScript and TypeScript projects
|
|
3
3
|
|
|
4
4
|
Usage: knip [options]
|
|
5
5
|
|