@monorepolint/rules 0.5.0-beta.9 → 0.6.0-alpha.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/.turbo/turbo-clean.log +1 -1
- package/.turbo/turbo-compile-typescript.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +150 -151
- package/.turbo/turbo-transpile-typescript.log +5 -9
- package/CHANGELOG.md +42 -1
- package/build/js/index.js +36 -17
- package/build/js/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/alphabeticalDependencies.d.ts +1 -1
- package/build/types/alphabeticalDependencies.d.ts.map +1 -1
- package/build/types/alphabeticalScripts.d.ts +1 -1
- package/build/types/alphabeticalScripts.d.ts.map +1 -1
- package/build/types/bannedDependencies.d.ts +1 -19
- package/build/types/bannedDependencies.d.ts.map +1 -1
- package/build/types/consistentDependencies.d.ts +1 -3
- package/build/types/consistentDependencies.d.ts.map +1 -1
- package/build/types/consistentVersions.d.ts +1 -7
- package/build/types/consistentVersions.d.ts.map +1 -1
- package/build/types/fileContents.d.ts +1 -16
- package/build/types/fileContents.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/mustSatisfyPeerDependencies.d.ts +1 -95
- package/build/types/mustSatisfyPeerDependencies.d.ts.map +1 -1
- package/build/types/nestedWorkspaces.d.ts +1 -1
- package/build/types/nestedWorkspaces.d.ts.map +1 -1
- package/build/types/packageEntry.d.ts +1 -20
- package/build/types/packageEntry.d.ts.map +1 -1
- package/build/types/packageOrder.d.ts +1 -3
- package/build/types/packageOrder.d.ts.map +1 -1
- package/build/types/packageScript.d.ts +1 -16
- package/build/types/packageScript.d.ts.map +1 -1
- package/build/types/requireDependency.d.ts +1 -22
- package/build/types/requireDependency.d.ts.map +1 -1
- package/build/types/standardTsconfig.d.ts +1 -1
- package/build/types/standardTsconfig.d.ts.map +1 -1
- package/build/types/util/createRuleFactory.d.ts +14 -0
- package/build/types/util/createRuleFactory.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/alphabeticalDependencies.ts +2 -2
- package/src/alphabeticalScripts.ts +2 -2
- package/src/bannedDependencies.ts +2 -2
- package/src/consistentDependencies.ts +2 -2
- package/src/consistentVersions.ts +2 -2
- package/src/fileContents.ts +2 -2
- package/src/index.ts +8 -0
- package/src/mustSatisfyPeerDependencies.ts +2 -2
- package/src/nestedWorkspaces.ts +4 -4
- package/src/packageEntry.ts +2 -2
- package/src/packageOrder.ts +2 -2
- package/src/packageScript.ts +2 -2
- package/src/requireDependency.ts +2 -2
- package/src/standardTsconfig.ts +2 -2
- package/src/util/createRuleFactory.ts +33 -0
- package/build/js/chunk-A2MUUSNE.js +0 -26
- package/build/js/chunk-A2MUUSNE.js.map +0 -1
- package/build/js/public/util.js +0 -7
- package/build/js/public/util.js.map +0 -1
- package/build/types/public/util.d.ts +0 -2
- package/build/types/public/util.d.ts.map +0 -1
- package/build/types/util/makeRule.d.ts +0 -12
- package/build/types/util/makeRule.d.ts.map +0 -1
- package/src/public/util.ts +0 -1
- package/src/util/makeRule.ts +0 -29
package/build/types/index.d.ts
CHANGED
|
@@ -17,4 +17,5 @@ export { packageScript } from "./packageScript.js";
|
|
|
17
17
|
export { standardTsconfig } from "./standardTsconfig.js";
|
|
18
18
|
export { nestedWorkspaces } from "./nestedWorkspaces.js";
|
|
19
19
|
export { requireDependency } from "./requireDependency.js";
|
|
20
|
+
export { createRuleFactory, RuleCheckFn, RuleFactoryFn, RuleFactoryOptions, ValidateOptionsFn, } from "./util/createRuleFactory.js";
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,6BAA6B,CAAC"}
|
|
@@ -101,101 +101,7 @@ declare const Options: r.Union<[r.Partial<{
|
|
|
101
101
|
enforceForDevDependencies: r.Boolean;
|
|
102
102
|
}, false>]>;
|
|
103
103
|
export type Options = r.Static<typeof Options>;
|
|
104
|
-
export declare const mustSatisfyPeerDependencies:
|
|
105
|
-
skipUnparseableRanges?: undefined;
|
|
106
|
-
dependencyWhitelist?: undefined;
|
|
107
|
-
dependencyBlacklist?: undefined;
|
|
108
|
-
enforceForDevDependencies?: undefined;
|
|
109
|
-
} | ({
|
|
110
|
-
skipUnparseableRanges: boolean;
|
|
111
|
-
} & {
|
|
112
|
-
dependencyWhitelist?: undefined;
|
|
113
|
-
dependencyBlacklist?: undefined;
|
|
114
|
-
enforceForDevDependencies?: undefined;
|
|
115
|
-
}) | ({
|
|
116
|
-
dependencyWhitelist: string[];
|
|
117
|
-
} & {
|
|
118
|
-
skipUnparseableRanges?: undefined;
|
|
119
|
-
dependencyBlacklist?: undefined;
|
|
120
|
-
enforceForDevDependencies?: undefined;
|
|
121
|
-
}) | ({
|
|
122
|
-
dependencyBlacklist: string[];
|
|
123
|
-
} & {
|
|
124
|
-
skipUnparseableRanges?: undefined;
|
|
125
|
-
dependencyWhitelist?: undefined;
|
|
126
|
-
enforceForDevDependencies?: undefined;
|
|
127
|
-
}) | ({
|
|
128
|
-
enforceForDevDependencies: boolean;
|
|
129
|
-
} & {
|
|
130
|
-
skipUnparseableRanges?: undefined;
|
|
131
|
-
dependencyWhitelist?: undefined;
|
|
132
|
-
dependencyBlacklist?: undefined;
|
|
133
|
-
}) | ({
|
|
134
|
-
skipUnparseableRanges: boolean;
|
|
135
|
-
dependencyWhitelist: string[];
|
|
136
|
-
} & {
|
|
137
|
-
dependencyBlacklist?: undefined;
|
|
138
|
-
enforceForDevDependencies?: undefined;
|
|
139
|
-
}) | ({
|
|
140
|
-
skipUnparseableRanges: boolean;
|
|
141
|
-
dependencyBlacklist: string[];
|
|
142
|
-
} & {
|
|
143
|
-
dependencyWhitelist?: undefined;
|
|
144
|
-
enforceForDevDependencies?: undefined;
|
|
145
|
-
}) | ({
|
|
146
|
-
skipUnparseableRanges: boolean;
|
|
147
|
-
enforceForDevDependencies: boolean;
|
|
148
|
-
} & {
|
|
149
|
-
dependencyWhitelist?: undefined;
|
|
150
|
-
dependencyBlacklist?: undefined;
|
|
151
|
-
}) | ({
|
|
152
|
-
dependencyWhitelist: string[];
|
|
153
|
-
dependencyBlacklist: string[];
|
|
154
|
-
} & {
|
|
155
|
-
skipUnparseableRanges?: undefined;
|
|
156
|
-
enforceForDevDependencies?: undefined;
|
|
157
|
-
}) | ({
|
|
158
|
-
dependencyWhitelist: string[];
|
|
159
|
-
enforceForDevDependencies: boolean;
|
|
160
|
-
} & {
|
|
161
|
-
skipUnparseableRanges?: undefined;
|
|
162
|
-
dependencyBlacklist?: undefined;
|
|
163
|
-
}) | ({
|
|
164
|
-
dependencyBlacklist: string[];
|
|
165
|
-
enforceForDevDependencies: boolean;
|
|
166
|
-
} & {
|
|
167
|
-
skipUnparseableRanges?: undefined;
|
|
168
|
-
dependencyWhitelist?: undefined;
|
|
169
|
-
}) | ({
|
|
170
|
-
skipUnparseableRanges: boolean;
|
|
171
|
-
dependencyWhitelist: string[];
|
|
172
|
-
dependencyBlacklist: string[];
|
|
173
|
-
} & {
|
|
174
|
-
enforceForDevDependencies?: undefined;
|
|
175
|
-
}) | ({
|
|
176
|
-
skipUnparseableRanges: boolean;
|
|
177
|
-
dependencyWhitelist: string[];
|
|
178
|
-
enforceForDevDependencies: boolean;
|
|
179
|
-
} & {
|
|
180
|
-
dependencyBlacklist?: undefined;
|
|
181
|
-
}) | ({
|
|
182
|
-
skipUnparseableRanges: boolean;
|
|
183
|
-
dependencyBlacklist: string[];
|
|
184
|
-
enforceForDevDependencies: boolean;
|
|
185
|
-
} & {
|
|
186
|
-
dependencyWhitelist?: undefined;
|
|
187
|
-
}) | ({
|
|
188
|
-
dependencyWhitelist: string[];
|
|
189
|
-
dependencyBlacklist: string[];
|
|
190
|
-
enforceForDevDependencies: boolean;
|
|
191
|
-
} & {
|
|
192
|
-
skipUnparseableRanges?: undefined;
|
|
193
|
-
}) | {
|
|
194
|
-
skipUnparseableRanges: boolean;
|
|
195
|
-
dependencyWhitelist: string[];
|
|
196
|
-
dependencyBlacklist: string[];
|
|
197
|
-
enforceForDevDependencies: boolean;
|
|
198
|
-
}>) => import("@monorepolint/config").RuleModule<{
|
|
104
|
+
export declare const mustSatisfyPeerDependencies: import("./util/createRuleFactory.js").RuleFactoryFn<{
|
|
199
105
|
skipUnparseableRanges?: undefined;
|
|
200
106
|
dependencyWhitelist?: undefined;
|
|
201
107
|
dependencyBlacklist?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mustSatisfyPeerDependencies.d.ts","sourceRoot":"","sources":["../../src/mustSatisfyPeerDependencies.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAK9B,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAuKZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"mustSatisfyPeerDependencies.d.ts","sourceRoot":"","sources":["../../src/mustSatisfyPeerDependencies.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAK9B,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAuKZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAItC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAElD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oCAAoC,QAC0H,CAAC;AAE5K;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,yBAAyB,QACmL,CAAC;AAE1N;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,QACghB,CAAC;AAyNziB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAoFrF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAmEnE;AAoBD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,CAAC;AAC3D,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,UAAU,CAEnE"}
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as r from "runtypes";
|
|
8
8
|
export declare const Options: r.Literal<undefined>;
|
|
9
|
-
export declare const nestedWorkspaces:
|
|
9
|
+
export declare const nestedWorkspaces: import("./util/createRuleFactory.js").RuleFactoryFn<unknown>;
|
|
10
10
|
//# sourceMappingURL=nestedWorkspaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestedWorkspaces.d.ts","sourceRoot":"","sources":["../../src/nestedWorkspaces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,eAAO,MAAM,OAAO,sBAAc,CAAC;AAKnC,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"nestedWorkspaces.d.ts","sourceRoot":"","sources":["../../src/nestedWorkspaces.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,eAAO,MAAM,OAAO,sBAAc,CAAC;AAKnC,eAAO,MAAM,gBAAgB,8DA0C3B,CAAC"}
|
|
@@ -18,26 +18,7 @@ export declare const Options: r.Union<[r.Intersect<[r.Record<{
|
|
|
18
18
|
entriesExist: r.Array<r.String, false>;
|
|
19
19
|
}, false>]>;
|
|
20
20
|
export type Options = r.Static<typeof Options>;
|
|
21
|
-
export declare const packageEntry:
|
|
22
|
-
entries: {
|
|
23
|
-
[x: string]: unknown;
|
|
24
|
-
[x: number]: unknown;
|
|
25
|
-
[x: symbol]: unknown;
|
|
26
|
-
};
|
|
27
|
-
} & {
|
|
28
|
-
entriesExist?: undefined;
|
|
29
|
-
}) | ({
|
|
30
|
-
entriesExist: string[];
|
|
31
|
-
} & {
|
|
32
|
-
entries?: undefined;
|
|
33
|
-
}) | {
|
|
34
|
-
entries: {
|
|
35
|
-
[x: string]: unknown;
|
|
36
|
-
[x: number]: unknown;
|
|
37
|
-
[x: symbol]: unknown;
|
|
38
|
-
};
|
|
39
|
-
entriesExist: string[];
|
|
40
|
-
}>) => import("@monorepolint/config").RuleModule<({
|
|
21
|
+
export declare const packageEntry: import("./util/createRuleFactory.js").RuleFactoryFn<({
|
|
41
22
|
entries: {
|
|
42
23
|
[x: string]: unknown;
|
|
43
24
|
[x: number]: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageEntry.d.ts","sourceRoot":"","sources":["../../src/packageEntry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,eAAO,MAAM,OAAO;;;;;;;;;;;WAuBnB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"packageEntry.d.ts","sourceRoot":"","sources":["../../src/packageEntry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,eAAO,MAAM,OAAO;;;;;;;;;;;WAuBnB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;EA0CvB,CAAC;AAEH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,MAAM,UAE9D;AAED,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,MAAM,UAE1D"}
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT license. See LICENSE file in the project root for details.
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
|
-
export declare const packageOrder:
|
|
8
|
-
order: string[] | ((...args: any[]) => any);
|
|
9
|
-
} | undefined>) => import("@monorepolint/config").RuleModule<{
|
|
7
|
+
export declare const packageOrder: import("./util/createRuleFactory.js").RuleFactoryFn<{
|
|
10
8
|
order: string[] | ((...args: any[]) => any);
|
|
11
9
|
} | undefined>;
|
|
12
10
|
//# sourceMappingURL=packageOrder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageOrder.d.ts","sourceRoot":"","sources":["../../src/packageOrder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgDH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"packageOrder.d.ts","sourceRoot":"","sources":["../../src/packageOrder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgDH,eAAO,MAAM,YAAY;;cAgCvB,CAAC"}
|
|
@@ -13,22 +13,7 @@ export declare const Options: r.Record<{
|
|
|
13
13
|
}, false>;
|
|
14
14
|
export type Options = r.Static<typeof Options>;
|
|
15
15
|
export declare const MSG_NO_SCRIPTS_BLOCK = "No scripts block in package.json";
|
|
16
|
-
export declare const packageScript:
|
|
17
|
-
scripts: {
|
|
18
|
-
[x: string]: string | {
|
|
19
|
-
options: (string | undefined)[];
|
|
20
|
-
fixValue?: string | false | undefined;
|
|
21
|
-
};
|
|
22
|
-
[x: number]: string | {
|
|
23
|
-
options: (string | undefined)[];
|
|
24
|
-
fixValue?: string | false | undefined;
|
|
25
|
-
};
|
|
26
|
-
[x: symbol]: string | {
|
|
27
|
-
options: (string | undefined)[];
|
|
28
|
-
fixValue?: string | false | undefined;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
}>) => import("@monorepolint/config").RuleModule<{
|
|
16
|
+
export declare const packageScript: import("./util/createRuleFactory.js").RuleFactoryFn<{
|
|
32
17
|
scripts: {
|
|
33
18
|
[x: string]: string | {
|
|
34
19
|
options: (string | undefined)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageScript.d.ts","sourceRoot":"","sources":["../../src/packageScript.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,eAAO,MAAM,OAAO;;;;;SAUlB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,oBAAoB,qCAAqC,CAAC;AAEvE,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"packageScript.d.ts","sourceRoot":"","sources":["../../src/packageScript.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAG9B,eAAO,MAAM,OAAO;;;;;SAUlB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/C,eAAO,MAAM,oBAAoB,qCAAqC,CAAC;AAEvE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;EAsExB,CAAC"}
|
|
@@ -4,28 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT license. See LICENSE file in the project root for details.
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
|
-
export declare const requireDependency:
|
|
8
|
-
dependencies?: {
|
|
9
|
-
[x: string]: string;
|
|
10
|
-
[x: number]: string;
|
|
11
|
-
[x: symbol]: string;
|
|
12
|
-
} | undefined;
|
|
13
|
-
devDependencies?: {
|
|
14
|
-
[x: string]: string;
|
|
15
|
-
[x: number]: string;
|
|
16
|
-
[x: symbol]: string;
|
|
17
|
-
} | undefined;
|
|
18
|
-
peerDependencies?: {
|
|
19
|
-
[x: string]: string;
|
|
20
|
-
[x: number]: string;
|
|
21
|
-
[x: symbol]: string;
|
|
22
|
-
} | undefined;
|
|
23
|
-
optionalDependencies?: {
|
|
24
|
-
[x: string]: string;
|
|
25
|
-
[x: number]: string;
|
|
26
|
-
[x: symbol]: string;
|
|
27
|
-
} | undefined;
|
|
28
|
-
}>) => import("@monorepolint/config").RuleModule<{
|
|
7
|
+
export declare const requireDependency: import("./util/createRuleFactory.js").RuleFactoryFn<{
|
|
29
8
|
dependencies?: {
|
|
30
9
|
[x: string]: string;
|
|
31
10
|
[x: number]: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireDependency.d.ts","sourceRoot":"","sources":["../../src/requireDependency.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"requireDependency.d.ts","sourceRoot":"","sources":["../../src/requireDependency.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAgD5B,CAAC"}
|
|
@@ -24,6 +24,6 @@ declare const Options: r.Constraint<r.Partial<{
|
|
|
24
24
|
}, unknown>;
|
|
25
25
|
export interface Options extends r.Static<typeof Options> {
|
|
26
26
|
}
|
|
27
|
-
export declare const standardTsconfig:
|
|
27
|
+
export declare const standardTsconfig: import("./util/createRuleFactory.js").RuleFactoryFn<Options>;
|
|
28
28
|
export {};
|
|
29
29
|
//# sourceMappingURL=standardTsconfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standardTsconfig.d.ts","sourceRoot":"","sources":["../../src/standardTsconfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAK9B,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;WAuBT,CAAC;AAEL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC;CAAG;AAE5D,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"standardTsconfig.d.ts","sourceRoot":"","sources":["../../src/standardTsconfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAK9B,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;WAuBT,CAAC;AAEL,MAAM,WAAW,OAAQ,SAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,OAAO,CAAC;CAAG;AAE5D,eAAO,MAAM,gBAAgB,8DAkC3B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context, RuleEntry, RuleModule } from "@monorepolint/config";
|
|
2
|
+
export type ValidateOptionsFn<X> = (options: unknown) => asserts options is X;
|
|
3
|
+
export type RuleFactoryFn<T> = (ruleEntry: RuleEntry<T>) => RuleModule<T>;
|
|
4
|
+
export type RuleCheckFn<O> = (context: Context, options: O, extra: {
|
|
5
|
+
id: string;
|
|
6
|
+
}) => Promise<unknown> | unknown;
|
|
7
|
+
export interface RuleFactoryOptions<X> {
|
|
8
|
+
name: string;
|
|
9
|
+
check: RuleCheckFn<X>;
|
|
10
|
+
printStats?: () => void;
|
|
11
|
+
validateOptions: ValidateOptionsFn<X>;
|
|
12
|
+
}
|
|
13
|
+
export declare function createRuleFactory<X>({ name, check, validateOptions, printStats, }: RuleFactoryOptions<X>): RuleFactoryFn<X>;
|
|
14
|
+
//# sourceMappingURL=createRuleFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRuleFactory.d.ts","sourceRoot":"","sources":["../../../src/util/createRuleFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC;AAC9E,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC;AAC1E,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAEjH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;CACvC;AAGD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,EACnC,IAAI,EACJ,KAAK,EACL,eAAe,EACf,UAAU,GACX,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAa1C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monorepolint/rules",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha.0",
|
|
4
4
|
"author": "Eric L Anderson (https://github.com/ericanderson)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Mac Lockard (https://github.com/maclockard)"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"runtypes": "^6.7.0",
|
|
29
29
|
"semver": "^7.6.0",
|
|
30
30
|
"tslib": "^2.6.2",
|
|
31
|
-
"@monorepolint/
|
|
32
|
-
"@monorepolint/
|
|
33
|
-
"@monorepolint/
|
|
31
|
+
"@monorepolint/utils": "^0.6.0-alpha.0",
|
|
32
|
+
"@monorepolint/config": "^0.6.0-alpha.0",
|
|
33
|
+
"@monorepolint/core": "^0.6.0-alpha.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@jest/globals": "^29.7.0",
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { checkAlpha } from "./util/checkAlpha.js";
|
|
9
|
-
import {
|
|
9
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
10
10
|
|
|
11
|
-
export const alphabeticalDependencies =
|
|
11
|
+
export const alphabeticalDependencies = createRuleFactory<undefined>({
|
|
12
12
|
name: "alphabeticalDependencies",
|
|
13
13
|
check: (context) => {
|
|
14
14
|
checkAlpha(context, "dependencies");
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { checkAlpha } from "./util/checkAlpha.js";
|
|
9
|
-
import {
|
|
9
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
10
10
|
|
|
11
|
-
export const alphabeticalScripts =
|
|
11
|
+
export const alphabeticalScripts = createRuleFactory<undefined>({
|
|
12
12
|
name: "alphabeticalScripts",
|
|
13
13
|
check: (context) => {
|
|
14
14
|
checkAlpha(context, "scripts");
|
|
@@ -10,7 +10,7 @@ import { matchesAnyGlob } from "@monorepolint/utils";
|
|
|
10
10
|
import { AggregateTiming } from "@monorepolint/utils";
|
|
11
11
|
import * as path from "node:path";
|
|
12
12
|
import * as r from "runtypes";
|
|
13
|
-
import {
|
|
13
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
14
14
|
import { IPackageDependencyGraphNode, PackageDependencyGraphService } from "./util/packageDependencyGraphService.js";
|
|
15
15
|
// FIXME: This rule is messed. bannedTransitiveDependencies doesnt glob
|
|
16
16
|
|
|
@@ -49,7 +49,7 @@ const setCache = new Map<ReadonlyArray<string>, Set<string>>();
|
|
|
49
49
|
|
|
50
50
|
const aggregateTiming = new AggregateTiming(":bannedDependencies stats");
|
|
51
51
|
|
|
52
|
-
export const bannedDependencies =
|
|
52
|
+
export const bannedDependencies = createRuleFactory<Options>({
|
|
53
53
|
name: "bannedDependencies",
|
|
54
54
|
check: (context, opts, extra) => {
|
|
55
55
|
aggregateTiming.start(extra?.id ?? "unknown id");
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Context } from "@monorepolint/config";
|
|
9
9
|
import { diff } from "jest-diff";
|
|
10
10
|
import * as r from "runtypes";
|
|
11
|
-
import {
|
|
11
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
12
12
|
const Options = r
|
|
13
13
|
.Record({
|
|
14
14
|
ignoredDependencies: r.Array(r.String).Or(r.Undefined),
|
|
@@ -18,7 +18,7 @@ export type Options = r.Static<typeof Options>;
|
|
|
18
18
|
|
|
19
19
|
const skippedVersions = ["*", "latest"];
|
|
20
20
|
|
|
21
|
-
export const consistentDependencies =
|
|
21
|
+
export const consistentDependencies = createRuleFactory<Options>({
|
|
22
22
|
name: "consistentDependencies",
|
|
23
23
|
check: (context, args) => {
|
|
24
24
|
checkDeps(context, args, "dependencies");
|
|
@@ -9,14 +9,14 @@ import { Context } from "@monorepolint/config";
|
|
|
9
9
|
import { mutateJson, PackageJson } from "@monorepolint/utils";
|
|
10
10
|
import * as r from "runtypes";
|
|
11
11
|
import { coerce, SemVer } from "semver";
|
|
12
|
-
import {
|
|
12
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
13
13
|
export const Options = r.Record({
|
|
14
14
|
matchDependencyVersions: r.Dictionary(r.Union(r.String, r.Array(r.String))),
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
export type Options = r.Static<typeof Options>;
|
|
18
18
|
|
|
19
|
-
export const consistentVersions =
|
|
19
|
+
export const consistentVersions = createRuleFactory({
|
|
20
20
|
name: "consistentVersions",
|
|
21
21
|
check: checkConsistentVersions,
|
|
22
22
|
validateOptions: Options.check,
|
package/src/fileContents.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Context } from "@monorepolint/config";
|
|
|
9
9
|
import { diff } from "jest-diff";
|
|
10
10
|
import * as path from "path";
|
|
11
11
|
import * as r from "runtypes";
|
|
12
|
-
import {
|
|
12
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
13
13
|
const Options = r.Union(
|
|
14
14
|
r.Record({
|
|
15
15
|
file: r.String,
|
|
@@ -35,7 +35,7 @@ const Options = r.Union(
|
|
|
35
35
|
|
|
36
36
|
type Options = r.Static<typeof Options>;
|
|
37
37
|
|
|
38
|
-
export const fileContents =
|
|
38
|
+
export const fileContents = createRuleFactory<Options>({
|
|
39
39
|
name: "fileContents",
|
|
40
40
|
check: async (context, opts) => {
|
|
41
41
|
const fullPath = path.join(context.packageDir, opts.file);
|
package/src/index.ts
CHANGED
|
@@ -18,3 +18,11 @@ export { packageScript } from "./packageScript.js";
|
|
|
18
18
|
export { standardTsconfig } from "./standardTsconfig.js";
|
|
19
19
|
export { nestedWorkspaces } from "./nestedWorkspaces.js";
|
|
20
20
|
export { requireDependency } from "./requireDependency.js";
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
createRuleFactory,
|
|
24
|
+
RuleCheckFn,
|
|
25
|
+
RuleFactoryFn,
|
|
26
|
+
RuleFactoryOptions,
|
|
27
|
+
ValidateOptionsFn,
|
|
28
|
+
} from "./util/createRuleFactory.js";
|
|
@@ -11,7 +11,7 @@ import * as path from "node:path";
|
|
|
11
11
|
import * as r from "runtypes";
|
|
12
12
|
import { coerce } from "semver";
|
|
13
13
|
import resolvePackagePath from "resolve-package-path";
|
|
14
|
-
import {
|
|
14
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
15
15
|
|
|
16
16
|
const Options = r.Union(
|
|
17
17
|
r.Partial({
|
|
@@ -184,7 +184,7 @@ const Options = r.Union(
|
|
|
184
184
|
|
|
185
185
|
export type Options = r.Static<typeof Options>;
|
|
186
186
|
|
|
187
|
-
export const mustSatisfyPeerDependencies =
|
|
187
|
+
export const mustSatisfyPeerDependencies = createRuleFactory({
|
|
188
188
|
name: "mustSatisfyPeerDependencies",
|
|
189
189
|
check: checkSatisfyPeerDependencies,
|
|
190
190
|
validateOptions: Options.check,
|
package/src/nestedWorkspaces.ts
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
import * as globby from "globby";
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
import * as r from "runtypes";
|
|
11
|
-
import {
|
|
11
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
12
12
|
|
|
13
13
|
export const Options = r.Undefined;
|
|
14
14
|
|
|
15
15
|
type Options = r.Static<typeof Options>;
|
|
16
16
|
|
|
17
17
|
// Enforce that the root package.json contains all of the workspaces in the repo (including nested packages)
|
|
18
|
-
export const nestedWorkspaces =
|
|
18
|
+
export const nestedWorkspaces = createRuleFactory({
|
|
19
19
|
name: "nestedWorkspaces",
|
|
20
20
|
check: (context) => {
|
|
21
21
|
const rootPackageJson = context.getWorkspaceContext().getPackageJson();
|
|
@@ -26,8 +26,8 @@ export const nestedWorkspaces = makeRule({
|
|
|
26
26
|
const workspaces = Array.isArray(rootPackageJson.workspaces)
|
|
27
27
|
? rootPackageJson.workspaces
|
|
28
28
|
: rootPackageJson.workspaces !== undefined
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
? rootPackageJson.workspaces.packages
|
|
30
|
+
: undefined;
|
|
31
31
|
|
|
32
32
|
if (workspaces === undefined && packageJsonPaths.length > 0) {
|
|
33
33
|
context.addError({
|
package/src/packageEntry.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { mutateJson, PackageJson } from "@monorepolint/utils";
|
|
9
9
|
import { diff } from "jest-diff";
|
|
10
10
|
import * as r from "runtypes";
|
|
11
|
-
import {
|
|
11
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
12
12
|
|
|
13
13
|
export const Options = r.Union(
|
|
14
14
|
r
|
|
@@ -37,7 +37,7 @@ export const Options = r.Union(
|
|
|
37
37
|
|
|
38
38
|
export type Options = r.Static<typeof Options>;
|
|
39
39
|
|
|
40
|
-
export const packageEntry =
|
|
40
|
+
export const packageEntry = createRuleFactory<Options>({
|
|
41
41
|
name: "packageEntry",
|
|
42
42
|
check: (context, options) => {
|
|
43
43
|
const packageJson = context.getPackageJson();
|
package/src/packageOrder.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Context } from "@monorepolint/config";
|
|
9
9
|
import { diff } from "jest-diff";
|
|
10
10
|
import * as r from "runtypes";
|
|
11
|
-
import {
|
|
11
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
12
12
|
type OrderFunction = (context: Context) => (a: string, b: string) => number;
|
|
13
13
|
|
|
14
14
|
const Options = r
|
|
@@ -51,7 +51,7 @@ const defaultKeyOrder = [
|
|
|
51
51
|
"publishConfig",
|
|
52
52
|
];
|
|
53
53
|
|
|
54
|
-
export const packageOrder =
|
|
54
|
+
export const packageOrder = createRuleFactory<Options>({
|
|
55
55
|
name: "packageOrder",
|
|
56
56
|
check: (context, opts) => {
|
|
57
57
|
const packageJson = context.getPackageJson();
|
package/src/packageScript.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { mutateJson, PackageJson } from "@monorepolint/utils";
|
|
9
9
|
import { diff } from "jest-diff";
|
|
10
10
|
import * as r from "runtypes";
|
|
11
|
-
import {
|
|
11
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
12
12
|
|
|
13
13
|
export const Options = r.Record({
|
|
14
14
|
scripts: r.Dictionary(
|
|
@@ -26,7 +26,7 @@ export type Options = r.Static<typeof Options>;
|
|
|
26
26
|
|
|
27
27
|
export const MSG_NO_SCRIPTS_BLOCK = "No scripts block in package.json";
|
|
28
28
|
|
|
29
|
-
export const packageScript =
|
|
29
|
+
export const packageScript = createRuleFactory<Options>({
|
|
30
30
|
name: "packageScript",
|
|
31
31
|
check: (context, options) => {
|
|
32
32
|
const packageJson = context.getPackageJson();
|
package/src/requireDependency.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Context } from "@monorepolint/config";
|
|
|
9
9
|
import { mutateJson, PackageJson } from "@monorepolint/utils";
|
|
10
10
|
import { diff } from "jest-diff";
|
|
11
11
|
import * as r from "runtypes";
|
|
12
|
-
import {
|
|
12
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
13
13
|
|
|
14
14
|
const Options = r.Partial({
|
|
15
15
|
dependencies: r.Dictionary(r.String),
|
|
@@ -20,7 +20,7 @@ const Options = r.Partial({
|
|
|
20
20
|
|
|
21
21
|
type Options = r.Static<typeof Options>;
|
|
22
22
|
|
|
23
|
-
export const requireDependency =
|
|
23
|
+
export const requireDependency = createRuleFactory({
|
|
24
24
|
name: "requireDependency",
|
|
25
25
|
check: function expectPackageEntry(context: Context, options: Options) {
|
|
26
26
|
const packageJson = context.getPackageJson();
|
package/src/standardTsconfig.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { matchesAnyGlob } from "@monorepolint/utils";
|
|
|
10
10
|
import { diff } from "jest-diff";
|
|
11
11
|
import * as path from "path";
|
|
12
12
|
import * as r from "runtypes";
|
|
13
|
-
import {
|
|
13
|
+
import { createRuleFactory } from "./util/createRuleFactory.js";
|
|
14
14
|
|
|
15
15
|
const DEFAULT_TSCONFIG_FILENAME = "tsconfig.json";
|
|
16
16
|
|
|
@@ -41,7 +41,7 @@ const Options = r
|
|
|
41
41
|
|
|
42
42
|
export interface Options extends r.Static<typeof Options> {}
|
|
43
43
|
|
|
44
|
-
export const standardTsconfig =
|
|
44
|
+
export const standardTsconfig = createRuleFactory<Options>({
|
|
45
45
|
name: "standardTsconfig",
|
|
46
46
|
check: async (context, opts) => {
|
|
47
47
|
const tsconfigFileName = opts.file ?? DEFAULT_TSCONFIG_FILENAME;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Context, RuleEntry, RuleModule } from "@monorepolint/config";
|
|
2
|
+
|
|
3
|
+
export type ValidateOptionsFn<X> = (options: unknown) => asserts options is X;
|
|
4
|
+
export type RuleFactoryFn<T> = (ruleEntry: RuleEntry<T>) => RuleModule<T>;
|
|
5
|
+
export type RuleCheckFn<O> = (context: Context, options: O, extra: { id: string }) => Promise<unknown> | unknown;
|
|
6
|
+
|
|
7
|
+
export interface RuleFactoryOptions<X> {
|
|
8
|
+
name: string;
|
|
9
|
+
check: RuleCheckFn<X>;
|
|
10
|
+
printStats?: () => void;
|
|
11
|
+
validateOptions: ValidateOptionsFn<X>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let globalId = 0;
|
|
15
|
+
export function createRuleFactory<X>({
|
|
16
|
+
name,
|
|
17
|
+
check,
|
|
18
|
+
validateOptions,
|
|
19
|
+
printStats,
|
|
20
|
+
}: RuleFactoryOptions<X>): RuleFactoryFn<X> {
|
|
21
|
+
return function (ruleEntry) {
|
|
22
|
+
const id = ruleEntry.id ?? `${name} :: ${globalId++}`;
|
|
23
|
+
return {
|
|
24
|
+
id,
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-extra-non-null-assertion
|
|
26
|
+
check: (context) => check(context, ruleEntry.options!!, { id }),
|
|
27
|
+
name,
|
|
28
|
+
validateOptions,
|
|
29
|
+
ruleEntry,
|
|
30
|
+
printStats,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/util/makeRule.ts
|
|
2
|
-
var globalId = 0;
|
|
3
|
-
function makeRule({
|
|
4
|
-
name,
|
|
5
|
-
check,
|
|
6
|
-
validateOptions,
|
|
7
|
-
printStats
|
|
8
|
-
}) {
|
|
9
|
-
return function(ruleEntry) {
|
|
10
|
-
const id = `${name} :: ${globalId++}`;
|
|
11
|
-
return {
|
|
12
|
-
id,
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-extra-non-null-assertion
|
|
14
|
-
check: (context) => check(context, ruleEntry.options, { id }),
|
|
15
|
-
name,
|
|
16
|
-
validateOptions,
|
|
17
|
-
ruleEntry,
|
|
18
|
-
printStats
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
makeRule
|
|
25
|
-
};
|
|
26
|
-
//# sourceMappingURL=chunk-A2MUUSNE.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/makeRule.ts"],"sourcesContent":["import { Context, RuleEntry, RuleModule } from \"@monorepolint/config\";\n\nlet globalId = 0;\nexport function makeRule<X>({\n name,\n check,\n validateOptions,\n printStats,\n}: {\n name: string;\n check: (context: Context, options: X, extra: { id: string }) => Promise<unknown> | unknown;\n printStats?: () => void;\n validateOptions: (options: unknown) => asserts options is X;\n}): RuleFunction<X> {\n return function (ruleEntry) {\n const id = `${name} :: ${globalId++}`;\n return {\n id,\n // eslint-disable-next-line @typescript-eslint/no-extra-non-null-assertion\n check: (context) => check(context, ruleEntry.options!!, { id }),\n name,\n validateOptions,\n ruleEntry,\n printStats,\n };\n };\n}\n\ntype RuleFunction<T> = (ruleEntry: RuleEntry<T>) => RuleModule<T>;\n"],"mappings":";AAEA,IAAI,WAAW;AACR,SAAS,SAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKoB;AAClB,SAAO,SAAU,WAAW;AAC1B,UAAM,KAAK,GAAG,IAAI,OAAO,UAAU;AACnC,WAAO;AAAA,MACL;AAAA;AAAA,MAEA,OAAO,CAAC,YAAY,MAAM,SAAS,UAAU,SAAW,EAAE,GAAG,CAAC;AAAA,MAC9D;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|